Skip to content

[Arith] Add constraint visitor snapshots - #20334

Draft
tlopex wants to merge 1 commit into
apache:mainfrom
tlopex:experiment/constr-visitor-main
Draft

tlopex wants to merge 1 commit into
apache:mainfrom
tlopex:experiment/constr-visitor-main

Conversation

@tlopex

@tlopex tlopex commented Sep 14, 2026

Copy link
Copy Markdown
Member

Some TIR analyses need to collect arithmetic premises at one IR location and replay them at another. The existing analyzer scope is tied to the traversal lifetime and cannot retain multiple independent snapshots.

This change adds ConstrVisitor and ConstrSet to collect supported scalar predicates, bindings, and ranges while visiting TIR. Snapshots can outlive the visitor, be renamed for different executions, merged as conjunctions, and replayed through the arithmetic analyzer.

Unsupported or side-effecting expressions are discarded conservatively, so omitted facts only weaken proofs. The visitor handles branches, loops, let bindings, Bind/AssertStmt, reduction initialization scopes, and if_then_else.

This is adapted from TileLang: https://github.com/tile-ai/tilelang/blob/main/src/transform/common/constr_visitor.h

@tlopex
tlopex marked this pull request as draft September 14, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant