D3D12-SHADER-DOUBLE-BUFFERED-EXCHANGE: double-buffer wave64 exchange banks to halve loop barriers #2688
Closed
bobcatchris wants to merge 4 commits from
upstream-pr/2688 into main
pull from: upstream-pr/2688
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!2688
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2688"
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:43:22Z.
Claimed in #2570 as
D3D12-SHADER-DOUBLE-BUFFERED-EXCHANGE(#issuecomment-7267219686).What and why
Addresses the open shader-performance item in
d3d12/docs/findings.md:Previously,
exchange_many()ind3d12/crates/leonida-shader/src/emit/lower.rsemitted twogroup_syncbarriers for every exchange inside a cyclic IR block (one after storing into the shared pair, and a second after loading so the next exchange would not overwrite a slow reader).This change allocates a second shared exchange bank (
2 * wavesextra LDS dwords whenexchange_sites() > 0and LDS has room) and threads a per-thread 1-bitbankparity SSA value (i32in{0, 1}) across reachable IR blocks:kstores into bankk & 1, executes onegroup_sync, loads both halves from bankk & 1, and flipsbank ^= 1.k - 1after finishing their reads of bank(k - 2) & 1 == k & 1, storing to bankk & 1is race-free without a post-load barrier.bankphis in shaders with no shared-bank exchanges are eliminated byopt.rs(FOLD | DEAD).LEONIDA_EXCHANGE_SITES=0or LDS has no room for the second bank.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.exchanges_in_a_loop_meet_once_with_double_buffered_banksemitted3barriers both withLEONIDA_EXCHANGE_SITES=24and0(3 vs 3).main40e7fe69d):3barriers to2(1 barrier per loop exchange instead of 2), DXIL validates viadxil.dll, and live GPU dispatch on RX 7900 XTX matches the exact 8-iteration wave OR sum bit-for-bit.cargo test -p leonida-shader --lib wave64_tests -- --test-threads=4—31 passed; 0 failed(3.87s).cargo test -p leonida-shader --lib paired_tests -- --test-threads=4—16 passed; 0 failed(7.30s).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 ecox982745 on 2026-11-30T02:53:08Z.
Independent RTX 4090 exchange verification. Native Windows 11, NVIDIA 616.64, MSVC, Rust 1.98.1, and SDK 26100 DXIL validation.
52e1a0cf2merged cleanly onto182d0c174(tree083796dbb). The exactwave64_testsandpaired_testsfilters passed 31/31 and 16/16 respectively.ab78da371merged cleanly (tree864726660). The same exact filters passed 31/31 and 22/22.Synthetic input only. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T15:57:45Z.
Independent check on Windows (not the author), at
2ef9796f0.cargo test --locked --jobs 8 -p leonida-shader --lib -- --test-threads=8: 386 passed, 0 failed, 4 ignored in 251.6 s.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, Rust 1.98.1 pinned.
The behavioural claims (fewer loop barriers / same exchange results) are covered by the crate's own paired/wave64 tests; I did not measure the performance change on a GPU.
AI-assisted: yes (opencode).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T16:45:52Z.
Test-only merge overlap with #2685
MEASURED. This head (
2ef9796f0) and #2685 (903e3731e) each merge cleanly intomain08e42a516. Combining the two resulting trees withgit merge-tree --write-treeconflicts only ind3d12/crates/leonida-shader/src/emit/wave64_tests.rs. Both patches append a different test at the same location. Keepone_d_wave64_group_skips_entry_ticket_barrier_and_keeps_thread_idsandexchanges_in_a_loop_meet_once_with_double_buffered_banksas separate functions.lower.rsmerges automatically.This checks the merge hunks. The combined shader behavior needs a separate test run. AI-assisted: Codex (GPT-6.2 Sol).
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T17:12:06Z.
Native Windows follow-up to the combined Wine test. I merged
2ef9796f0(#2688) and903e3731e(#2685) with1d4949d58, which includes #2710. The only conflict was the test-file overlap noted above. Keeping both tests gives tree00d85c8d8. No production source was changed during conflict resolution.MSVC Rust 1.98.1 release, Windows 11, NVIDIA 616.64. I made the two fixtures require Windows SDK 26100 DXIL validation, native hardware PSO creation and dispatch. DXGI confirmed the RTX 4090 for every case. Results held in three fresh runs per fixture:
1..128in both modesAll 11 stock
emit::wave::testspassed, including the merged #2710 regression. Synthetic inputs only. AI-assisted with OpenAI Codex (GPT-6.2 Sol).Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-30T18:43:45Z.
Merged main (#2685 landed in wave64_tests.rs); kept both tests, no production change. cargo test -p leonida-shader --release emit:: after the merge: 269 passed, 0 failed, 5 ignored.
AI-assisted: Claude Sonnet 5.5
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T03:25:35Z.
Independent game-run A/B test with a freshly rebuilt shader cache on Windows 10 + NVIDIA RTX 5070 12 GB (driver 621.40) + Ryzen 9 5950X (
MEASURED,PROVISIONAL (n=2 balanced BAAB pairs: B1/A1, A2/B2), Series X dynamic 1080-1440p-NoFrameGen, same save restored before every run,d3d12/target/diagbuilt withdiagnostics,dlss,mimalloc).Verdict:
samein play frame rate on this CPU-bound PC (gpu_wait0.1-0.2 ms),betteron cold NVIDIA PSO compile time, and clean shader/runtime parity (0 translation regressions, 0 runtime errors, 0 device losses).MEASURED, fresh isolated cache dir for #2688):main(a596adfac):25,687shaders translated,202untranslated (133 s); coldwarm --used:3,209pipelines compiled in371 s(0 failures; per-PSO median669.0 ms, p906050.4 ms, p9918343.8 ms, max26496 ms, sum6922 s).#2688(d0a9bb041):25,687shaders translated,202untranslated (133 s); coldwarm --used:3,231pipelines compiled in328 s(0 failures; per-PSO median514.7 ms, p904951.9 ms, p9917508.2 ms, max24996 ms, sum6182 s) -- ~12% faster wall time / ~23% lower median driver PSO compile time with 22 more pipelines.Series X,-NoFrameGen, CPU-bound on RTX 5070):main):51.3 ms(49.1 / 53.5 ms), mean GPU busy68.3%(71.5% / 65.0%),gpu_wait0.1 / 0.2 ms.#2688):52.0 ms(54.4 / 49.6 ms), mean GPU busy69.5%(67.0% / 72.0%),gpu_wait0.1 / 0.2 ms.gpu_wait0.1-0.2 ms), GPU shader frame-time gains are hidden behind CPU preparation (~33-35 ms) and the two arms are within run-to-run spread (~4 ms). A GPU-bound card/resolution is still needed to isolate pure GPU frame-time speedup, while full shader corpus translation, PSO compilation, and play stability on RTX 5070 (621.40) are verified clean.AI-assisted: Antigravity.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:11:34Z.
Review: CHANGES_REQUESTED
Nice barrier reduction for cyclic/shared wave64 exchanges, and the end-of-
lower()bank_inphi wiring handles lateballot_of/wave_anyemissions onself.tail[b]cleanly.One correctness edge case to guard before merging:
d3d12/crates/leonida-shader/src/emit/lower.rs(exchange_many, lines 6018-6060 in the diff): whenself.double_bank.is_some()andirresolves toNone, execution falls back to the single-bank path targeting bank0(store(0); group_sync; load(0); group_sync). That fallback can be reached ifat == self.s.entry(e.g.,ballot_oforwave_anyfor entryEXECwithdef_block == None) after IR block 0 already emitted a double-bank exchange on bank0(which intentionally omits the trailinggroup_sync) and then splitself.s.entry(self.tail[0] != Some(self.s.entry)), e.g., withLEONIDA_EXCHANGE_SITES=1or >24 exchanges before a guarded memory op in block 0. Because the fallback writes bank0immediately after the preceding bank-0load with no intervening barrier, the two halves can race on bank0.Adding
if self.double_bank.is_some() { self.group_sync(at); }before the single-bank fallback loop (or ensuring every fallback underdouble_bankfences first) closes this race cleanly. Please also update the branch so the newd3d12 (windows-latest)CI workflow runs.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T11:59:37Z.
Independent offscreen A/B check of
d0a9bb041on21e6bbf4b. I made the existing eight-iteration exchange test require DXIL validation, PSO creation, and GPU readback in both settings. On the base, exchange sites 0 and 24 both emitted two group barriers. With the PR, they emitted two and one respectively. Both settings returned the expected952on AMD Raphael (RADV 26.3.1) and RTX 4070 SUPER (NVIDIA 620.73.4), under Wine and vkd3d-proton 3.1.0.This covers the single exchange in the checked-in loop fixture. The multi-site case raised in the other review and in-game frame time remain open.
AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T12:42:56Z.
Follow-up with two distinct exchanges per loop iteration on
d0a9bb041merged onto6c7f6b60c. The synthetic fixture runs two cross-half reductions with different inputs in each of eight iterations. I built the same fixture with the base emitter and with the PR emitter and forced host-wave32 lowering. For exchange-site budgets 0 / 1 / 24, the base emitted 4 / 4 / 4 group barriers and the PR emitted 4 / 2 / 2. Each variant passed DXIL validation and returned the expected 1968 from a real dispatch via Wine/vkd3d-proton on AMD RADV and RTX 4070 SUPER. This covers two cyclic exchange sites. The split-entry fallback from the review still needs its own fixture.AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T18:25:46Z.
@aslan2142 Addressed in
7efcddb21(mergedmainfirst, no rebase/force-push, so thed3d12 (windows-latest)CI workflow runs):if self.double_bank.is_some() && !mine.is_empty() { self.group_sync(at); }before the single-bank fallback inexchange_many(lower.rs).double_bank_single_bank_fallback_fences_before_reusing_bank_zeroinwave64_tests.rs(confirmed red without the guard:off=6, on=4; green with it:off=6, on=5).cargo test --locked -p leonida-shader --lib wave64_tests(33 passed, 0 failed) andpython -I scripts/check_no_game_data.py(clean).AI-assisted: Gemini 4 Neon (including an independent read-only reviewer pass).
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-12-02T03:36:27Z.
RTX 3090 / 621.47,
7efcddb21merged onto main393901a5b: wave64_tests is 31 passed on main and 33 on the merge (0 failed), both new double-bank tests ok. paired_tests 22/22 on both. 32-lane hardware cases ran; wave64-only programs still not run, same as main.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:18:29Z.
Closing: this pull request no longer applies to current
main(merge conflict ind3d12/crates/leonida-shader/src/emit/lower.rs), and open pull requests that have fallen out of step withmainare being closed so the list stays workable. If you still want this change, rebase it on currentmainand reopen it (or open a new pull request); it will be looked at again.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T13:05:55Z.
Posted after this pull request was closed for its conflict with
main, for whoever rebases and reopens it: the head measured is7efcddb21.RUN (independent, Windows, RTX 3090): head
7efcddb21merged withgit merge --no-ffontomaind741a9f8f; both sides built the same way (diagnostics,dlss,mimalloc, targetx86_64-pc-windows-msvc). RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).Off the game (
cargo test -p leonida-shader; some of these tests dispatch on the card):main+ this pull request's testsexchanges_in_a_loop_meet_once_with_double_buffered_banksdouble-buffered loop exchange should emit fewer barriers: 2 vs 2double_bank_single_bank_fallback_fences_before_reusing_bank_zeroOn this
mainthe loop case already counts 2 barriers, not the 3 the description quotes, somainhas moved since the base this was written on; the test still fails there because it asks for fewer than the single-bank path gives. The second test is a guard (it passes onmaintoo).In game, Series S settings, standing at the save, 600 s each, measured, nothing else built meanwhile. Whole runs of one build differ from each other by 0.4 to 2 ms of card time a frame on this card, more than the effect sought, so the cost was measured inside each run instead: with
LEONIDA_AB=10,LEONIDA_SKIP_TRY_Askipping, every other 10 s, the three compute programs of this title whose translated code has exchanges inside loops (the picture is wrong while they are skipped), first 60 s after reaching the world left out:mainNo crash, no device loss, and no magenta or purple pixels in the captures at 120 and 300 s in either build.
Verdict for this card: PASS, no regression, no measurable gain. The tests are red then green as described and the merged build runs cleanly; on an NVIDIA card these three programs cost the same with one barrier per exchange as with two. The description's measurements are from an AMD RX 7900 XTX, where barriers may weigh more.
AI-assisted: Claude Code (Claude Opus 5.5)
Pull request closed