[BugFix][Arith] Reject padded IterMapSimplify fallback - #20169
Open
zupengwang wants to merge 1 commit into
Open
Conversation
zupengwang
marked this pull request as ready for review
August 24, 2026 02:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19524.
Problem
When predicate-aware iter-map detection fails,
IterMapSimplifyretries detection without the predicate. The retry can introduce iterator padding, but the API returns only simplified expressions and drops the fallback'spadding_predicate.FlattenBuffercan therefore consume a non-equivalent flattened index. In theconv2d_transposereproducer from #19524, scheduled TIR contains(index - 1) // 2, while the affected path generated a shifted CUDA address and silently read out of bounds.Change
Validation
Base:
apache/tvm@4e9a099d154d7c4644a40a1a9c00b8873226468eEnvironment: NVIDIA RTX 3090 (SM86), CUDA 13.0 (
nvcc 13.0.48), GCC 11.5.0, CMake 4.4.2, TVM0.26.dev0.589/589targets built.python -m pytest tests/python/arith/test_arith_iter_affine_map.py -q:44 passed.python -m pytest tests/python/relax/test_transform_legalize_ops_nn.py::test_conv2d_transpose tests/python/relax/test_op_nn_convolution.py::test_conv2d_transpose_wrong_output_padding -q:2 passed.git diff --check: passed.GPU correctness experiment used 14
conv2d_transposecases (H=4..10,output_padding in {0, 1}), with PyTorchF.conv_transpose2das the oracle:Risk
For predicates that iter-map detection cannot parse, padded fallback mappings now retain their original expressions instead of being simplified. This is deliberately conservative and may reduce simplification in those cases; unpadded fallbacks keep the existing behavior.
Not run locally
The full upstream arm, cpu, docker, gpu, and wasm CI matrices were not run locally.