GPU: refuse wave64 mesh and compute programs on hosts without 64-lane waves (rebase of #578) #1922

Open
github-bot wants to merge 5 commits from github-bot/gh-1922 into main AGit
Owner

@⁠slatefield on GitHub · 2026-11-25 01:01 UTC · original
slatefield:up-578-rebase → main · +295 −5 · 3 files · 5 commits · open

Rebase of #578 onto current main (4118f33). The original work is wbkepler's, all five commits are kept with their author and message unchanged; only conflict resolution sits inside them, so the history is the same change, brought up to date. If #578 updates first, take that one instead.

Why it is worth merging now: on hosts whose waves are narrower than 64 (every NVIDIA D3D12 GPU reports WaveLaneCountMin = Max = 32), console wave64 mesh and unsized wave64 compute programs currently reach a pipeline and hang the GPU, which ends the run with DXGI_ERROR_DEVICE_HUNG. This checks the emitted DXIL PSV0 wave range against the host's D3D12_OPTIONS1 range in HostPipeline::new and refuses the programs that cannot run, so their draws and dispatches are dropped with a named reason instead of taking the device down. It also allows wave64 compute that was deliberately lowered to WaveSize(32) (the #233 class) to run on a 32-lane host.

What was done for the rebase: nothing of the PR is in main yet (wave_lanes, WaveLaneCount, the PSV0 bounds: none of them appear), so the whole 300 added lines were ported. Seven conflict hunks over three files, all because main grew around the PR: host.rs keeps heap_atomics64() and takes the wave-lane query beside it; pipeline.rs builds the wave64 cache inside main's newer Shader::new/translated shape; pipeline/host.rs merges main's own test module with the PR's three tests into one module. The one line not carried verbatim is a test-module use that use super::*; makes redundant.

Checked here: Windows-target clippy --all-targets with and without --all-features, clean for victory-gpu and for victory with diagnostics; native tests for the crates that build on Linux all pass (shader 144, formats 38, game 15, core 13, pipeline 7); cargo xtask policy 182 files ok. The PR's three tests need victory-gpu on Windows; I also ran their bodies against the real victory-shader parser through an off-tree harness and they pass.

Not checked, needs a Windows GPU: the three tests executing, the refusal wording on a 32-lane host, zero driver E_INVALIDARG wave-lane errors, and a world run that survives where main loses the device. The PR's tester notes (in #578) say reference runs from 393 s to 17.5 minutes with one 5060 Ti counter-example removed by an unrelated wave32 submission.

Companion changes: #233 (the other worker on this team) is being rebased in parallel; the PSV0 rule here is what lets its lowered WaveSize(32) compute run. #32 (queue Wait is a no-op on main today) is worth landing near this one, since async submissions assume cross-queue ordering that the synchronous wait currently hides.

**@⁠slatefield** on GitHub · 2026-11-25 01:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/1922) `slatefield:up-578-rebase` → `main` · +295 −5 · 3 files · 5 commits · open Rebase of #578 onto current `main` (`4118f33`). The original work is wbkepler's, all five commits are kept with their author and message unchanged; only conflict resolution sits inside them, so the history is the same change, brought up to date. If #578 updates first, take that one instead. Why it is worth merging now: on hosts whose waves are narrower than 64 (every NVIDIA D3D12 GPU reports WaveLaneCountMin = Max = 32), console wave64 mesh and unsized wave64 compute programs currently reach a pipeline and hang the GPU, which ends the run with `DXGI_ERROR_DEVICE_HUNG`. This checks the emitted DXIL `PSV0` wave range against the host's `D3D12_OPTIONS1` range in `HostPipeline::new` and refuses the programs that cannot run, so their draws and dispatches are dropped with a named reason instead of taking the device down. It also allows wave64 compute that was deliberately lowered to `WaveSize(32)` (the #233 class) to run on a 32-lane host. What was done for the rebase: nothing of the PR is in `main` yet (`wave_lanes`, `WaveLaneCount`, the PSV0 bounds: none of them appear), so the whole 300 added lines were ported. Seven conflict hunks over three files, all because main grew around the PR: `host.rs` keeps `heap_atomics64()` and takes the wave-lane query beside it; `pipeline.rs` builds the `wave64` cache inside main's newer `Shader::new`/`translated` shape; `pipeline/host.rs` merges main's own test module with the PR's three tests into one module. The one line not carried verbatim is a test-module `use` that `use super::*;` makes redundant. Checked here: Windows-target clippy `--all-targets` with and without `--all-features`, clean for `victory-gpu` and for `victory` with diagnostics; native tests for the crates that build on Linux all pass (shader 144, formats 38, game 15, core 13, pipeline 7); `cargo xtask policy` 182 files ok. The PR's three tests need `victory-gpu` on Windows; I also ran their bodies against the real `victory-shader` parser through an off-tree harness and they pass. Not checked, needs a Windows GPU: the three tests executing, the refusal wording on a 32-lane host, zero driver `E_INVALIDARG` wave-lane errors, and a world run that survives where `main` loses the device. The PR's tester notes (in #578) say reference runs from 393 s to 17.5 minutes with one 5060 Ti counter-example removed by an unrelated wave32 submission. Companion changes: #233 (the other worker on this team) is being rebased in parallel; the PSV0 rule here is what lets its lowered `WaveSize(32)` compute run. #32 (queue `Wait` is a no-op on `main` today) is worth landing near this one, since async submissions assume cross-queue ordering that the synchronous wait currently hides.
A console mesh or compute program written for 64-lane waves reads lanes
and wave-wide masks as the 64-lane wave has them. Run as 32-lane waves
(NVIDIA's D3D12 range is 32..32) such programs hang the GPU in the world:
the device is removed as hung after a 2 s timeout, at a dispatch of one
of them, every run. Their pipelines are now refused there, so their draws
and dispatches are dropped instead of hanging the host.

Vertex and pixel programs run per lane and are kept; hosts with 64-lane
waves are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Console wave64 compute programs whose emitted DXIL declares no PSV0
wave-lane range (or an upper bound wider than the host) can still rely
on 64-lane wave semantics and hang 32-lane hosts.

On hosts with max wave lanes < 64, refuse console wave64 compute
programs unless the emitted DXIL PSV0 explicitly bounds the wave size
within the host's supported range (max_lanes <= host_max), preserving
Wave32-split compute translations (PSV0 WaveSize(32)) and 64-lane hosts
while refusing unconstrained wave64 compute like wave64 mesh.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:50 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 05:44 UTC · original

A Windows GPU run, as the description asks. Ran on Windows 11 with an RTX 3070 (Ampere, 32-lane waves, driver 616.56), debug build, at 24a7bc2, cargo test -p victory-gpu --locked: 142 passed, 2 failed, 2 ignored. The PR's three tests pass on this 32-lane host: emitted_wave_size_checked_against_host_range, wave_lanes_refusal_reports_emitted_and_host_ranges and dxil_wave_lanes_reads_psv0_bounds. The 2 failures are #1744's heap-cap failures on main. Same as main on this hardware. Not checked: the driver's E_INVALIDARG count in a title run.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-25 05:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/1922#issuecomment-7154101732) A Windows GPU run, as the description asks. Ran on Windows 11 with an RTX 3070 (Ampere, 32-lane waves, driver 616.56), debug build, at `24a7bc2`, `cargo test -p victory-gpu --locked`: 142 passed, 2 failed, 2 ignored. The PR's three tests pass on this 32-lane host: `emitted_wave_size_checked_against_host_range`, `wave_lanes_refusal_reports_emitted_and_host_ranges` and `dxil_wave_lanes_reads_psv0_bounds`. The 2 failures are #1744's heap-cap failures on `main`. Same as `main` on this hardware. Not checked: the driver's `E_INVALIDARG` count in a title run. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:19 UTC · original

Automated triage for the maintainers.

Proposed close.

Reason: this PR re-packages another contributor's open PR. It is #578 (wbkepler, still open, labelled triage: needs rebase) rebased: the same five commits by the same author, conflicts resolved. Two open PRs for one change split the review. The rebase belongs on #578: its author can take it over, or a maintainer can choose this branch as #578's replacement.

Thanks for doing the rebase work. For whoever picks it up, there's one point on the substance that #578 should settle. On main, Lower (emit/lower.rs, the compute wave_size choice) already declares WaveSize(64) for wave64 compute whose results depend on console lanes, or that is a single wave using LDS. Every other wave64 compute program is deliberately emitted per lane with no wave size. wave_lanes_unsupported refuses all of those unsized wave64 compute programs whenever the host's max is below 64, which on NVIDIA means every one of them. That drops their dispatches wholesale on the most common host. The evidence for it is TDR reports, not a program identified as needing 64 lanes. Narrowing it to the programs that actually hang, or fixing the translation, would be the stronger change.

CI: no check runs on this head.

The PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1922#issuecomment-7156894615) <!-- victory-triage v1 head=24a7bc20b8579eeb46796e13f8c590ee55479886 verdict=proposed-close at=2026-11-25T08:27:30Z --> Automated triage for the maintainers. **Proposed close.** Reason: this PR re-packages another contributor's open PR. It is #578 (wbkepler, still open, labelled `triage: needs rebase`) rebased: the same five commits by the same author, conflicts resolved. Two open PRs for one change split the review. The rebase belongs on #578: its author can take it over, or a maintainer can choose this branch as #578's replacement. Thanks for doing the rebase work. For whoever picks it up, there's one point on the substance that #578 should settle. On `main`, `Lower` (`emit/lower.rs`, the compute `wave_size` choice) already declares `WaveSize(64)` for wave64 compute whose results depend on console lanes, or that is a single wave using LDS. Every other wave64 compute program is deliberately emitted per lane with no wave size. `wave_lanes_unsupported` refuses all of those unsized wave64 compute programs whenever the host's max is below 64, which on NVIDIA means every one of them. That drops their dispatches wholesale on the most common host. The evidence for it is TDR reports, not a program identified as needing 64 lanes. Narrowing it to the programs that actually hang, or fixing the translation, would be the stronger change. CI: no check runs on this head. The PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1922/head:github-bot/gh-1922'
git switch 'github-bot/gh-1922'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1922'
git switch 'github-bot/gh-1922'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1922'
git switch 'github-bot/gh-1922'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1922'
git switch 'main'
git merge --squash 'github-bot/gh-1922'
git switch 'main'
git merge --ff-only 'github-bot/gh-1922'
git switch 'main'
git merge 'github-bot/gh-1922'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1922
No description provided.