Skip to content

compiler: Key the injective storage exemption on a zero distance - #3092

Merged
mloubout merged 2 commits into
mainfrom
fix-subsampled-inc-fusion
Oct 26, 2026
Merged

mloubout merged 2 commits into
mainfrom
fix-subsampled-inc-fusion

Conversation

@mloubout

Copy link
Copy Markdown
Contributor

No description provided.

An injective Dimension was exempted from `is_storage_related` outright. That
is too strong: injectivity says distinct iterations map to distinct indices,
so only the *same* iteration can reach a given location -- it says nothing
about two different offsets off that Dimension, which do collide.

`is_storage_related` also gates fusion and lifting, so the blanket exemption
split `f[ci]` and `f[ci+1]` into separate loops, and the second overwrote what
the first produced instead of interleaving per iteration:

    Eq(g, i), Eq(f, g), Eq(f[ci+1], g, implicit_dims=cend)
    # f == [0, 0, 4, 8, 12, 16], one slot off throughout

Require a zero distance for the exemption, which is exactly the subsampled
`Inc` it was added for, and leave every other dependence as before.
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.40%. Comparing base (2d37925) to head (b45f9fc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3092   +/-   ##
=======================================
  Coverage   84.39%   84.40%           
=======================================
  Files         260      260           
  Lines       58125    58153   +28     
  Branches     4943     4948    +5     
=======================================
+ Hits        49054    49082   +28     
  Misses       8248     8248           
  Partials      823      823           
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.45% <44.44%> (-0.01%) ⬇️
pytest-gpu-gcc- 79.09% <100.00%> (+0.01%) ⬆️
pytest-gpu-icx- 79.03% <100.00%> (-0.01%) ⬇️
pytest-gpu-nvc-nvidiaX 69.15% <44.44%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

`DummyEq(lhs, rhs)` wrapped its arguments in a DSL `Eq` and pushed them back
through `LoweredEq`'s lowering path. But its callers are compiler passes
holding already-lowered IR, so the DSL-to-IR rewrites ran a second time.

For most LHSs that is a no-op, which is why it went unnoticed. A
ConditionalDimension LHS, though, becomes `IntDiv(parent, factor)` -- an
expression, not an assignment target. A backend that emits an index
assignment then produces

    IntDiv(time, ctf) = ct_m + (int)idx[0]

and `LoweredEq.dtype` raises `AttributeError: 'IntDiv' object has no
attribute 'dtype'`. The SYCL parallelizer does exactly this for its
parallel_for indices, where every other backend prints the loop variable by
name and so never looks at the lowered form.

Construct the ClusterizedEq directly instead, as the class docstring already
describes. `LoweredEq`'s own two-argument form bypasses lowering for the same
reason.
@mloubout
mloubout merged commit 61a2745 into main Oct 26, 2026
42 checks passed
@mloubout
mloubout deleted the fix-subsampled-inc-fusion branch October 26, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants