Conversation
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.
Problem and root cause
Access-region analysis can crash while solving a branch condition involving an unsigned variable, for example when the solver constructs a negative unsigned literal. The linear solver subtracts terms and constructs negative coefficients, but unsigned arithmetic is modular and does not satisfy the signed-integer assumptions used by this path.
Change
src/tirx/transform/ir_utils.cc: admit only signed scalar integer variables to this conditional-bounds solver. Leave other conditions unresolved so access analysis retains conservative bounds.tests/python/s_tir/analysis/test_sblock_access_region.py: add ten unsigned cases covering uint32/uint64 equality, inequality, ordering, and wraparound, plus a signed control case confirming that signed bounds still refine.This deliberately trades refinement of unsupported conditions for correctness.
Tests and validation
All 11 new cases pass. Eight unsigned cases crash on unmodified upstream. The whole test file produces 21 passed, 2 failed, 0 skipped on this branch. Both remaining failures also occur on unmodified upstream with the same configuration:
test_block_access_region_detector: structural-equality mismatch in the inferred region.test_opaque_access_with_tvm_access_ptr: expected ValueError is not raised.PYTHONPATH=$PWD/python python -m pytest -q \ tests/python/s_tir/analysis/test_sblock_access_region.py pre-commit run --files src/tirx/transform/ir_utils.cc \ tests/python/s_tir/analysis/test_sblock_access_region.pyValidation environment: Apple M4 Max, macOS/Darwin 24.5.0 arm64, Python 3.12.11. Each branch was rebuilt separately from upstream
907a88c87with:cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DUSE_METAL=ON -DUSE_LLVM=OFF -DUSE_CUDA=OFF -DUSE_Z3=OFF cmake --build build --target tvm tvm_compiler tvm_runtime -j 8git diff --checkpasses. The applicable formatting and other pre-commit hooks pass. The repository-wide ASF-header hook reports 11 existing violations, reproduced on unmodified upstream; none is in the changed files.Related
No duplicate open PR was found. This conditional-solver change is independent of the analyzer work in #67 and #72.