tlopex opened a new pull request, #19732:
URL: https://github.com/apache/tvm/pull/19732
Fixes the failures in
tests/python/nightly/test_nnapi/test_from_exported_to_cuda.py (PyTorch export
-> Relax -> CUDA), which despite the directory name are plain CUDA
exported-program tests.
1. test_index_tensor: aten.index.Tensor with multiple index tensors and no
None entries was lowered through a sequential-take fast path, which computes an
outer product over the index tensors. PyTorch/NumPy advanced indexing
broadcasts the index tensors together and applies them jointly, so e.g. x[[0,
1], [0, 1]] on a (5, 5, 5, 5) tensor produced shape (2, 2, 5, 5) instead of (2,
5, 5). Route the no-None case directly to relax.op.index_tensor
(topi.adv_index), which implements the correct broadcast-and-zip semantics. The
sequential-take path is kept for the sliced (None-containing)
decomposed-interpolate pattern, whose orthogonal index shapes make the outer
product equivalent.
2. test_copy_ (and any in-place op on a buffer/user input):
functionalization in torch.export prepends mutation outputs (BUFFER_MUTATION /
USER_INPUT_MUTATION) to the graph outputs, and the importer returned them as
part of the Relax function's output tuple. Callers indexing outputs
positionally then read the mutated-buffer value instead of the model output.
Filter the outputs through the graph signature's output_specs and keep only
user-facing outputs (USER_OUTPUT / LOSS_OUTPUT). Frontend test expectations
that asserted the extra mutation outputs are updated.
3. test_cross_entropy_module:
- aten.sum over a bool tensor was emitted as relax.op.sum on the bool
input, which keeps dtype bool, so the non-ignored-target count in the
decomposed cross-entropy collapsed to 1.0 and the mean reduction degenerated to
a sum. Match PyTorch type promotion by casting bool and sub-64-bit integer
inputs to int64 (or the explicit dtype argument) before summing.
- The dlight GPU Fallback rule skipped blocks with zero loops entirely,
so rank-0 kernels (the scalar divide) were marked tirx.is_scheduled without any
thread binding and failed VerifyMemory. Bind such blocks through the existing
add-unit-loop path, and only skip zero-loop blocks that already launch threads
internally (e.g. opaque sort kernels), detected via thread_extent attrs /
thread-bound loops in the block body.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]