Skip to content

[FIX][TIR] Conservatively analyze unsigned branch conditions - #20344

Open
sepcnt wants to merge 5 commits into
apache:mainfrom
sepcnt:cond-dtype
Open

sepcnt wants to merge 5 commits into
apache:mainfrom
sepcnt:cond-dtype

Conversation

@sepcnt

@sepcnt sepcnt commented Sep 15, 2026

Copy link
Copy Markdown

Fixes #20343.
Fixes tile-ai/tilelang#3235.

Unsigned branch conditions can crash block access-region analysis because the inequality solver constructs negative coefficients using unsigned variable types, raising cannot make uint from negative value -1.
Keep unsupported unsigned conditions unresolved and conservatively analyze both branches, while preserving independent signed bounds.
Add regression coverage for zero comparisons, high-bit thresholds, wraparound predicates, and mixed signed/unsigned conditions.

@tqchen

tqchen commented Sep 15, 2026

Copy link
Copy Markdown
Member

Is this case from a real use-case, or AI/fuzzer, if so would be good to know the background.

The regression tests is too broad

Comment thread tests/python/s_tir/analysis/test_sblock_access_region.py Outdated
@sepcnt

sepcnt commented Sep 15, 2026

Copy link
Copy Markdown
Author

Is this case from a real use-case, or AI/fuzzer, if so would be good to know the background.

The regression tests is too broad

This came from a compilation error in a differentiable renderer kernel for winding number calculation.

@tqchen

tqchen commented Sep 15, 2026

Copy link
Copy Markdown
Member

Would be good to understand further on the shape of differentiable renderer kernel

please try to narrow the coverage, seems the error comes in arith, so it should be in a form of arith only testcase, and not through read write region

@tqchen

tqchen commented Sep 15, 2026

Copy link
Copy Markdown
Member

test should be in python

@tqchen

tqchen commented Sep 15, 2026

Copy link
Copy Markdown
Member

cc @tlopex would be good to see if we can have a more narrow check other than disabling, good to see candidates here and learnings

Adapt unsigned constant extraction to BigInt and the sym namespace. Collect unsigned ranges once during traversal, separately from signed equations, and cover high-bit constants and modular predicates.

Validation: full local build; 1103 Python tests passed, 53 skipped, 8 xfailed; 7 local C++ probes passed; changed-file pre-commit passed. TestTileAwareCompaction is excluded from the final run after reproducing its reflection-constructor failure with upstream conditional_bounds.cc. All four unsigned regressions fail with upstream code and pass with this fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants