Repository navigation
Conversation
catminou4
left a comment
There was a problem hiding this comment.
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 99 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.
New bitcode optimize() pass: bounded (4 iterations) constant folding + trivial-phi compression with a step budget, unreachable-block phi pruning, branch folding on constant conditions, then pure DCE. is_pure is conservative (Load/Store/AtomicRmw/CmpXchg and non-ReadNone calls are roots; metadata values and CondBr conditions are roots too), and unused external declarations are dropped with index remapping. +3 macOS tests (99 total).
|
A regression on WARP: RTX 3070 (driver 616.56) plus WARP, Windows 11, debug,
Each fails alone too (
Cause found. Fix: let the DCE also drop unused calls whose function is Op::Call(f, _) => matches!(self.funcs[*f as usize].attr, Some(Attr::ReadNone | Attr::ReadOnly)),With exactly that change, the three tests above pass, and the full AI-assisted (Claude Code). Synthetic tests only. |
|
Found the cause of the WARP regression, and a one-line fix (details in my comment above): the DCE leaves |
|
Independent follow-up on this PR's exact head The one-seed 64-register case went from 66 to 2 PHIs and from 4,168 to 3,724 bytes. Microsoft DXV accepted all 12 A/B outputs. Each two-seed case stayed byte-identical. On RTX 4070 Ti SUPER, all eight before/after 2- and 16-register cases matched all 72 checked output words. Prevalence, compile-time impact, and 64-register GPU execution remain unmeasured. Patch, opt-in fixture, reproduction and results. This builds on #1716's optimizer; the fixture can also be used on its own. AI-assisted with Codex. |
|
Measured offline on the title's shaders (as in #1247): merged onto main
This is separate from upipibi's WARP finding above. The likely cause is that dead-code elimination removes the last use of an operation or a declaration, but the module still declares the matching shader flags, or keeps the now-unused internal global. The validator checks both. Offline counts only; no program names or data. |
|
Automated triage for the maintainers. Thanks for the rebase. On current What would change the verdict:
I read the folding rules ( CI: Generated by Claude Code |
|
Measured on current Triage asked for a benefit this can show. I merged head
What this does not show: GPU time. A driver's compiler removes dead code itself, so the likelier gain is pipeline compile time and cache size. I did not measure either. Local title data, offline, CPU only; counts and validator reasons only. The title was not run. AI-assisted |
…d pure ops in bitcode
758bf7f to
bad2fb4
Compare
|
Rebased onto current main (940d32f) and addressed all three issues from the reviews (commit �ad2fb4):
|
|
@bartikele Re-run at
The suite gives 248 passed, 3 failed, 3 ignored in both runs. The 3 are #1744's NVIDIA failures that AI-assisted (Claude Code). Synthetic tests only. |
|
Rebased onto current main (67e8ae1, commit 436a091), integrating with 286a00e:
Verified on 67e8ae1:
|
bad2fb4 to
436a091
Compare
|
Re-measured after the rebase. Head |
…d pure ops in bitcode
…d pure ops in bitcode
|
Measured on NVIDIA: what the folding changes in the DXIL, and on the card. Setup: RTX 3060 12 GB (Ampere), driver 610.88, Windows 11 26200, release. This PR merged onto Correctness: DXIL size, over the 1,330 programs the suite translates: instructions written 51,089 → 45,057 (−11.8 %); integer arithmetic −23 %, casts −14 %, compares −6 %, selects −5 %, calls (loads, samples, wave ops) −0.2 %; bitcode bytes −1 %. GPU time: the heaviest programs of the suite (ray/box intersection ~1,090 instructions, title memory at computed addresses ~880, waterfall loops ~370, f16 and gather tests), median of 5 alternated runs, µs per dispatch:
Those programs do shrink (1,086 → 1,066, 876 → 838, 371 → 334 instructions), but the card's time does not move: NVIDIA's compiler already folds these. So on this card the gain would be smaller modules (and perhaps shorter pipeline compiles, not measured), not GPU time. One block-local count for the next passes: within blocks, 2.1 % of instructions repeat an earlier pure value, 6.5 % of reads repeat an earlier read with no store between, and pure calls almost never repeat. Not tested: a title; AMD; pipeline creation time. AI use: Claude Code ran the builds and measurements on this machine and drafted this comment. |
Summary
Verification