Repository navigation
Conversation
Every forward jump out of nested structured code had its own flag, and the code after it ran under `if (!(flag_a || flag_b || ...))` over every jump pending at that level, written again after each block that raised another. In a long run of crossing jumps that is quadratic: a retail compute program of 76 699 instructions had 10 877 such guards of up to 600 flags, 95 of its 147 MB of HLSL. At most one of these jumps is taken at a time: once one is, no code runs until its target. They now share one variable holding the taken jump's target (0: none). A guard is `xcl_skip == 0u` (plus the targets inside a loop it enters), a target clears the variable if it is the one taken, and a loop is left with one `if (xcl_skip != 0u) break;` after its `continue`. That program's HLSL goes from 147 MB to 51 MB. Other programs barely change (a retail pack's compute programs: 6.11 GB to 6.01 GB). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Verified head
Not tested: AMD native wave64, full workspace, retail smoke ( |
|
Wave32 GPU follow-up on c920355, Windows 11 build 26300, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug. The GPU sections of these two tests require native wave64 as written. In a scratch copy I selected wave32 in the test fixtures and left the PR’s translator code unchanged.
Each filter ran under AI-assisted. Codex (GPT-6 family, exact variant unavailable) adapted and ran the fixtures and drafted this report. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
pvfreis
left a comment
There was a problem hiding this comment.
Review of c920355 (merge base 930e8b4; main has not touched recomp/mod.rs or tests.rs since), by reading the code; nothing was built or run here. I traced emit_structured for overlapping and nested jumps: several jumps to one target, a target inside a loop (also nested loops, and the latch), breaks out of loops, continue of an outer loop through a skip, rotated loops, and the reuse of an open guard after an item raises a new target. I found no defect in the shared variable. It is per-lane like the old flags and set from the same conditions, so its uniformity is unchanged.
- CONFIRMED: the GPU half of
crossing_forward_jumps_guard_in_linear_sizecompares the new skip code with itself. Withstructured: falsethe 24-jump program is not split into blocks.emit_rangefinds one span,[0, target 23), throughstructured_span(mod.rs:1100-1122) and emits it withemit_structured(mod.rs:1140-1146). Both forms therefore run the samexcl_skipguards; the only difference is thepcguard around the span and around the last block. A mistake in the guards would show in both forms, andassert_eq!(tests.rs:7642) would still pass. There is a second gap: the branch tests bitk % 8ofs0, so the first jump taken is always jump 0-7 or none. The six inputs cover four cases (no jump, jump 0 for1/0xA5/0xFF, jump 1, jump 7), and jumps 8-23 are never the one taken. Jump 0 is emitted as a plainif(item_at, nothing pending yet), so only0x5Aand0x80setxcl_skipat all. Suggested fix: compare against expecteds1/s2computed in Rust. If jumpkis taken first,s1 = k + 1and targetsk..=23each runs2 = (s2 + s1) ^ 1; with no jump taken,s1 = 24and all 24 targets run. Also test bitk % 24instead ofk % 8(buildis shared with the 40- and 160-jump size check, and the inline constant only reaches 64) and add inputs with a bit in 8..23, e.g.1 << 8and1 << 23, so that any jump can be the first one taken. (@thehollowedone's scratch run compared both forms against a CPU reference and they matched, so the behaviour checks out; the test as written does not check it.) A small fix while there: the comment attests.rs:7612sayss2 ^= s1 + k, but the code computess2 = (s2 + s1) ^ 1.
Also: HANDOFF.md describes these skips as xcl_skip_<target> flags (its "Structure" item under the structured-form notes). CONTRIBUTING asks for that to be named in the description.
Verdict: no defect found in the translator change as far as I read; the new test's GPU check is not independent of it.
Review by Claude Code (written by Claude Opus 5.5, checked with Claude Fable 5.2 and Claude Opus 5.5); each point checked by a person before posting.
|
We hit the same blow-up on the retail title (95cc13288a27a96e, the program from #1307) and fixed it the same way independently: one
Note for #1269: size alone does not make 95cc compile. Its structured form at DXC Measured on our integration tree (upstream main + our open changes), not on this PR's head alone: translation sizes from AI use: omp with Claude Opus 5.5 (the comparison and measurements). |
Synthetic DXC scaling check on
|
| Crossing jumps | HLSL bytes, base → PR | Skip references, base → PR | Median DXC, base → PR | DXIL bytes, base → PR |
|---|---|---|---|---|
| 40 | 79,572 → 55,483 | 1,638 → 195 | 81.44 → 30.05 ms | 6,976 → 4,244 |
| 160 | 537,852 → 134,641 | 25,758 → 795 | 1,127.94 → 74.50 ms | 18,452 → 5,032 |
| 320 | 1,958,716 → 240,369 | 102,718 → 1,595 | 6,001.88 → 168.65 ms | 34,620 → 6,072 |
Not tested
- Whole workspace suite, driver pipeline creation time, larger retail shaders, and retail-title smoke behavior in this run. The timing measures the standalone compiler on synthetic source.
AI use
- OpenAI Codex (GPT-6, exact model variant unavailable) adapted the test fixture, ran the checks and measurements, and prepared this report.
|
Test report for head Tested
Regression run
PR head: Not tested
AI use
|
|
@wondercrash @Sr-0w: unless one of you is already opening it, I'll take point 1 above (the indentation cap of structured code) as its own small PR against AI use: Claude Code (Claude Opus 5.5) wrote this comment. |
|
Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32) test and retail smoke report on clean head Tested
Regression run PR head ( Not tested: debug build, offline AI use: Antigravity ( |
emit_structured indented every nested if / loop one more level. A retail compute program whose loops nest ~65 deep carried 42.7 MB of leading whitespace in 53.0 MB of HLSL (~80 %, measured on xcl-dev#1345); DXC reads and keeps those bytes although they mean nothing to it. Indentation stops at 8 levels (MAX_INDENT); deeper code is written at the cap. Only whitespace changes. Measured on three retail compute programs on main alone (no xcl-dev#1345), size of the HLSL file: p16 29,598,855 -> 19,264,315 B (29.6 -> 19.3 MB) p17 29,524,131 -> 19,189,591 B (29.5 -> 19.2 MB) p18 151,193,185 -> 117,650,689 B (151.2 -> 117.7 MB) a saving of 22-35 % on main. Synthetic test program (14 nested ifs): 35346 -> 34498 bytes. dxc.rs:491-494 picks the DXC level from the raw src.len(), whitespace included. Programs of about 1.0 - 1.5 MiB move from -O1 to -O3 and programs of about 8 - 11 MiB from -O0 to -O1. None of the three measured programs crosses a line (all stay above 8 MiB, at -O0); DXC time p16 69.9 s -> 64.0 s, p17 63.1 s -> 63.2 s. emit_range (the unstructured fallback) is not capped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013qV4hiM5Sx9hBkPpgAarKX
|
Since my review, #1321 (
The other failure is the e2e title test on both (no swap chain in that session). 22 identical SKIPPED lines on both. The GPU half of Why: the test needs its 200-jump program to exceed Correction to point 1 of my review: "so the behaviour checks out" was too broad. It rests on one scratch run (RTX 3080 Ti, wave32) of the same six inputs that point itself says cover four cases. zGLados later reported an RX 7700 XT device hang in Not tested here: AMD, native wave64, a title. Run and written with Claude Code (Claude Opus 5.5), checked with Claude Fable 5.2; each point checked by a person before posting. |
emit_structured indented every nested if / loop one more level. A retail compute program whose loops nest ~65 deep carried 42.7 MB of leading whitespace in 53.0 MB of HLSL (~80 %, measured on xcl-dev#1345); DXC reads and keeps those bytes although they mean nothing to it. Indentation stops at 8 levels (MAX_INDENT); deeper code is written at the cap. Only whitespace changes. Measured on three retail compute programs on main alone (no xcl-dev#1345), size of the HLSL file: p16 29,598,855 -> 19,264,315 B (29.6 -> 19.3 MB) p17 29,524,131 -> 19,189,591 B (29.5 -> 19.2 MB) p18 151,193,185 -> 117,650,689 B (151.2 -> 117.7 MB) a saving of 22-35 % on main. Synthetic test program (14 nested ifs): 35346 -> 34498 bytes. dxc.rs:491-494 picks the DXC level from the raw src.len(), whitespace included. Programs of about 1.0 - 1.5 MiB move from -O1 to -O3 and programs of about 8 - 11 MiB from -O0 to -O1. None of the three measured programs crosses a line (all stay above 8 MiB, at -O0); DXC time p16 69.9 s -> 64.0 s, p17 63.1 s -> 63.2 s. emit_range (the unstructured fallback) is not capped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013qV4hiM5Sx9hBkPpgAarKX
# Conflicts: # crates/xcl/src/gpu/recomp/tests.rs
… in recomp/tests.rs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #1269.
Every forward jump out of nested structured code had its own flag (
xcl_skip_<target>), and the code after it ran underif (!(xcl_skip_a || xcl_skip_b || …))over every jump pending at that level, written again after each block that raised another one. A long run of crossing forward jumps is therefore quadratic in HLSL. In a retail pack, one compute program of 76 699 instructions had 10 877 such guards of up to ~600 flags each (about 10 KB per line): 95 of its 147 MB of HLSL. That program is one of the six over 8 MB that are compiled at-O0and that the driver does not finish (see the numbers in #1269).At most one of these jumps is taken at a time: once one is taken, no code runs until its target, so no other one can be raised in between. They now share one variable holding the taken jump's target (
0= none):xcl_skip = <target + 1>(0xFFFFFFFFfor the end);if (xcl_skip == 0u)— plus|| xcl_skip == <t>for targets inside a loop it enters, which the old guard left out the same way;continuefor a jump to the head, then oneif (xcl_skip != 0u) break;for every other one.What is in it
crates/xcl/src/gpu/recomp/mod.rs:skip_flag→skip_id/skip_taken/skip_clear;emit_structured,emit_rangeand the declaration use the one variable.crates/xcl/src/gpu/recomp/tests.rs:crossing_forward_jumps_guard_in_linear_size— N forward jumps whose ranges cross (cannot nest asifs). It checks that the uses of the skip variable grow linearly with N, then runs the structured and the dispatcher forms on the GPU for several jump patterns and compares the state. Without the change:1638 for 40, 25758 for 160and the test fails; with it, it passes.Measured on a retail pack's 12 361 compute programs (4 heap windows, structured):
This fixes the quadratic case only. The ordinary large programs that stall a world load (20 000 – 45 000 instructions, ~1 MB of DXIL) barely change: their size is per instruction.
Tested
cargo test --workspace -- --test-threads=4on the PR head: 752 passed, 0 failed, 41 ignored; no SKIPPED tests.jumps_to_outer_loop_heads_are_structured(120 random loop nests run in structured and dispatcher form on the GPU) passes with the change.main(quadratic count) and passes on the PR head.Regression run
main:PR head:
Not tested
-O0(over 8 MB), so it is still far too big for the driver; this only removes the quadratic part.AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA