shader-compiler: native [WaveSize(64)] compute pipelines are refused on wave32-only GPUs, with no recorded reason #151

Open
opened 2026-11-26 06:34:43 +00:00 by github-bot · 2 comments
Owner

@⁠postblink on GitHub · 2026-11-25 08:28 UTC · original

Summary

When a translated compute program needs a ballot, a vote or a 64-lane reduction, and the portable single-wave path doesn't apply, the emitter requires a native 64-lane wave:

  • tools/shader-compiler/src/hlsl.rs:1583 sets required_wave_size to 64 for requires_ballot or a vote.
  • hlsl.rs:1629-1639 lets the portable path drop that requirement only for [64,1,1] (or straight DPP8) groups with !requires_ballot, plus about 25 other exclusions.
  • hlsl.rs:9205 emits [WaveSize(64)].

Every current NVIDIA GPU reports a wave range of [32, 32]. On those GPUs vkd3d-proton refuses these pipelines after DXIL compilation, logging Required WaveSize range [64, 64], but supported range is [32, 32] and returning E_INVALIDARG. vkd3d-proton allows only the opposite case, wave32 on a wave64 host (libs/vkd3d/device.c:10876-10891 at 2576c0b4).

Neither the prep nor the runtime compares a translation's required wave size with the host's WaveLaneCountMin/Max: there is no OPTIONS1 query in runtime/ or project_tuxbox/. So the translation is cached as a success, no .reason is written, and tools/rank_pipeline_failures.py files the failure under "driver or runtime rejected it", alongside unrelated refusals.

In two ProjectScarlett runs on an RTX 5080, one at 97b8ad3 and one at 0a8d2ee, vkd3d-proton logged that message for 37 compute pipelines each time. Run 5's runtime cache held 82 translations that require WaveSize=64. All of them use WaveReadLaneAt and WaveGetLaneIndex, and 48 use WaveActiveBallot. Their group sizes range from (4,4,4) to (1024,1,1). These are aggregate counts only.

Synthetic repro

This needs no game data. It uses the existing independent compute guest (tools/reference/independent-shaders/compute.cpp) with stock Proton Experimental's vkd3d-proton, and runs two shaders in order:

// control, cs_6_0
RWBuffer<uint> output : register(u0);
[numthreads(64, 1, 1)]
void main(uint3 gtid : SV_GroupThreadID) { output[gtid.x] = WaveGetLaneCount(); }

// native64, cs_6_6
RWBuffer<uint> output : register(u0);
[WaveSize(64)]
[numthreads(64, 1, 1)]
void main(uint3 gtid : SV_GroupThreadID) {
    output[gtid.x] = WaveGetLaneCount() | (WaveActiveCountBits(true) << 8) | (WaveGetLaneIndex() << 16);
}
Adapter Control lane count native64
RTX 5080 10de:2c02, NVIDIA 620.73.04 32 CreateComputePipelineState returns 0x80070057
Radeon 610M 1002:13c0, RADV Mesa 26.3.1 64 created; all 64 lanes read back 64 | 64<<8 | lane<<16

Vulkan reports the same ranges: minSubgroupSize/maxSubgroupSize is 32/32 on the RTX 5080 and 32/64 on RADV.

hlsl/wave_sum.rs:932-935 already builds a translated program of this class: the [128,1,1] variant asserts required_wave_size == Some(64) and [WaveSize(64)] in the HLSL.

Possible directions

  1. Make the failure visible (small). Query D3D12_FEATURE_D3D12_OPTIONS1 once per device. When a translation requires a wave size outside [WaveLaneCountMin, WaveLaneCountMax], skip the driver compile and record a reason such as host lacks wave64, so the rank tool counts these on their own. This would also save a pointless driver compile per pipeline.
  2. Make it run (larger). Extend the portable lowering to ballots and votes, so that a 64-lane mask is assembled in group-shared memory across both host waves. This would need the same participation and convergence proofs as the existing portable reductions, and must not put unbounded group barriers inside lane-dependent control flow.

I'm happy to send (1) as a PR with a synthetic test, if that direction suits you.

Environment

CachyOS (kernel 7.3.6), RTX 5080 (NVIDIA 620.73.04), Radeon 610M (RADV, Mesa 26.3.1), Proton Experimental 11.0-20261112, TuxBox 0a8d2ee.

Prepared with an AI agent (Claude); the GPU results above were run and checked on the hardware listed.

**@⁠postblink** on GitHub · 2026-11-25 08:28 UTC · [original](https://github.com/brcly/TuxBox/issues/151) ## Summary When a translated compute program needs a ballot, a vote or a 64-lane reduction, and the portable single-wave path doesn't apply, the emitter requires a native 64-lane wave: - `tools/shader-compiler/src/hlsl.rs:1583` sets `required_wave_size` to 64 for `requires_ballot` or a vote. - `hlsl.rs:1629-1639` lets the portable path drop that requirement only for `[64,1,1]` (or straight DPP8) groups with `!requires_ballot`, plus about 25 other exclusions. - `hlsl.rs:9205` emits `[WaveSize(64)]`. Every current NVIDIA GPU reports a wave range of `[32, 32]`. On those GPUs vkd3d-proton refuses these pipelines after DXIL compilation, logging `Required WaveSize range [64, 64], but supported range is [32, 32]` and returning `E_INVALIDARG`. vkd3d-proton allows only the opposite case, wave32 on a wave64 host (`libs/vkd3d/device.c:10876-10891` at `2576c0b4`). Neither the prep nor the runtime compares a translation's required wave size with the host's `WaveLaneCountMin/Max`: there is no `OPTIONS1` query in `runtime/` or `project_tuxbox/`. So the translation is cached as a success, no `.reason` is written, and `tools/rank_pipeline_failures.py` files the failure under "driver or runtime rejected it", alongside unrelated refusals. In two ProjectScarlett runs on an RTX 5080, one at `97b8ad3` and one at `0a8d2ee`, vkd3d-proton logged that message for 37 compute pipelines each time. Run 5's runtime cache held 82 translations that require `WaveSize=64`. All of them use `WaveReadLaneAt` and `WaveGetLaneIndex`, and 48 use `WaveActiveBallot`. Their group sizes range from `(4,4,4)` to `(1024,1,1)`. These are aggregate counts only. ## Synthetic repro This needs no game data. It uses the existing independent compute guest (`tools/reference/independent-shaders/compute.cpp`) with stock Proton Experimental's vkd3d-proton, and runs two shaders in order: ```hlsl // control, cs_6_0 RWBuffer<uint> output : register(u0); [numthreads(64, 1, 1)] void main(uint3 gtid : SV_GroupThreadID) { output[gtid.x] = WaveGetLaneCount(); } // native64, cs_6_6 RWBuffer<uint> output : register(u0); [WaveSize(64)] [numthreads(64, 1, 1)] void main(uint3 gtid : SV_GroupThreadID) { output[gtid.x] = WaveGetLaneCount() | (WaveActiveCountBits(true) << 8) | (WaveGetLaneIndex() << 16); } ``` | Adapter | Control lane count | `native64` | |---|---|---| | RTX 5080 `10de:2c02`, NVIDIA 620.73.04 | 32 | `CreateComputePipelineState` returns `0x80070057` | | Radeon 610M `1002:13c0`, RADV Mesa 26.3.1 | 64 | created; all 64 lanes read back `64 \| 64<<8 \| lane<<16` | Vulkan reports the same ranges: `minSubgroupSize`/`maxSubgroupSize` is 32/32 on the RTX 5080 and 32/64 on RADV. `hlsl/wave_sum.rs:932-935` already builds a translated program of this class: the `[128,1,1]` variant asserts `required_wave_size == Some(64)` and `[WaveSize(64)]` in the HLSL. ## Possible directions 1. **Make the failure visible (small).** Query `D3D12_FEATURE_D3D12_OPTIONS1` once per device. When a translation requires a wave size outside `[WaveLaneCountMin, WaveLaneCountMax]`, skip the driver compile and record a reason such as `host lacks wave64`, so the rank tool counts these on their own. This would also save a pointless driver compile per pipeline. 2. **Make it run (larger).** Extend the portable lowering to ballots and votes, so that a 64-lane mask is assembled in group-shared memory across both host waves. This would need the same participation and convergence proofs as the existing portable reductions, and must not put unbounded group barriers inside lane-dependent control flow. I'm happy to send (1) as a PR with a synthetic test, if that direction suits you. ## Environment CachyOS (kernel 7.3.6), RTX 5080 (NVIDIA 620.73.04), Radeon 610M (RADV, Mesa 26.3.1), Proton Experimental 11.0-20261112, TuxBox `0a8d2ee`. Prepared with an AI agent (Claude); the GPU results above were run and checked on the hardware listed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:34:43 +00:00
Author
Owner

@⁠NathansDomainSolutions on GitHub · 2026-11-25 08:30 UTC · original

Dude I finna fix this I got claude aimed at this Bitch like the deathstar aha

**@⁠NathansDomainSolutions** on GitHub · 2026-11-25 08:30 UTC · [original](https://github.com/brcly/TuxBox/issues/151#issuecomment-7157119407) Dude I finna fix this I got claude aimed at this Bitch like the deathstar aha
Author
Owner

@⁠tsunderejay on GitHub · 2026-11-25 21:15 UTC · original

Current RTX 3050 boot log confirms this is active: 64 distinct log-capped host lacks wave64 refusals and 65 distinct entries in the pipeline-failure TSV. CPU-only retranslation shows all 65 emit [WaveSize(64)]: 29 wave64 DPP reductions, 38 tb_count_lanes elections, 2 both. PR #197 does not reduce these because it excludes tb_count_lanes and leaves Some(64) unchanged.

**@⁠tsunderejay** on GitHub · 2026-11-25 21:15 UTC · [original](https://github.com/brcly/TuxBox/issues/151#issuecomment-7174830308) Current RTX 3050 boot log confirms this is active: 64 distinct log-capped `host lacks wave64` refusals and 65 distinct entries in the pipeline-failure TSV. CPU-only retranslation shows all 65 emit [WaveSize(64)]: 29 wave64 DPP reductions, 38 tb_count_lanes elections, 2 both. PR #197 does not reduce these because it excludes tb_count_lanes and leaves Some(64) unchanged.
This discussion has been locked. Commenting is limited to contributors.
No description provided.