compiler: Don't collect aliases guarded by a Dimension they don't span - #3010
Open
mloubout wants to merge 1 commit into
Open
compiler: Don't collect aliases guarded by a Dimension they don't span#3010mloubout wants to merge 1 commit into
mloubout wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3010 +/- ##
==========================================
+ Coverage 83.67% 83.68% +0.01%
==========================================
Files 257 257
Lines 54663 54686 +23
Branches 4683 4687 +4
==========================================
+ Hits 45739 45766 +27
+ Misses 8114 8111 -3
+ Partials 810 809 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
An alias is scheduled over the Dimensions it spans, but the guard it
inherits from its Cluster is kept as it is. When the guard reads a
Dimension the alias itself does not span, the temporary is computed in
a loop nest that does not define it, and the generated code does not
compile:
for (int x = ...)
if (sdf(x, y) >= 0) /* y is not iterated here */
r0[y] = ...
which is what an expression guarded by a ConditionalDimension over a
Function of all the Dimensions produces -- an immersed boundary
condition, say -- as soon as a sub-expression of it depends on fewer
Dimensions than the guard. The added test is an MFE of exactly that,
and fails to compile with "'x' undeclared" without this change.
Discard those aliases in `collect`, as the pivot is formed and before
its distance vectors and cost are computed. A SEQUENTIAL Dimension is
exempt: its loop encloses the alias' own, so the guard is evaluated
outside of them in any case, and requiring the alias to span it would
cost the hoisting of a time invariant guarded by a subsampled time
Dimension (`test_invariants_with_conditional`).
The Dimensions a guard reads are what `Guards` is asked for here, so
give it a `dimensions` property rather than walking its values from the
outside. `Cluster.guards_dimensions` was already doing that walk by
hand and now defers to it. The property returns the Dimensions as they
are, not their roots: `guards_dimensions` reaches `expose_tuning_knobs`
through `used_dimensions`, which tests them for `is_Block`, and a root
is never a BlockDimension.
Asking `Properties` whether a Dimension is SEQUENTIAL requires it to
still be one: `CireInvariants._lookup_key` was rebuilding it as a plain
`frozendict`, losing the class and its API, where the other
`_lookup_key` passes it through untouched -- so `collect` saw a
different type depending on which CIRE variant called it. `Properties`
is a `frozendict` itself, so preserving it there costs nothing.
mloubout
force-pushed
the
cire-guarded-aliases
branch
from
August 21, 2026 15:51
a52424a to
4440234
Compare
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.
Prevent aliaseas out of it's guards