Repository navigation
Wave64 VS / PS on 32-lane GPUs: the lanes 32..63 they read (NVIDIA) - #133
Merged
Merged
Conversation
On a GPU with 32-lane waves only (NVIDIA) the driver runs a console wave64 VS / PS in waves of 32: a console wave whose lanes 32..63 are not populated. Those lanes exist on the console (inactive) and hold what v_writelane or whole-wave code put there; here they do not exist, and WaveReadLaneAt of a lane >= 32 reads lane & 31. The 749 programs wave_hazards flagged in the retail pack (748 PS, 1 VS): - 1 082 reads in 436 programs: whole-wave reductions (identity into the lanes outside the mask, DPP8 xor 1/2/4, row_mirror, v_permlanex16, v_readlane 32 for the upper half; min_u32 / max_u32 / or_b32). Right only because lane 32 reads lane 0 and those ops are idempotent. - 355 reads in 353 programs: waterfall reads, v_readlane v, s_ff1(mask & EXEC) - a lane < 32. Right. - 200 reads in 11 programs: SGPR spill slots in lanes 32..47. Wrong: the v_writelane is lost, the read gets another slot. upper_lanes.rs follows what the console's lanes 32..63 hold through the program (forward pass: EXEC's upper word through the SGPRs as 0 / all ones / anything; per VGPR lane unwritten / a constant / a spill slot / unknown, evaluating whole-wave moves, selects, integer min / max / logic / add and their DPP forms). With split_wave64 a wave64 VS / PS reads a lane >= 32 that holds a constant as the constant, and a spill slot from a scalar shadow its v_writelanes also write, when WaveGetLaneCount() < 64. Spill slots < 32 come from their shadows at any wave size: a lane a partial wave did not launch loses its slot (287 PS spill to lanes < 32). Only programs with such a read get the form (613 of the pack; DXC compiles all). Without split_wave64 the HLSL of all 26 698 programs is unchanged, and so is the 32-lane form of the other modes (digests compared with main, retail_wave64_graphics_lane_forms). wave_hazards now reports only reads the pass cannot follow: none in the pack. GPU tests on an RTX 5070 Ti: gpu_wave64_ps_whole_wave_reductions (the pack's reduction as min and as a sum, and the waterfall read, per hardware wave against a console wave of the same lanes), gpu_wave64_ps_spill_slots (full target and a 6-pixel triangle), gpu_wave64_vs_spill_slots_and_identity (3 vertices). With the old form all three fail there. Not exact yet, on every GPU: whole-wave code in a partial wave reads lanes the PC never launched. On the 5070 Ti they read 0, so a min reduction gives 0 in a partial pixel wave (325 programs have one); max / or are right. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pipeline hook compiled console VS / PS with console_to_dxil (split_wave64 false), so on a GPU with 32-lane waves the upper_lanes form never reached a title: only the tests saw it. VS / PS of a graphics pipeline and the PS of a two-pass (MS / GS) pipeline now pass wave32_only(device), as compute and the geometry stages already did. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Found in review, none of them reached in the retail pack: - v_swaprel_b32 writes v[src0 + m0] and v[dst + m0]: any VGPR, as v_movrel*. - An SDWA v_cmpx writes EXEC only; it was taken as writing VCC (with EXEC's zero upper word), so a stale all-ones VCC read as a lane mask. - An operation on a lane nothing wrote is not "unwritten" when a constant decides it (0 & x, -1 | x, min / max with their extreme); x ^ x may be 0 – unknown. Unit tests for each; they fail without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ivall
added a commit
that referenced
this pull request
Nov 23, 2026
Collaborator
|
Merged - thanks, a very clean one. Checked on Windows 11 with an RX 9070 (RDNA4, 64-lane waves):
On the partial-wave min reduction: recognising the whole reduction and emitting |
mastrr9
added a commit
to mastrr9/xcl
that referenced
this pull request
Nov 24, 2026
CreateCommittedResource (xcl-dev#127) and CreatePlacedResourceX (xcl-dev#133) of the newer device layout take a D3D12_BARRIER_LAYOUT for the initial state, which layout_state() turns into a legacy resource state. It knew layouts 0 to 10 only, so the DIRECT_QUEUE_* and COMPUTE_QUEUE_* layouts (18 to 29) and SHADING_RATE_SOURCE (11) all became COMMON: a texture made in DIRECT_QUEUE_SHADER_RESOURCE or COMPUTE_QUEUE_UNORDERED_ACCESS started in COMMON on the PC while the title treats it as already in that layout. Assisted-by: Claude Code (Claude Opus 5.5)
IvyNotFound
pushed a commit
to IvyNotFound/xcl
that referenced
this pull request
Nov 25, 2026
…rceBarrier Console command list slot xcl-dev#146 is ID3D12GraphicsCommandList7::Barrier(NumBarrierGroups, pBarrierGroups) on both older and newer layouts; previously it emitted only a wildcard UAV barrier, dropping every texture layout transition. - Parse D3D12_BARRIER_GROUP (GLOBAL, TEXTURE, BUFFER) safely with readable() checks; unparseable calls fall back to the legacy global UAV barrier. - Map D3D12_BARRIER_LAYOUT 0..=31 including 0x1F (DIRECT_QUEUE_GENERIC_READ_COMPUTE_QUEUE_ACCESSIBLE) and fall back to access bits for console-only layouts > 0x1F; align device xcl-dev#127/xcl-dev#133 initial layout states with texture-vs-buffer awareness. - Track whole-resource states across xcl-dev#127/xcl-dev#133 creation, legacy xcl-dev#26, and enhanced xcl-dev#146 (cleared on res_release) for UNDEFINED Before layouts, forward emitted transitions to title_textures::note_transitions, emit wildcard aliasing barriers for UNDEFINED placed textures, keep non-UAV textures out of UNORDERED_ACCESS, and skip states disallowed on compute/copy lists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last open NVIDIA gap from HANDOFF / #42: wave64 VS / PS on GPUs with 32-lane waves only.
Problem
On NVIDIA the driver runs a console wave64 VS / PS in waves of 32: a console wave whose lanes 32..63 aren't populated. On the console those lanes exist (inactive) and hold whatever
v_writelaneor whole-wave code put there. Here they don't exist, andWaveReadLaneAtof a lane ≥ 32 reads lane & 31.wave_hazardsflagged 749 programs of the retail pack.What those programs do (748 PS, 1 VS)
v_permlanex16,v_readlane 32; min_u32 / max_u32 / or_b32)v_readlane v, s_ff1(mask & exec)v_writelanewas lost, the read returned slot lane & 31ds_bpermuteChange
gpu/recomp/upper_lanes.rs, a forward pass. It follows EXEC's upper word (0 / all ones / anything) through the SGPRs, and what each VGPR's lanes 32..63 hold:split_wave64, whenWaveGetLaneCount() < 64):v_writelanes also write.split_wave64(AMD and other 64-lane GPUs) the HLSL of all 26 698 programs is unchanged. The 32-lane form of the other modes is unchanged too;retail_wave64_graphics_lane_formscompares the digests.hle/d3d12x/real.rs): the pipeline hook compiled VS / PS withconsole_to_dxil(split_wave64false), so on NVIDIA the split form never reached a title. VS / PS, and the PS of two-pass (MS / GS) pipelines, now passwave32_only(device)like compute and the geometry stages.wave_hazards: now reports only the reads the pass can't follow; there are none in the pack.xcl shaders --recompprints the resolved reads by kind.Tests (RTX 5070 Ti, 32-lane waves)
gpu_wave64_ps_whole_wave_reductions: the pack's reduction as min and as a sum, plus the waterfall read, per hardware wave against a console wave of the same lanes.gpu_wave64_ps_spill_slots: full target and a 6-pixel triangle.gpu_wave64_vs_spill_slots_and_identity: 3 vertices.upper_laneshas 9, includingv_swaprel, SDWAv_cmpxand absorbing constants found in review; they fail without the fix.cargo test --workspace --releasewithXCL_SAMPLE_RPF: 560 passed, 0 failed, 2no wave64skips as onmain.retail_wave64_graphics_lane_census/_formsrun on the retail pack.main, 60 fps.Not exact yet (documented in docs/wave64-on-wave32.md)
WaveActiveMin/Max/BitOr. That would change the HLSL AMD gets, so it isn't part of this PR; your call.Once, during a full test run with another heavy session on the machine, the lib test binary died with an access violation in the
hle::d3d12xdescriptor-heap tests. It didn't come back in 35 further runs (25 of that module alone, 10 of the whole lib).🤖 Generated with Claude Code