D3D12-SHADER-1D-WAVE-BASE-NO-TICKET: skip entry ticket barrier and LDS atomic for 1-D groups #2685
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2685"
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 ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-30T02:34:21Z.
Claimed in #2570 as
D3D12-SHADER-1D-WAVE-BASE-NO-TICKET(#issuecomment-7267081456).What and why
Addresses the open shader-performance item in
d3d12/docs/findings.md:In
d3d12/crates/leonida-shader/src/emit/lower.rs, every 1-D wave64/console-lanes compute shader (including multi-wave paired shaders, whose host group shape is always[32 * waves, 1, 1]) previously allocated an LDS counter dword and emitted an entrygroup_sync+atomicrmw addunless its LDS was already full (>= 8192dwords).Because 1-D host groups already assign each host wave a consecutive run of
flattenedThreadIdInGroupvalues:[32 * waves, 1, 1]): sethalves = Some(NO_COUNTER)and computebase = (waveReadLaneFirst(flat_id) & !31) << 1inconsole_thread().cs.threads[1] == 1 && cs.threads[2] == 1): usehalves = Some(NO_COUNTER)/ skipticket, using the existing flat-IDconsole_thread()path (also settingflags::WAVE_OPS).Verification (Red -> Green)
Hardware / OS: native Windows 11 Pro (
10.0.26200) + AMD Radeon RX 7900 XTX (gfx1100, driver32.0.32029.2010), pinned toolchainrustc 1.98.1.one_d_wave64_group_skips_entry_ticket_barrier_and_keeps_thread_idson[128, 1, 1]emitted2group barriers in halves mode (entry ticket +v_mbcntexchange) and1in paired mode (entry ticket).main40e7fe69d):1barrier (entry ticket eliminated); paired mode drops to0barriers; DXIL validated; GPU dispatch verified all 128 console thread IDs[1..=128]exact.cargo test -p leonida-shader --lib wave64_tests -- --test-threads=4—31 passed; 0 failed(3.81s, including all 2D/3D group tests).cargo test -p leonida-shader --lib paired_tests -- --test-threads=4—16 passed; 0 failed(7.56s).python -I scripts/check_no_game_data.pyon both touched files — PASS.AI-assisted: Antigravity (Gemini 4 Neon)
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T02:39:31Z.
Checked by OreoFR on macOS 27.2.1, Apple M5, Rust 1.98.1,
cargo test -p leonida-shader, main182d0c174, PR head15478c939. MEASURED, partial:emit/wave64_tests.rsfrom this PR: 224 / 2; main + this PR: 224 / 2. No regression in the crate's host-independent tests.mod wave64_testsis#[cfg(all(test, windows))](emit/mod.rs120-121), so neither the red nor the green of this PR's own test is covered on macOS. It needs a Windowscargo test(anddxil.dll/ a 32-lane GPU for the validated and dispatched parts).AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T07:09:37Z.
Windows numbers for the part I could not run on macOS, measured by mooneyes-agent (MoonEyes's agent) and relayed here with their OK: Windows 11,
d3d12/rust-toolchain.toml, CPU only, main1d22590b9+ this PR (head15478c939, merge without commit). MEASURED:cargo test -p leonida-shader: main 370 ok, main + this PR 371 ok, 0 failed, 4 ignored. Thecfg(windows)test this PR adds compiles and passes.lower.rs).AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T16:05:45Z.
Independent check on Windows (not the author), at
903e3731e.cargo test --locked -p leonida-shader --lib: 386 passed, 0 failed, 4 ignored in 328 s.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, Rust 1.98.1 pinned.
The skipped ticket/barrier path is covered by the crate's own emit tests; I did not independently measure the performance change on a GPU.
AI-assisted: yes (opencode).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T16:48:30Z.
Hardware readback on RTX 4070 SUPER and Radeon 610M
MEASURED. Tested
903e3731eagainstmain08e42a516(merge tree6f2354b8e) with the PR'sone_d_wave64_group_skips_entry_ticket_barrier_and_keeps_thread_idsfixture. The baseline uses the same fixture with its original expected barrier counts. The local fixture requires both hardware PSOs and both dispatches to complete. Rust 1.98.1 targeting MSVC x64, Wine 11.22 and VKD3D-Proton 3.2.0. The RTX 4070 SUPER used NVIDIA 620.73.04 and the Radeon 610M used RADV 26.3.1.On each GPU and in all three runs per tree, emitted group barriers went from 2 to 1 in halves mode and 1 to 0 in paired mode. Both modes returned the exact 128 words
1..128on both trees.I also locally merged #2685 and #2688 (
2ef9796f0), resolving the test-file overlap by keeping both tests (tree7246c4c48). Both exact fixtures then passed three times per GPU. The 1-D fixture still returned1..128with 1/0 barriers. The loop-exchange fixture returned952with each bank setting, with 2 barriers for single banking and 1 for double buffering.Scope: synthetic hardware dispatch and readback under Wine. Separate Microsoft SDK DXIL validation and gameplay measurements are outside these runs. AI-assisted: Codex (GPT-6.2 Sol).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T18:24:33Z.
RUN · VERIFY-2685-RTX4060 · by MoonEyes (another person than the author) on head
903e3731e, together with #2684 (bb68c6e19), #2685 (903e3731e) and #2757 (fe7c76d3b) merged intomain99167bcaf. Windows 11 Pro 26300, RTX 4060 8 GB,-SeriesS -FrameGen 2, diag build.cargo test -p leonida-shader --locked: 392 passed, 0 failed.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T18:28:08Z.
Merging. Head
903e3731emerges cleanly withmain8c8ab1783and does not force a rebase of #2566. Two runs in the game (RTX 4060, the second 425 s steady, no device loss) with #2684, #2685 and #2757 together; cargo test 392 passed; checked by other people too. The shaders are translated again at the first start. Merged by MoonEyes.AI-assisted (Claude Code).