Skip to content

[ARITH] Scope interval constraints to mapped variables#19963

Merged
tqchen merged 3 commits into
apache:mainfrom
tqchen:fix-relax-loop-var-def-use
Jul 6, 2026
Merged

[ARITH] Scope interval constraints to mapped variables#19963
tqchen merged 3 commits into
apache:mainfrom
tqchen:fix-relax-loop-var-def-use

Conversation

@tqchen

@tqchen tqchen commented Jul 6, 2026

Copy link
Copy Markdown
Member

Rationale

Analyzer constraint scopes continue to provide loop-positive facts to constant-bound and rewrite proofs. During IntSet relaxation, however, a scoped domain constraint is a refinement only for a variable explicitly present in the relaxation map. Applying it to an unmapped variable reinterprets a free parameter as a relaxation domain and can let a loop-local symbol survive recursive interval evaluation.

Changes

  • Apply scoped IntSet constraints only to variables already present in the relaxation map; unmapped variables remain free parameters.
  • Remove the finite-bound restoration fallback and its stronger parametric-bound contract.
  • Add a direct compact-buffer regression that prevents a loop-local variable from escaping into a function-scope allocation extent.

tqchen and others added 2 commits July 6, 2026 13:54
Scoped domain constraints refine variables already present in the
relaxation map; they do not turn free parameters into relaxation domains.

Apply a scoped constraint only when the variable is explicitly mapped,
remove the finite-bound restoration fallback, and cover loop-local escape
through compact-buffer simplification.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the IntervalSetEvaluator in src/arith/int_set.cc by removing logic that preserved parametric bounds under one-sided constraints and by checking dom_map_ early when evaluating variable nodes. It also removes a related test case and adds a new test test_loop_var_does_not_escape_compacted_buffer_extent to verify that loop variables do not escape compacted buffer extents. The feedback suggests removing a redundant cast var.as_or_throw<PrimExpr>() since Var can be implicitly converted to PrimExpr.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/arith/int_set.cc
Run the loop-variable escape case directly in the compact-buffer suite so
its scope assertion stays at the pass that owns allocation extent compaction.
@tqchen tqchen merged commit e1e7ac9 into apache:main Jul 6, 2026
8 checks passed
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.

2 participants