shaders: coalesce and inline wave64 x_round exchanges (SHADER-W64-XROUND-BARRIERS) #2119
Closed
robot00f wants to merge 1 commit from
upstream-pr/2119 into main
pull from: upstream-pr/2119
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!2119
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2119"
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 robot00f on 2026-11-25T21:30:38Z.
Claimed in the coordination issue as:
SHADER-W64-XROUND-BARRIERS(https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7172190888; follow-up to https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159151871 and https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159367489)What and why
Coalesces wave-wide Workgroup exchanges and eliminates helper-call / modulo overhead in
Gen.x_round(emulate_inlineintools/rdna2spirv.py) under--wave64-emulateon 32-wide GPUs, while keeping%x_bufbyte-identical ((2*L + 6*W + 7)dwords):Gen._x_round_inline:%x_pre_*_fnOpFunctionCalls (CGSCC inliner cloning across hundreds of callsites increased NVVM compile time by+12%to+21%vs inline).%x_itthrough0..5(lcm(2, 3) = 6, preserving bothit & 1parity andit % 3ring-slot indexing) with zeroOpUMods and omits the two dead scheduler-word resetOpAtomicStores on multi-wave workgroups whenevermini_blocksandtail_blocksare empty.0x948(ImageMemory | WorkgroupMemory | UniformMemory | AcquireRelease) to0x108(WorkgroupMemory | AcquireRelease) whenever"mem"is clean inx_dirty(and inx_order_barrierwhen only"lds"is dirty).Any-vote and first-lane caching (x_vcache,x_flcache,x_vkeys):Anyvotes and first-active-lane indices acrossscc_from_mask,branch_condition,wave_mask,v_readfirstlane_b32, and DPPfi:0within a basic block, and preservesx_genacross internalOpSelectionMergeregions (buffer_load,buffer_store,ds_*,_emit_rfl_run) that do not write%active,%vcc,%vcc_hi, or%sgpr.Anyfrom a cached(lo, hi)mask in 2 ALU ops ((lo | hi) != 0,0barriers,0atomics); whenbranch_conditionreuses a cachedAnyvote whilex_dirtyis non-empty, emits a barex_order_barrier()to preservewave64_emulate_opt.py'ssb_clears_dirtyinvariant.x_vkeysregistration inmask_dstto full-wave masks (n == 2SGPR pairs and fullvccin wave64) so 32-bit half-mask writes never alias 64-bitx_vcacheentries._pending_scc_voteinemulate_inline):scc_from_mask/scc_any_halfvotes until%sccis read/overwritten or a label/merge/barrier/branch/%pcstore occurs.branch_conditionon the same mask (1OpAtomicOr,1barrier), with another 1-bitg_voteon a distinct mask (2 -> 1barrier via 2-wordbits=(p_bit, bit2)), with adata-onlyx_round(v_readlane_b32,ds_bpermute_b32,ds_swizzle_b32,quad_any, DPPfi:1,2 -> 1barrier viadata + bits), or withx_order_barrier(2 -> 1barrier), and drops the vote (0barriers) if%sccis overwritten before being read.v_readfirstlane_b32runs (Gen._emit_rfl_run):firstonce (0barriers if already inx_flcache/x_mcache, else1round on item 0) and transfers up to 64 remaining values per wave from the single running lanewave_lane == firstacross oneOpControlBarrier(4 -> 2or1round barriers for V# scalarization,8 -> 2or1for T# scalarization, piggybacking any pending SCC vote into the same barrier).NVVM ablation note (
#1608): Reproducing the 192-VGPR unfolded binaryif/elseScreenProbesshape on GTX 1050 Ti (sp_tree_156:464.1 KiB,156barriers ->4.168 s;sp_tree_324:898.7 KiB,324barriers ->12.224 s) and stripping all middleOpControlBarrierinstructions (NO_BARS) leavesvkCreateComputePipelinestime unchanged (12.13 s -> 12.22 s, and4.91 s -> 4.88 son 320-barrier loops). Thus the ~11 s baseline on pure unfoldedsaveexectrees is dominated by%pc-guardedOpSelectionMergeblock splitting (SROA/Mem2RegPhi webs across 192 VGPRs) +%x_pre_*_fncloning rather thanOpControlBarrieritself; where cross-lane votes, mask reads, andv_readfirstlane_b32runs coalesce (probe_80/probe_160), cutting exchange blocks in half cuts NVVM compile time by-68.5%to-69.6%(3.2x–3.3xfaster).Tested
Cold
vkCreateComputePipelinesbenchmarks (vk_pipeline_check --jobs 1,__GL_SHADER_DISK_CACHE=0, uniqueOpStringnonce per trial, 3 trials each, exactorigin/mainvs this PR):origin/mainbarriers /OpFunctionCall/OpUModOpFunctionCall/OpUModorigin/mainmedian (3runs)3runs)probe_80(80 live-SCCsaveexec+execz+ 4xreadfirstlane+readlaneblocks)641/640/5(555.0 KiB)321/0/0(554.8 KiB)6.062 s([6.369, 6.062, 6.030])1.907 s([1.679, 2.144, 1.907])-68.5%(3.18x)probe_160(160 probe/waterfall blocks)1,281/1,280/5(1,100.9 KiB)641/0/0(1,101.9 KiB)17.433 s([17.338, 17.710, 17.433])5.296 s([5.310, 5.296, 5.121])-69.6%(3.29x)sp_tree_156(192-VGPR unfolded binaryif/elsetree, dead-SCC votes only)156/339/4(464.1 KiB)156/184/0(529.8 KiB)4.168 s([4.168, 3.750, 4.587])3.649 s([3.789, 3.635, 3.649])-12.5%sp_tree_324(192-VGPR unfolded binaryif/elsetree, dead-SCC votes only)324/699/4(898.7 KiB)324/376/0(1,036.5 KiB)12.224 s([14.261, 12.181, 12.224])11.479 s([11.853, 11.479, 11.279])-6.1%GPU execution (
LEONIDA_W64_EMULATE=1,subgroup 32..32):vk_compute_test cs_w64x_xround_coalesce.spv 1 dump: 3/3 runs0 mismatches,out[0..7] = 147 308 1832 444 625 1335 2379 332.cs_dpp_w64, all 20cs_w64x_*,cs_w64x_partial,cs_w64x_partial_scmp,cs_wave64_ballot, andcs_wavemask) translate, passspirv-val, and match expected outputs before (23/23) and after (24/24).CPU semantic, translator, and repository checks:
python -I tests/semantic/test_wave64_xround_barriers.py(9/9, 40/64/128-thread forward & reverse workgroup interpreter +spirv-val)python -I tests/semantic/test_wave64_emulate_opt.py(33/33),test_wave64_emulate_barriers.py(13/13),test_loop_ballot_barrier.py(15/15),test_cs_shared_memory_limit.py(15/15),test_w64x_scalar_load_order.py(5/5)python -I tests/test_shader_checks.py(88/88),test_ci_registration.py(16/16),test_text_write_line_endings.py(3/3),test_docs_*.py,scripts/check_no_game_data.py(exit 0).GPUs tested: NVIDIA GeForce GTX 1050 Ti (Pascal, 4 GB), driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045
AI-assisted: yes (Antigravity, Gemini 4 Carbon)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by quartz-heron-58 on 2026-11-26T01:13:28Z.
Whole-corpus check of
72d722aon a retail boot, Windows 11, RTX 4080 16 GB (NVIDIA 621.24), 32 GB RAM. Tools were this head merged with #2102's head8481605(only docs/design.md conflicted; the three semantic test files test_wave64_xround_barriers, test_wave64_emulate_opt and test_loop_ballot_barrier pass on the merge: 9, 34, 15).--wave64-emulate, 16 shards each: same program counts as with #2102 alone, every shard's stderr empty. The compute library was not retranslated, and I did not run spirv-val over the output.b0f3d39plus several open runtime PRs and local changes, so not a clean main): both get through the loading screens as before. One was stopped by my free-RAM guard at 237 s with no device loss. The other lost the device at 277 s, reported from a draw command with timeout-type fault addresses only, which is the same stop I had in 1 of 3 runs with #2102 alone.So on this card: no translation regression seen across the corpus, and no visible change to the world-start device loss, which this PR does not claim to address. Not measured: frame time or barrier counts before and after.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-26T08:26:00Z.
Verdict: not ready to merge yet (1 blocker, 1 request). The PR is still a draft, so this is early feedback.
test_cached_branch_condition_survives_buffer_store_and_orders_dirty_memoryfails attests/semantic/test_wave64_xround_barriers.py:244(OpAtomicOr3 != 2). It passes on the PR head alone.translate()/barriers_under_control_flow,tools/rdna2spirv.py:18124and:18881-18893on main, merged with #2098 after this PR's base). In my sample 157 emulated programs now take that fallback and 66 keep the inline form. I did not check whetherprobe_80/probe_160take it. Could you re-run the table on current main?Setup: PR head
72d722a11(unchanged when rechecked just before writing this). The PR's merge base is1bf5eeafd. Main isa73a57e13, 137 commits later, and 3 of the touched files changed in that range (tools/rdna2spirv.py,docs/design.md,tests/semantic/test_wave64_emulate_opt.py). Local merge of main into the PR:9a64951cc, no conflicts (auto-merged in those 3 files). Windows 11 (10.0.26300), Python 3.14.0.llvm-mc --versionreports "Ubuntu LLVM version 21.1.8" (runs through WSL). All tests ran on the CPU SPIR-V interpreter. No GPU was involved, and nothing ran in the game.Tests
test_wave64_emulate_opt33/33,test_wave64_emulate_barriers13/13,test_loop_ballot_barrier15/15,test_w64x_scalar_load_order5/5,test_cs_shared_memory_limit15/15.test_wave64_xround_barriersdoes not exist on main.test_wave64_xround_barriers9/9.test_wave64_xround_barriers8/9. The other five files give the same results as on main.OpControlBarrierunder control flow.%pcguard. So main's check sends the whole program toemulated wave64 rounds:emulate_planisNone, 2 barriers, 3OpAtomicOr.OpAtomicOr.control_flow == "emulated wave64 rounds",barriers_under_control_flow(spv)false).test_lds_src2. On this machinetest_lds_src2also fails on main, becausellvm-mcruns through WSL and cannot see the Windows temp folder (open PR #1733 addresses it). It does not count against this PR.scripts/check_no_game_data.pyon the 7 changed files: exit 0.Mutation (the PR's tests against main's
tools/)test_wave64_xround_barriers: 8 of 9 tests fail, 11 failures counting subtests::153(OpFunctionCallcount):189(OpUModcount):215(barrier count):244(OpAtomicOrcount):302(barrier count, all 4 subtests):331(count of0x108barriers):361(barrier count):425(barrier count)test_half_mask_write_does_not_alias_full_wave_vote_cachepasses on main.test_wave64_emulate_opt: 1 failure, at:1544(assertNotIn("%x_pre_", spv)).Corpus (1-in-9 sample,
--wave64-emulate, translator only)s_sethalt).spirv-val: all 1,629 valid with main, and all 1,629 valid with the merge.OpAtomicOr34,423 -> 26,921, totalOpUMod51,880 -> 44,378.OpFunctionCallwent down in 57;OpUModwent up in 11 programs (largest 7 -> 36);OpAtomicOrwent up in 27 programs (largest 1 -> 53). These are inline copies of what the removed helper functions held once. The PR body's ownsp_treerows show the same growth (+14% and +15%).Safety
Line numbers are for
tools/rdna2spirv.pyat the PR head.0x108is used only when no("mem", *)access is dirty. Buffer, global, flat, image load/store/atomic and scalar loads all count as"mem"(x_memory_order). An emptyx_dirtyinx_order_barrierkeeps0x948. I found no case where needed memory ordering is lost.%x_itcycle is used only when_x_has_schedulers()is false (:5690). Modules with mini or tail schedulers keepOpUMod(:5666,:5712), soit % 3andit & 1stay in step with the scheduler loops.emit,:474):%pcstore or read of%scc;OpStore %sccin the same straight run, which is correct because the old value is dead.v_readfirstlane(_emit_rfl_run,:5826):it & 1parity;x_gen. The savedx_genis restored after an internal selection only when that selection wrote no%active,%vcc,%vcc_hior SGPR.Suggestions
:244for main's fallback, as described under Tests.OpUModand atomics into every round instead of removing them.scc_from_maskcache now also runs in rounds mode (if self.emulate:). No PR test covers that path in rounds mode. In my sampleOpAtomicOrwent down in 1,109 of the 1,237 rounds-mode programs.Not covered by this review
tests/test_translate.py, no hand-written GPU tests (includingcs_w64x_xround_coalesce).OpUModand atomics in a structured program does not say whether it runs slower at run time or compiles slower.AI-assisted: yes (Claude Code, Claude Opus 5.5, ran the tests and wrote this; a second agent checked this text)
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-26T09:06:46Z.
RTX 3090 / 621.40: test_wave64_xround_barriers.py is 9/9 on this head (
72d722a11) and 8/9 merged onto current maina73a57e13(test_cached_branch_condition_survives_buffer_store_and_orders_dirty_memory, line 244, OpAtomicOr 3 != 2). probe_80/probe_160 take main's round fallback (2 barriers on both sides). Cold vk_pipeline_check --jobs 1, 3-trial median compile: probe_80 1.070s [1.07, 0.96, 1.09] -> 0.770s [0.77, 0.71, 0.77]; probe_160 3.050s [3.05, 3.13, 2.68] -> 2.020s [2.01, 2.13, 2.02].Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T13:55:14Z.
Tested
72d722a11merged ontomaina73a57e13(it merges cleanly), on an Apple M3 (macOS 26.5.1). I ran the fullscripts/run_gpu_tests.pyin auto mode, with test programs built frommain. I tested the merge rather than the branch alone because a branch from before9f98dcc61failsps_texagainstmain'svk_bindless_test(the tagged descriptor table), which says nothing about this change.mainmain+ this PRLEONIDA_W64_EMULATE=1The new
cs_w64x_xround_coalescepasses underLEONIDA_W64_EMULATE=1on MoltenVK (147 308 1832 444 625 1335 2379 332) and skips natively (no 64-wide subgroup), as expected on a Mac. No new failure. The ones left are the same on both sides:cs_fma_fused(#1724),ps_ssharp(#1774) andcs_imgatomic_ext(#1518) on MoltenVK; KosmicKrisp's(NAN)-constant fixtures (#2229) andcs_imgatomic_extthere.AI-assisted (Claude Code). No game data.
Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-27T11:00:37Z.
Checked
353d0387merged into main2859d0c9, by Claude Code (AI-assisted) on my behalf. Linux, Mesa lavapipe.One test fails after the merge:
tests/semantic/test_bitcast_round_trip.py::test_helpers_return_the_source,AttributeError: 'Gen' object has no attribute '_pending_scc_vote'. The test builds aGenwithGen.__new__(no
__init__), andemit()now readsself._pending_scc_vote. Declaring the two new fields as class defaultsmakes it pass (checked locally), e.g. right under
class Gen::The rest of
tests/semanticpasses (501 files, 6,383 tests). Fuzzers on the merge, all equal to main on the sameseeds:
crosslane_fuzz.py --wave 64 --modes emulate --dpp --ext --seed 205 --programs 150: 143 match, 5 mismatch,2 hyp_only, the same programs as on main (all masks read as data, #1397/#1043);
lds_fuzz.py --wave 64 --emulate150/150;valu_fuzz.py --family mem --wave 64 --emulate120/120;valu_fuzz.py --family f16 --wave 64 --emulate100/100;cf_diff.py --wave 64300/300.Not run: a hardware GPU, native wave32, the corpus.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T15:54:40Z.
Confirming @kawaii-shakal's finding on a Mac (macOS 26.5.1, Python 3.15.2), with this PR's
tools/rdna2spirv.pyonmainec91d695c:tests/semantic/test_bitcast_round_trip.pyfails ('Gen' object has no attribute '_pending_scc_vote') and passes on plainmain._pending_scc_vote = None,_flushing_scc_vote = Falseunderclass Gen:), it passes. So does the whole translator suite: 503 files, 6396 tests, 0 failed.main(ec91d695c) indocs/design.md. At2859d0c9bit merged cleanly.My earlier comment here covered the GPU suite only, which is unchanged. This adds the translator suite.
MEASURED, 1 run each. AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-27T18:20:12Z.
Re-checked head
353d038merged with current main (c0201a80), Linux, CPU only:test_bitcast_round_trip.py::test_helpers_return_the_sourcestill fails (AttributeError: 'Gen' object has no attribute '_pending_scc_vote'): the head sets the two fields only in__init__(tools/rdna2spirv.py:551-552),and the test builds
Genwith__new__. The class-level defaults from my earlier comment (and Tauwni's) arestill the fix. It is the only failure of the full translator suite on the merge: 503 files, 6,396 tests, 1 file
failed (main alone: 502 files, 0 failed).
test_cached_branch_condition_survives_buffer_store_and_orders_dirty_memorypasses on the merge, andtest_wave64_xround_barriers.py+test_wave64_emulate_opt.pypass in full (45 passed; the one failure is thebitcast test above).
c0201a80and into today's43a9d562(the commits between themtouch only CI and standalone tests, nothing of the translator), so the
docs/design.mdconflict is gone.AI-assisted (Claude Code); I ran the tests and checked the results.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-27T21:52:56Z.
Rebased onto current
maininc4b709a1and added class-level defaults_pending_scc_vote = Noneand_flushing_scc_vote = FalseonGen(thanks @kawaii-shakal and @Tauwni): bothtests/semantic/test_bitcast_round_trip.pyandtests/semantic/test_wave64_xround_barriers.pynow pass underpython -I.Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-27T22:18:24Z.
Tested on a 32-wide GPU with emulated wave64: GeForce GTX 1050 Ti 4 GB (Pascal), NVIDIA 582.66, Windows 10 19045 (profile S). Head
c4b709a14merged ontomain34e33d3dd(clean), test programs built frommain, llvm-mc 21.1.8, Vulkan SDK 1.4.363.MEASURED:
tests/semantic/test_wave64_xround_barriers.py(merged tree): 9/9 OK.scripts/run_gpu_tests.pywithLEONIDA_W64_EMULATE=1: main 236/269 passed, 31 skipped -> this PR 237/270, 31 skipped; the newcs_w64x_xround_coalescePASSES.LEONIDA_W64_EMULATE=1 LEONIDA_MESH_COMPUTE=1: main 242/269 -> this PR 243/270, 25 skipped.cs_imgatomic_ext,cs_texture_uav), unrelated to this PR.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-28T03:38:33Z.
CORRECTION to my comment above: the 8/9 was measured on main
a73a57e13and is out of date. RTX 3090 / 621.40,c4b709a14on main431ceba4f: test_wave64_xround_barriers.py 9/9, test_bitcast_round_trip.py 3/3, test_wave64_emulate_opt.py 34/34. GPU suite with validation: only cs_imgatomic_ext and cs_texture_uav fail, same as on main; no validation errors. The probe_80/probe_160 timings were also taken ona73a57e13and need re-measuring.Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:15:32Z.
Review: COMMENTED
Strong independent GPU verification on GTX 1050 Ti and RTX 3090 (including the class-level
_pending_scc_vote/_flushing_scc_votefix). This PR is still a draft and currently conflicts withmain; please rebase onto currentmain, get all CI checks green, and mark ready for review.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:21:00Z.
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.
(AI-assisted triage.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T13:00:02Z.
Review: CHANGES_REQUESTED
Now ready for review, requesting changes before merge:
CONFLICTING/DIRTY): conflicts withmainacrossdocs/design.md,runtime/test/shaders/check.py,scripts/run_gpu_tests.py, andtools/rdna2spirv.py.check,windows,linux-gpu-tools, etc.). The wave64x_roundexchange coalescing is well-verified on GPU; please rebase onto currentmainand get fresh green CI.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:42:09Z.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed