Repository navigation
fix: Prevent tgpu.unroll from introducing possible side effects - #3237
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
tgpu.unroll from introducing possible side effects
|
pkg.pr.new packages benchmark commit |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.49, 1.01, 2.14, 3.31, 3.73, 6.13, 12.18, 12.12]
line [0.48, 0.98, 2.21, 3.46, 4.30, 6.70, 12.04, 13.79]
line [0.50, 1.05, 1.95, 2.85, 3.76, 6.16, 12.16, 11.31]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.15, 0.29, 0.36, 0.43, 0.58, 0.61, 0.68, 0.77]
line [0.14, 0.23, 0.33, 0.43, 0.54, 0.58, 0.70, 0.78]
line [0.17, 0.29, 0.37, 0.41, 0.59, 0.57, 0.70, 0.80]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.47, 1.20, 2.07, 3.71, 6.66, 13.34, 28.75, 58.14]
line [0.48, 1.08, 2.08, 3.69, 6.55, 13.70, 29.63, 59.09]
line [0.44, 1.20, 2.17, 3.69, 6.68, 13.70, 29.57, 58.40]
|
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased (max 0.00%) | ❔ Unknown |
|---|---|---|---|
| 0 | 349 | 6 | 0 |
No notable changes.
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
There was a problem hiding this comment.
Caution
The production fix is correct, but the new regression test does not compile and fails at resolution time: std.isKnownAtComptime is not a real API. CI (test:unit / test:types) will be red until the test is rewritten.
Reviewed changes
wgslGenerator.tsunrolled loop index — the constant loop index is now created withsnip(i, u32, 'constant', false)instead of the defaultpossibleSideEffects: true; sinceaccessIndexpropagatestarget.possibleSideEffects || index.possibleSideEffects, this stops the flag from leaking into every unrolled element.unroll.test.tsregression test — a newdoes not introduce possibleSideEffectstest using an accessor array; see the inline comment, as it references a function that does not exist.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
837fa2a to
fb70b2e
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The PR was rebased onto feat/std-is-known-at-comptime since the last review; the fix and test content are otherwise unchanged.
- Unrolled-loop index side effects — the constant loop index is still built with
snip(i, u32, 'constant', false), soaccessIndexno longer propagatespossibleSideEffectsonto every unrolled element. - Regression test now valid — retargeting the base makes
std.isKnownAtComptimeavailable, and that builtin throws on an argument withpossibleSideEffects. Verified locally: the test passes with the fix and fails when line 1864 is reverted tosnip(i, u32, 'constant'), so it genuinely pins the fix and the previous blocker is resolved.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
fb70b2e to
b65c973
Compare
2c7e842 to
4c0964d
Compare
b65c973 to
9f1b40f
Compare
4c0964d to
d08b2b9
Compare
9f1b40f to
e5ebb3a
Compare
d08b2b9 to
654963b
Compare
iwoplaza
left a comment
There was a problem hiding this comment.
Looks good! Just rebase on top of main

No description provided.