This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-tirx.git
The following commit(s) were added to refs/heads/main by this push:
new 03cb4822c [Fix][TIRx] Verify small tile domains before symbolic proof
(#159)
03cb4822c is described below
commit 03cb4822cfd2e859717725c2768263c8adc6cf38
Author: Shushi Hong <[email protected]>
AuthorDate: Mon Nov 2 08:12:09 2026 -0500
[Fix][TIRx] Verify small tile domains before symbolic proof (#159)
This PR moves complete finite-domain verification ahead of symbolic
proof in CUDA tile-pattern Context.require, while retaining native
simplification as the first step. Descriptor validation previously could
issue thousands of inconclusive Z3 queries before successfully checking
the same conditions by enumeration. When the remaining variables have
complete known finite domains, every value combination is now checked
first, without a point-count threshold. If enumeration is unavailable or
inconclusive, symbolic proof is still attempted so that accepted
premises can establish the condition. The pattern verifier’s DEFAULT Z3
fallback is enabled again, while the separate layout analyzer retains
its existing opt-out. The existing per-element descriptor validation
remains in place. A local compile-only run of the native GEMM reproducer
completed in approximately 4.08 seconds with both context fallbacks
enabled and generated identical CUDA source.
---
python/tvm_tirx/backend/cuda/tile/patterns/common.py | 9 ++++++---
tests/python/tirx/tile/cuda/test_explicit_patterns.py | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/python/tvm_tirx/backend/cuda/tile/patterns/common.py
b/python/tvm_tirx/backend/cuda/tile/patterns/common.py
index 79de578a8..05f46a76e 100644
--- a/python/tvm_tirx/backend/cuda/tile/patterns/common.py
+++ b/python/tvm_tirx/backend/cuda/tile/patterns/common.py
@@ -59,8 +59,6 @@ class Context:
def __init__(self, sctx, atom_scope="thread"):
self.sctx = sctx
self.analyzer = Analyzer()
- # Repeated descriptor checks use native proofs before bounded
verification.
- self.analyzer.set_z3_default_fallback(False)
# Reuse layout-query state across this instruction's address walk.
# Keep it separate from the bounded verifier so address construction
# does not depend on its evolving group/repeat/descriptor premises.
@@ -179,7 +177,8 @@ class Context:
),
order="post",
)
- if self.analyzer.can_prove(condition):
+ simplified = self.analyzer.simplify(condition)
+ if isinstance(simplified, IntImm) and int(simplified) != 0:
return
# Bitwise swizzles are not fully covered by the arithmetic analyzer.
# Check the already fixed group/repeat and enclosing-loop coordinates
@@ -211,6 +210,10 @@ class Context:
break
else:
return
+ # A failed point may be excluded by premises known to the analyzer.
+ # Preserve symbolic proof after an inconclusive enumeration.
+ if self.analyzer.can_prove(condition):
+ return
raise ValueError(f"{message}: cannot prove
{self.analyzer.simplify(condition)}")
def loops(self, shape):
diff --git a/tests/python/tirx/tile/cuda/test_explicit_patterns.py
b/tests/python/tirx/tile/cuda/test_explicit_patterns.py
index a6a4f09dc..0e6b49e88 100644
--- a/tests/python/tirx/tile/cuda/test_explicit_patterns.py
+++ b/tests/python/tirx/tile/cuda/test_explicit_patterns.py
@@ -161,7 +161,7 @@ def test_layout_analysis_is_separate_from_verification():
assert not ctx.layout_analyzer.can_prove(x < 4)
a, b = Var("a", "int32"), Var("b", "int32")
predicate = a * a + b * b >= 2 * a * b
- assert not ctx.analyzer.can_prove(predicate)
+ assert ctx.analyzer.can_prove(predicate) == ctx.analyzer.is_z3_enabled
assert not ctx.layout_analyzer.can_prove(predicate)