Recompiler: add opt-in XCL_WAVE_LOCAL=1 compute lowering #3042
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3042"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-27T16:47:58Z.
Stacked on #3040. Only the top commit belongs to this PR.
Adds opt-in
XCL_WAVE_LOCAL=1compute lowering to HLSL, Direct DXIL, and per-lane DXIL. Rebased ontomain(7a572ab2) atop #3040 (f197cb2d) without modifyingREADME.md, preservingmain's rodata, dispatch remapping, and atomic operand handling. Part of #3011.What is in it
Tested
cargo test -p xcl --lib wave_local -- --test-threads=1ona92f307d: 28 passed, 0 failed, 0 ignored.7a572ab2rebase andREADME.mddrop,cargo test --workspace --no-fail-fast -- --test-threads=4on5e470d3e: 2,693 passed, 4 failed, 49 ignored, and 30SKIPPEDlines (21 no wave64, 3 per-lane f16/f32-to-f16 refusals, 2 no heap windows, 2 mesh pipeline PC skips, 1 cannot disable driver cache, 1gpu::recompskip line). The 4 failures weregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}(also present on#3040).cargo test --release -p xcl --lib retail_wave_local_census -- --nocapture --test-threads=1on5e470d3ewithXCL_SAMPLE_RPF: 26,503 records, 2,689 compute shaders (1,535 wave32, 1,154 wave64); 359 accepted (340NoCrossHalf, 19SingleWave).cargo test --release -p xcl --lib retail_wave_local_buffer_differential -- --nocapture --test-threads=1on5e470d3ewithXCL_SAMPLE_RPFandXCL_SAMPLE_WAVE_LOCAL_DIFF=1: 1 passed, 0 failed, 0 ignored. Out of 359 accepted shaders, all 31 that wrote to the seeded buffers matched split-wave64 HLSL (0 mismatches), 105 produced no observable writes with these inputs, and 223 required image bindings.XCL_WAVE_LOCAL=160 s smoke run ona92f307dlogged 9wave-local (lines.Regression run
60 seconds per run on the same retail title with fresh per-run
XCL_DATA_ROOTdirectories,XCL_PREPARE=0, andXCL_ADAPTER=RTX 5090.Main
Lowering head, default
Lowering head,
XCL_WAVE_LOCAL=1Not tested
7a572ab2rebase (a92f307d).a92f307d.AI use
gemini-pro-orchestrator-neon) and Codex (gpt-6.2-sol) assisted the original adaptation. Codex (gpt-6.2-sol) handled the earlier review fixes and initial rebase.Gemini 4 Hydrogen) in T3 Code rebased onto7a572ab2, dropped theREADME.mdedit, ran thewave_localtests and 60 s smoke runs ona92f307d, pushed the branch, and updated this report.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-27T20:13:57Z.
AMD run (listed as untested), with an RTX 3060 in the same PC: the 22 new tests pass on both, and the rest of
gpu::is unchanged withXCL_WAVE_LOCALunset and with it=1.Tested: pass, head
becdecfapplied onmain6089122, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17, card picked withXCL_ADAPTER(log:backend 'real' – AMD Radeon RX 9070 XT/– NVIDIA GeForce RTX 3060).cargo test -p xcl --lib -- wave_local gpu:: --test-threads=4 --nocapture:main713 passed, 2 failed, 6 SKIPPED; PR 735 passed, 2 failed, 6 SKIPPED; PR withXCL_WAVE_LOCAL=1the same 735 / 2 / 6. The 2 failures are the #2115 fuzz seeds (fuzz_validate_and_gpu_1,_3), the same onmain.main715 passed, 0 failed, 24 SKIPPED; PR 737 passed, 0 failed, 24 SKIPPED, unset and=1.The only result changes are the 22 new tests, all ok, among them
gpu_no_cross_half_matches_split_wave64andgpu_rejected_shader_falls_back_to_split. The SKIPPED sets matchmain.On native wave64: as I read
gpu_no_cross_half_matches_split_wave64, the wave-local form is checked to be a[WaveSize(32)]program and compared against the split wave64 form, so it runs the same on both cards. So the new tests don't run the wave-local path as a native 64-lane wave on the RX 9070 XT either.Not tested: native wave64 hardware execution of the new path, frame times in a title,
--measure-pso, release, Intel.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by razormontana on 2026-11-28T00:49:44Z.
Independent native validation of the clean published stack at
becdecfe8895548fc6329e572b44cba010757accon #3040962cdca84c402e0254cc1c6909bb82393164cd21. Windows 11 Pro build 22631, Core i7-10700K, RTX 3070 8 GB with NVIDIA 617.42, Rust 1.100.0 x64 MSVC. Windows SDK DXC 1.9.2602.17.Tested
cargo test --offline --locked -j 1 -p xcl --lib --no-run --message-format=json-render-diagnosticssucceeded. The native executable rangpu_no_cross_half_matches_split_wave64,gpu_single_wave_matches_split_wave64, andgpu_rejected_shader_falls_back_to_splitby exact name with--test-threads=1 --nocaptureand the RTX 3070 selected.6089122a. It had four content conflicts when checked against NVIDIA revisiond1be8103.Not tested
Retail, the game-data census or benchmark, GPU performance, or a reconciled NVIDIA port.
AI use
Codex GPT-6.2 ran the focused validation, checked the results, and prepared this report.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T01:20:42Z.
Tested
Clean
becdecfe8895548fc6329e572b44cba010757accon Intel Arc A770 (PCI8086:56a0, driver32.0.101.9175), Ryzen 7 3800X, Windows 11 25H2 build 26200.9974, Rust 1.100.1 MSVC debug, and DXC/DXIL 1.9.2602.17.I reran the pinned stock executable with
XCL_ADAPTER=A770and<libtest.exe> --exact <test> --nocapture --test-threads=1for each of these fixtures undergpu::recomp::wave_local::tests. The shared Arc lock covered all three processes. All native exits and the wrapper exit were 0, and the executable hash matched before, during and after the lock.gpu_no_cross_half_matches_split_wave64— Wave-local HLSL, Direct DXIL and per-lane DXIL each matched all 320 readback dwords from the split HLSL reference for each of four threadgroup shapes (64×1×1,8×8×1,48×1×1,128×1×1).gpu_single_wave_matches_split_wave64— The same three backends matched the split HLSL reference's nonzero atomic count and sorted output values for groups of 32, 16 and 24 threads.gpu_rejected_shader_falls_back_to_split— The rejected lane-40 read dispatched via split HLSL, matched all 192 reference dwords, and wrote40to all 64 output dwords. Direct DXIL reported no wave-local lowering, and the per-lane helper rejected the cross-half read. Those two DXIL checks were translation-only.3 passed, 0 failed, 0 ignored, 0 runtime skips.
Not tested
Native wave64, GPU execution of the rejected DXIL cases, default policy or title-level backend selection, retail smoke, performance, and the full suite.
AI use
T3 Code through the Codex harness (
gpt-6.2-sol) verified provenance and adapter selection, ran the stock fixtures and wrote this report.Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-28T02:26:46Z.
Test report for
becdecfas it is (the PR's head, with #3040 under it; basef9a0cb8), on an RTX 3090, a 32-lane card.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4onbecdecf(XCL_WAVE_LOCALunset): 1486 passed, 0 failed, 47 ignored.wave_localtests: 22 passed, among them the three GPU ones (gpu_no_cross_half_matches_split_wave64,gpu_single_wave_matches_split_wave64,gpu_rejected_shader_falls_back_to_split), which also passed on the RTX 3070 and the Arc A770 reports above.SKIPPEDon this adapter: 25 lines. 21 are "no wave64" (8 with that reason alone, 13 fromlower_dxil::testswith the part named, e.g. "f32 arithmetic, wave64: no wave64"); 3 are the per-lane form refusing f16 / packed f16 / f32-to-f16 conversions ("its #1426 semantics differ from the console's"); 1 isheap_window_out_of_memory_falls_back_to_the_switch_form("no heap windows"). None of them is awave_localtest.scripts/smoke.ps1, 200 s, with the switch off (the default), below: 0wave-local (lines in the PR's log.Regression run
main6089122and this head, same machine, same title, 200 s, the same scripted A presses (XCL_PRESS_A_AT),XCL_PREPARE=0on both, each run with its own copy of the same shader cache. Both runs usedmain'sscripts/smoke.ps1.main:
this PR's head:
Frames 95.6 % of
main's, peak commit 118.4 % ofmain's, no device removal and no crash on this head. One run each.Not tested
XCL_WAVE_LOCAL=1in the title (frame times, image): this report covers the default only.AI use: Claude Code, model Claude Opus 5.5. It built both commits, ran the suite and the two smoke runs on the machine above, read the logs and wrote this. The person running these tests asked for this post.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-28T09:01:02Z.
Ran the wave-local lowering tests at
becdecfeon an NVIDIA Blackwell desktop part:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
All 22 tests matching
wave_localpass, including the three GPU differential tests (gpu_no_cross_half_matches_split_wave64,gpu_single_wave_matches_split_wave64and the fallback case) on a genuine 32-lane adapter. I did not setXCL_WAVE_LOCAL=1in a real session or run the optional retail benchmark. The thread has runs on RTX 3060, RTX 3090 and AMD, but no 5070 Ti.Not tested: a title with
XCL_WAVE_LOCAL=1, theXCL_SAMPLE_*benchmark, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-28T22:04:18Z.
Review: COMMENTED
Critical-review result: I found no concrete lowering defect in the wave-local wiring. The selected tier consistently disables split exchange, uses hardware wave32 sizing, zeros the upper ballot word, and separates translated-cache identity.
Because correctness depends on #3040 rejecting every cross-half dependency, please treat corpus differential validation against the existing split-wave64 path as the merge gate for this opt-in. Also rebase the current conflict without combining additional behavior changes.
Reviewed at
becdecfe88with Codex (GPT-5).Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-28T23:41:32Z.
@bmjask Thanks for the review. Both items are addressed at
43d0c866:main(10373744, preserving its rodata, dispatch remapping, and atomic operand handling) atop #3040 (c56cfcdd) with no merge conflicts.retail_wave_local_buffer_differential, RTX 5090, release): Out of 1,154 wave64 compute shaders in the retail pack, 359 were accepted (340NoCrossHalf, 19SingleWave). All 31 shaders that produced observable writes to the seeded buffers matched split-wave64 HLSL with 0 mismatches (record1d7d9f365982e397matched once its synthetic buffer views were given disjoint ranges). 105 produced no observable writes with these inputs and 223 required image bindings (reported separately, not counted as output parity).XCL_WAVE_LOCAL=1: 1,389 frames with 154 unique wave-local translations vs. default 1,382 andmain1,423; startup/loading covered, in-world rendering unverified). Direct/per-lane DXIL retail corpus parity and native wave64/AMD/Intel on the rebased head remain untested.Full test counts and smoke blocks are in the updated PR description.
AI use: Codex (
gpt-6.2-sol) resolved the rebase conflict, ran the corpus differential, workspace suite, and smoke checks, and updated the PR description. Antigravity (Gemini 4 Hydrogen) drafted and posted this reply from that session's recorded results.Imported from ivall/xcl. Originally posted by throny on 2026-11-30T19:42:35Z.
Measuring this in the world now: head
a92f307d(release), RTX 4080, four alternating 600 s runs of the same save and inputs,XCL_WAVE_LOCAL=1vs unset in the same build, presents/s after 240 s and a picture check (3×3 brightness grid as agreed on #505). Results here when done (about 1.5 h, after a run already on the GPU).AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by throny on 2026-11-30T23:27:21Z.
World result, as announced: head
a92f307d(release, plus our local input-timing patch), RTX 4080 16 GB (621.40), same save and inputs, 600 s each,XCL_SPLIT_INDIRECT_ROUNDS=1. No device removal, crash or hang in any run.XCL_WAVE_LOCAL(A fourth run, unset and cold, never reached the world within its time and is left out.) So the warm pair differs by about 2 %, which is within run-to-run noise at this frame rate: no measurable gain here, and no harm. The first run with the switch logged 212 wave-local lines, so the form was taken. The last frames of 339 and 340 are the same scene but at different instants, one somewhat darker; with one frame per run I can't say whether the form changes the picture. A GPU-time profile (#1766) of the wave64 programs is running next, which should say how much of the frame these programs take at all.
AI use: Claude Code (Claude Opus 5.5), runs made and read by a Claude Sonnet 5.5 sub-agent.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:24:43Z.
Triage (#1607) – head
a92f307This PR is stacked on #3040: its first commit (
f197cb2, the wave-local eligibility analysis inrecomp/wave_local.rs) is #3040's head, and only the top commita92f307(routing through emit.rs, mod.rs, pso.rs, kernel.rs, lower_dxil.rs, and the cache identityxcl-wave-local-1) belongs here. That is why it shares about 546 added lines with #3040. It is not a duplicate.#2554 also removes the split-wave64 exchange cost for some compute programs, but it does that by a different mechanism (remap and a null guard) and is not the same change. The
wave_locallowering is not on main. The branch conflicts with main and needs a rebase.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:54:36Z.
Review (head
a92f307, diff read, not a merge-check; stacked on #3040, conflicts with main inkernel.rs,mod.rs,pso.rs):Its own part is +521 / -30: about +402 in
wave_local.rs(tests andenabled()) and +119 / -30 of runtime. WithXCL_WAVE_LOCAL=1, each half of an eligible wave64 group runs as its own hardware wave32 ([WaveSize(32)]).numthreads, v0 andSV_GroupThreadIDare unchanged, the upper ballot word is zero, and nothing is exchanged between halves.The evidence covers the wrong backend. Compute goes through direct DXIL by default (
kernel.rsrouting(None)gives(true, true)). The retail differential (wave_local.rs~1208-1295) checked only the HLSL form, while the direct form, the one the=1title runs used (pso.rs~1275), was checked on three synthetic shaders.Cache identity has gaps in both directions.
"xcl-wave-local-1"(pso.rs~373, ~664), butanalyzedepends onlane_masks.rs, which is only inPER_LANE_SOURCES. A change there leaves stale cached translations.wave_local.rsis inTRANSLATOR_SOURCES(build.rs~19), so any edit to it, mostly tests, wipes every user's cache even with the switch off.An id of its own, as per-lane has, fixes both.
No measured benefit. The 60 s smoke runs are capped (1707 vs 1703 frames), throny's 600 s world run is 2.10 vs 2.06 presents/s (noise), and the timing harness (~1033) has no posted numbers.
retail_wave_local_bench(~1301) asserts nothing and callsdxc::compile(...).unwrap()without a skip, so it panics without DXC. The retail differential and bench (~190 lines) could go to a test-only PR, or the bench could go.After the rebase, the suite and both smoke runs need redoing.
Fine: off by default, with the cache identity unchanged when off. A rejected shader falls back to the split form, and a GPU test covers that. The GPU tests call
skip_test, and native wave64 isn't affected.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-12-01T14:27:12Z.
Closing: world testing showed no measurable speedup over main, and the branch now has significant conflicts and rework needed.
Pull request closed