Repository navigation
Conversation
cd9fe4f to
72d722a
Compare
|
Whole-corpus check of 72d722a on a retail boot, Windows 11, RTX 4080 16 GB (NVIDIA 621.24), 32 GB RAM. Tools were this head merged with #2102's head 8481605 (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).
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). |
|
Verdict: not ready to merge yet (1 blocker, 1 request). The PR is still a draft, so this is early feedback.
Setup: PR head Tests
Mutation (the PR's tests against main's
Corpus (1-in-9 sample,
Safety
Suggestions
Not covered by this review
AI-assisted: yes (Claude Code, Claude Opus 5.5, ran the tests and wrote this; a second agent checked this text) |
|
RTX 3090 / 621.40: test_wave64_xround_barriers.py is 9/9 on this head (72d722a) and 8/9 merged onto current main a73a57e (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]. |
|
Tested
The new AI-assisted (Claude Code). No game data. |
72d722a to
353d038
Compare
|
Checked 353d038 merged into main 2859d0c, by Claude Code (AI-assisted) on my behalf. Linux, Mesa lavapipe. One test fails after the merge: The rest of
Not run: a hardware GPU, native wave32, the corpus. Generated by Claude Code |
|
Confirming @kawaii-shakal's finding on a Mac (macOS 26.5.1, Python 3.15.2), with this PR's
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). |
|
Re-checked head 353d038 merged with current main (c0201a8), Linux, CPU only:
AI-assisted (Claude Code); I ran the tests and checked the results. Generated by Claude Code |
…UND-BARRIERS) Coalesce redundant wave-wide Workgroup exchanges and remove helper-call / modulo overhead in `Gen.x_round` (`emulate_inline` in `tools/rdna2spirv.py`) for `--wave64-emulate` on 32-wide GPUs: 1. Inline division-free `Gen._x_round_inline`: emit inline `x_round` setup directly in `%main` without `%x_pre_*_fn` `OpFunctionCall`s, cycle `%x_it` through `0..5` (`lcm(2, 3) = 6`) with zero `OpUMod`s and omit dead scheduler-word reset `OpAtomicStore`s whenever `mini_blocks`/`tail_blocks` are empty, and narrow barrier semantics from `0x948` to `0x108` (`WorkgroupMemory`) whenever `"mem"` is clean in `x_dirty`. 2. Block-local `Any`-vote and first-lane caching (`x_vcache`, `x_flcache`, `x_vkeys`), preserved across `OpSelectionMerge` regions (`buffer_load`, `buffer_store`, `ds_*`) that do not write `%active`, `%vcc`, or `%sgpr`: share `Any` votes and first-active-lane indices across `scc_from_mask`, `branch_condition`, `wave_mask`, `v_readfirstlane_b32`, and DPP `fi:0` (deriving `Any` from `(lo | hi) != 0` with zero extra atomics, and issuing a bare `x_order_barrier` if memory became dirty before a cached voted branch). 3. Deferred SCC vote coalescing (`_pending_scc_vote` in `emulate_inline`): coalesce live-SCC mask votes into the next 1-bit vote (`s_cbranch_execz`/`vccz`), `data`-only `x_round` (`v_readlane_b32`, `ds_bpermute_b32`, `ds_swizzle_b32`), or `x_order_barrier` (`2 -> 1` barrier), or drop the deferred vote if `%scc` is overwritten unread. 4. Contiguous `v_readfirstlane_b32` batching (`Gen._emit_rfl_run`): once `first` is known, transfer up to 64 remaining values per wave from `wave_lane == first` across one `OpControlBarrier` (`8 -> 2` round barriers uncached, `8 -> 1` when `EXEC` is already cached). Add `tests/semantic/test_wave64_xround_barriers.py` and synthetic GPU shader `runtime/test/shaders/cs_w64x_xround_coalesce.asm`, and document the rules and GTX 1050 Ti measurements in `docs/design.md`. AI-assisted: yes (Antigravity, Gemini 4 Carbon)
353d038 to
c4b709a
Compare
|
Rebased onto current |
|
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 MEASURED:
AI-assisted (Claude Code). |
Claimed in the coordination issue as:
SHADER-W64-XROUND-BARRIERS(#1608 (comment); follow-up to #1608 (comment) and #1608 (comment))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.