Wave64 console programs on GPUs with 32-lane waves only (NVIDIA) #67
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!67
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/67/head"
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?
@Foniass on GitHub · 2026-11-22 23:26 UTC · original
Foniass:wave64-on-wave32→main· +799 −163 · 11 files · 5 commits · merged 2026-11-23 09:59 UTCWave64 console programs on GPUs with 32-lane waves only (NVIDIA)
NVIDIA's D3D12 wave range is 32..32, so
[WaveSize(64)]shaders are rejected: wave64 compute pipelines were refused (their dispatches skipped every frame) and mesh / ES+GS programs ran as independent halves without cross-half operations (#14, #39). (An earlier version of this text guessed that skipped compute work caused Minecraft's flicker on NVIDIA. It doesn't: Minecraft dispatches no compute work at all. The flicker was lost descriptor heaps, fixed in #84.)On such a GPU (same detection,
pso::wave32_only_for_device) each console wave of a wave64 kernel / compute / mesh / ES+GS program now runs as two hardware wave32s of one thread group that exchange through groupshared wherever a value must be whole-wave: masks,v_readlane/v_readfirstlane,ds_bpermute, GLC scalar loads. Both halves hold identical EXEC / VCC / SGPRs and take the same branches, so the recompiler's uniform-branch assumption still holds; DPP / swizzle / permlane stay within a half. One console wave per group meets at group barriers; several meet pairwise through double-buffered slots and arrival counters (bounded: a fault degrades the output, never hangs). Hardware waves take console thread ids as they arrive, because NVIDIA does not form waves from consecutiveSV_GroupIndexfor 3-D groups (8×8×4). Design, hazards, cost:docs/wave64-on-wave32.md.SKIPPED …: no wave64lines: 39 on main, 2 here. The two left:gpu_wave32_program_in_wave64_hardware, which needs 64-lane hardware, and the native-wave64 half ofgpu_geometry_wave32_prefix_count_over_a_mask(its split half runs). The runner checks that both halves end with the same SGPRs;XCL_WAVE64_SPIN=1(counter variant everywhere) passes too. New tests: cross-half ops, four diverging console waves per group in 1-D / 3-D groups, mesh form;bench_split_wave64(ignored).bench_split_wave64, worst case, one mask exchange per 8 instructions): 1.3× with one console wave per group, ~5× with four (waiting waves keep issuing). Real shaders do far more work per mask. Next step: no exchange for masks used only lane by lane (v_cmp+v_cndmask).ds_add_rtntest now allows the old values to wrap around 0xFFFFFFFF.[WaveSize(64)]finding come from #33 (@ElHombreAlex). The protocol here is new (double-buffered slots, arrival counters, barriers where legal). #35's mesh lowering is separate and untouched.The UAV-barrier and
v_fract_f32fixes found during this work are in a separate PR: #68.Not checked: retail shaders (no shader pack on this machine). Minecraft exercises none of it (0 compute dispatches, VS / PS only); with this PR (and #84, #86) its menu runs at 60 fps without flicker and a world loads.
🤖 Generated with Claude Code
precise, and thes_round_modeNOOPs are not free #73@Foniass on GitHub · 2026-11-23 02:39 UTC · original
Overlap with #70, #71 and #72, to make the choice easier for the reviewer.
This PR and @gefydev's #70 / #71 / #72 solve the same problem: wave64 console programs on GPUs with 32-lane waves only (NVIDIA). They conflict (
emit.rs,pso.rs,runner.rs,real.rs,tests.rs), so only one approach can go in as is. Here are both, run on the same machine.How they differ
v_readlane, DPP / swizzle reductions) is still refused, as mesh programs are onmain.Test suite: RTX 5070 Ti, driver 32.0.16.2114. Each column is merged onto current
main(dd713e3), thencargo build --workspace --releaseandcargo test --workspace --release.SKIPPED … no wave64mainec446ecfar_jumps_are_direct_branches,gpu_built_bvh_nodes_match_the_cpu_node_test,gpu_bvh64_intersect_ray_across_memory_windows_and_grazing,gpu_compute_mode_dispatch_abi,gpu_divergence_through_exec,gpu_ds_swizzle_modes,gpu_format_stores_atomics_global_lds,gpu_graphics_vs_ps_draw,gpu_memory_windows_above_4_gib,gpu_mesh_mode_two_passes,gpu_scalar_loop_and_scc,gpu_sdwa_dpp_and_cross_lane,gpu_sparse_vram_descriptors_buffers_and_xmem,gpu_triangle_pair_and_box16_nodes,gpu_tsharp_to_d3d12_resources,gpu_unified_memory_arena.gpu_compute_e2e) fails onmain(0x80070057) and passes both with #67 and with #70 + #72. #78 merges cleanly with either.gpu_ready_wave32→gpu_ready, since that helper comes from #71), then everything passes.Merge options
Both sets build and pass together with the other open PRs that touch the same files:
main+ #84 + #86 + #68 + #67 + #69, andmain+ #84 + #86 + #68 + #70 + #72 + #78 + #69.@Lum7nt on GitHub · 2026-11-23 05:54 UTC · original
Tested this branch locally on Windows — all 19 dedicated unit tests for
mesh_dispatch,mesh_wave, and wave-split recompilation pass cleanly.Key architectural strengths verified:
wave32_only_for_deviceaccurately queriesD3D12_FEATURE_DATA_D3D12_OPTIONS1(WaveLaneCountMax < 64). On AMD/RDNA2 hardware supporting 64-lane waves, shaders compile with native[WaveSize(64)]without any groupshared preamble or runtime overhead.mesh_waveeffectively tracks mask/branch divergence across the CFG, ensuring paired-wave barrier synchronization (GroupMemoryBarrierWithGroupSync) is never placed in wave-divergent execution paths that would hang the GPU on NVIDIA.mainand alongside our MSAA work (#43) with only a trivial 1-line resolution inCargo.toml(from the workspacettpf-viewercleanup).Excellent work solving Wave64 semantics for 32-lane architectures.
@ivall on GitHub · 2026-11-23 09:59 UTC · original
Merged. Checked on an RX 9070 (RDNA4):
cargo test --workspacewith the retail samples (shader pack, console DLLs, texture archive) – natively, and withXCL_SPLIT_WAVE64=1(new inba905cf: forces the split wave64 form on RDNA, which runs both wave sizes, so the NVIDIA path can be checked on AMD). XDefiant (title screen correct, 6 299 translated pipelines, 0 translation errors), Minecraft and Unicorn Overlord run.One thing it found on AMD:
gpu_split_wave64_waves_divergefailed on the native wave64 path for8×8×4. The RX 9070 driver also does not form waves from consecutiveSV_GroupIndexfor 2-D / 3-D groups – it lays them out in 2×2 quads (an 8×8 group's lanes 0, 1, 4, 5, 8, 9 … hold indices 0, 1, 2, 3 …; 1-D groups are in order). So every native 2-D / 3-D console compute translation read the wrong lanes.46a1c3fapplies your arrival-order idea to the native form too (each hardware wave takes the next 32 / 64 console threads, a groupshared counter – the top LDS word while waves take their threads if the program uses all 32 KB); 1-D groups keep their HLSL. The test passes natively and split on AMD now.