Skip to content

[Review import] Shader: support 32-lane host wave execution (upstream #3301) - #3

Draft
maok625 wants to merge 1 commit into
mainfrom
review/upstream-pr-3301-wave32
Draft

maok625 wants to merge 1 commit into
mainfrom
review/upstream-pr-3301-wave32

Conversation

@maok625

@maok625 maok625 commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Imported from Marvisak#3301 for review on this fork.

Upstream source head: fbbca42873beafa6f4f4953b7e67b7b6b8181e80 (from AdvaitPalve11/VIctory). This commit is directly based on the current fork baseline 63bcca43c6a00a758510398fa43096ce7e4f7df0; no commits from main need to be replayed.

This is a draft review import only. Please inspect the implementation and tests, resolve any interactions with other review branches, and run the Windows/D3D12 test suite before merging. No local build or hardware validation has been performed by this import.

BLOCKER — do not merge as-is

This change forces Wave64 programs onto WaveSize(32), but the shader lowering still contains Wave64 lane-mask, ballot, and cross-lane assumptions. Reviewers report possible silent cross-half semantic errors and an unintended behavior change on native-Wave64 AMD adapters. A Windows RTX 5090 DXIL-validator run also reported failures in wave64_permutes_check_exec_within_each_half and wave64_permutes_stay_within_each_32_lane_half because PSV0 and DXIL wave-size metadata disagree. The correct fix needs a real Wave64-on-Wave32 execution strategy (pair/split/widen/fallback) and validation tests, not just changing metadata.

…e shaders

Xbox Series X|S consoles (AMD RDNA 2) frequently run compute shaders in
Wave64 mode (wave64: true). In the host DXIL container emission:
- container::psv set MinimumWaveLaneCount and MaximumWaveLaneCount
  strictly to (64, 64).
- Shader::finish emitted DXIL entry-point tag 11 (kDxilWaveSizeTag)
  with 64.

On PC hardware with 32-lane execution units (NVIDIA GeForce RTX 20/30/40/50
series and Intel Arc), D3D12 CreateComputePipelineState unconditionally
rejects pipelines requiring WaveSize(64) with 0x80070057 (E_INVALIDARG)
because WaveLaneCountMax is 32.

Fix this by:
1. Setting PSV0 runtime info MinimumWaveLaneCount to 32.min(wave_size)
   and MaximumWaveLaneCount to wave_size, exposing the [32, 64] range
   to D3D12 runtime validators.
2. Clamping tag 11 entry-point wave size metadata to 32.min(n) so 32-lane
   hardware adapters accept compute PSOs while preserving valid lane sizing.
3. Clamping wave stride to 32.min(wave_size) when reconstructing flat
   thread IDs in lower::thread_id, ensuring consecutive 32-lane host
   warps (e.g. lanes 32..63 in warp 1) receive non-overlapping, contiguous
   thread IDs (base & !31) + lane.
4. Updating synthetic test annotations for WaveSize(64) execution on
   hardware devices.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants