GPU: Pre-check wave lane constraints for compute pipelines (fixes #817) #2192
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2194"
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?
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T07:21:59Z.
Fixes #817 (supersedes tracking issue #893; related to #468).
Summary
Note: Opened as a PR per maintainer triage (#893); happy to coordinate with #1922 / #2157 if maintainers prefer one consolidated PR.
Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T07:47:23Z.
For the consolidation question: I combined #1922 (
24a7bc2, runtime) and #2157 (9771cae, offline CLI) on Windows. The merge includes main940d32fand needs no manual resolution (tree884f866b). Seven targeted tests passed: three GPU runtime checks, two shader diagnostic checks, and two CLI checks, including the WARP pipeline test that distinguishes root-signature errors from wave-size refusals.One behavior worth preserving when deciding between implementations: #1922 explicitly tests the unsized console-wave64 fallback on a host with fewer than 64 lanes. Testing the fixed wave size alone would miss that distinction.
Update for
754fe02: the rebase resolved the four conflicts againstmain@940d32f. I compared both parsers and pre-check functions using the same synthetic PSV0 metadata (guest Wave64 compute, simulated 32-lane-only host). Both rejected fixed 64 and allowed fixed 32. The current PSV0 writer emits either a fixed size or the unrestricted pair (0, UINT32_MAX). For the unrestricted pair with a Wave64 guest on this host, #1922 rejected early and #2194 deferred to pipeline creation. A separate synthetic 64–128 interval also distinguished the parsers, but that interval does not come from this writer. These are pre-check results; driver behavior was not measured.AI-assisted; synthetic tests only.
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T07:56:17Z.
Thanks for the comparison data, @Dathinel.
Two quick updates on the branch state:
9d4b8d7were before the rebase ontomain(940d32f). Current head754fe02is cleanly rebased onto940d32fwithmergeable_state = cleanand green CI, and@MichaelSmithAIalso verified754fe02on an RTX 4090 under Wine (wave32 pipeline created, wave64 returned the expected host-width diagnostic).HostShader::required_wave_size(), we only extract a fixed constraint (min != 0 && min == maxfromPSV0), so an unsized shader returnsNoneand is allowed throughunsupported_compute_wave(None, ...). Agreed that#1922's explicit test for the unsized console-wave64 fallback on hosts with< 64lanes is a useful distinction to preserve regardless of which PR pair lands.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:10:10Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.145 passed / 0 failed / 2 ignored. Wave lane constraints pre-checked for compute pipelines (+1 test) — pre-validation of lane constraints; mixed gpu+shader.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T09:23:42Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib wave— 4 passed, 0 failed on RTX 5090 (includingquery_wave_lane_limits_reports_capabilitiesandwave_size_precheck_rejects_both_outside_bounds)cargo clippy -p victory-gpu -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean wave-lane capability query and compute pipeline wave-size pre-check (fixing #817). Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by GiacomoSignorile on 2026-11-25T09:59:41Z.
Test data from an RTX 5070 (12 GB, NVIDIA,
WaveLaneCountMax = 32), Windows, 16 GB RAM, on the vitutu1/victory-perf fork at97c3aa2(based on fxceless/victory-fork). Profile:--console series-s,VICTORY_RENDER_SCALE=0.5,VICTORY_OWN_UPSCALER=1,VICTORY_AMBIENT_STUB=1,VICTORY_SHADOWMASK_STUB=1,VICTORY_RELAY=2,VICTORY_LATE_WAIT=3,VICTORY_WIDE_BACK=1,VICTORY_REBAR=0,VICTORY_CARD_BUFFERS_MB=2048.Four compute pipelines are refused in-game with
E_INVALIDARG (0x80070057):Analysed offline, without running the game: the translated DXIL for all four still carries
WaveSize = 64(dxc -dumpbin), which the 32-lane NVIDIA host refuses. The split / local-wave retries all fall back to wave 64. The main reason given is LDS in a group over 32, with an LDS read and write inside one lane-branch region; three of the four also usev_mbcnt/v_readlane/ a lane mask read as data.I ported this PR's check onto that fork (local commit only). It builds in release mode and the targeted tests pass. The four pipelines are now refused before creation with that reason named, instead of the opaque
0x80070057. They still don't run: that needs split-wave lowering for LDS shared across more than 32 lanes.The same four hashes are refused on the fxceless
a26859fand skornuta/victory-fork9292987builds too.VICTORY_SHADER_LOOP_LIMIT=32didn't change that.Analysis done with Claude Opus 5.5 (claude-opus-5-5) agents; the in-game logs come from real runs.
Imported from Marvisak/VIctory. Originally posted by giacbiologicbomb on 2026-11-25T11:03:15Z.
Test data from an RTX 5070 (12 GB, NVIDIA,
WaveLaneCountMax = 32), Windows, 16 GB RAM, on the vitutu1/victory-perf fork at97c3aa2(based on fxceless/victory-fork). Profile:--console series-s,VICTORY_RENDER_SCALE=0.5,VICTORY_OWN_UPSCALER=1,VICTORY_AMBIENT_STUB=1,VICTORY_SHADOWMASK_STUB=1,VICTORY_RELAY=2,VICTORY_LATE_WAIT=3,VICTORY_WIDE_BACK=1,VICTORY_REBAR=0,VICTORY_CARD_BUFFERS_MB=2048.Four compute pipelines are refused in-game with
E_INVALIDARG (0x80070057):Analysed offline, without running the game: the translated DXIL for all four still carries
WaveSize = 64(dxc -dumpbin), which is incompatible with the reported maximum wave size; this is the leading explanation for the refusal. The split / local-wave retries all fall back to wave 64. The main reason given is LDS in a group over 32, with an LDS read and write inside one lane-branch region; three of the four also usev_mbcnt/v_readlane/ a lane mask read as data.I ported this PR's check onto that fork (local commit only). It builds in release mode and the targeted tests pass. The four pipelines are now refused before creation with that reason named, instead of the opaque
0x80070057. They still don't run: that needs split-wave lowering for LDS shared across more than 32 lanes.The same class of refusals was observed on fxceless
a26859fand skornuta/victory-fork9292987.VICTORY_SHADER_LOOP_LIMIT=32didn't change that.Analysis done with Claude Opus 5.5 (claude-opus-5-5) agents; the in-game logs come from real runs.
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T11:40:54Z.
Thanks for the detailed test data and hardware verification on RTX 5070 @giacbiologic! This confirms the exact intent of #2194: catching the wave size mismatch cleanly before pipeline creation so we don't nuke the D3D12 device with an opaque
0x80070057, while diagnosing precisely why the fallback to wave 64 occurred (LDS across >32 lanes with branch regions / lane mask ops). Those 4 pipelines (�2384a60fda6f2d0, 369cbe906ea72764, 2cc4c197ee29e291, 2da4beb386509b77) are great concrete test targets for subsequent split-wave LDS lowering work.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:41:39Z.
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-gpu/src/host.rsandcrates/victory-shader/src/emit/host.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by DrDarkDK on 2026-11-25T13:34:15Z.
Following up on the unsized-shader point in the triage summary, I ran a standalone native D3D12 probe on an RTX 4070 Ti with driver 621.01 and Windows build 26300.9974. D3D12 reported a wave lane range of 32–32.
I compiled the same lane-independent
cs_6_6shader with noWaveSizeattribute, withWaveSize(32), and withWaveSize(64). With the same root signature, the unsized and fixed-wave32 variants both created a compute pipeline. Fixed wave64 returnedE_INVALIDARG, andGetDeviceRemovedReason()returnedS_OKafterward. Both runs produced the same results.This supports letting unsized shaders reach pipeline creation. The probe used synthetic DXC shaders and covered pipeline creation only.
AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T13:43:01Z.
@DrDarkDK Thanks for the native D3D12 probe on the RTX 4070 Ti (32-32 wave range).
That confirms the driver behavior: unsized shaders cleanly default to the native wave lane width (32) and succeed, whereas fixed wave64 fails with
E_INVALIDARGwithout taking down the device. This aligns with keeping unsized shaders eligible for pipeline creation while refusing explicit 64-lane constraints on 32-lane hardware.Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-26T17:35:08Z.
Rebased cleanly onto
origin/main(63bcca4) resolving the conflicts incrates/victory-gpu/src/host.rsandcrates/victory-shader/src/emit/host.rs:wave_lanes_from_devicequeries with the shared WARP device singleton and multi-threaded test harness (#181), preservingdepth_bounds_supportedand thread serialization.victory-gpuandvictory-shader(query_wave_lane_limits_reports_capabilities,wave_size_precheck_rejects_both_outside_bounds,wave_size_precheck_accepts_boundaries_or_unknown_constraints,required_wave_size_reads_the_emitted_constraintall ok).cargo clippy -p victory-shader -p victory-gpu -- -D warnings) with 0 warnings.cargo xtask policyclean (191 files ok).Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T18:13:46Z.
I checked
f8277a6after the offline refusal-stage change. The live GPU pipeline precheck uses the advertised minimum and maximum, while the offlineHost::compute_pipelineprecheck checks only the maximum.I exercised the offline entry point on verified app-local Agility 1.620.2/WARP 1.0.22. The real device reported 4–128 and created both fixed Wave32 and Wave64 PSOs. With a simulated advertised range of 64–64 on the same WARP device, the old maximum-only gate still creates Wave32. Follow-up
b72e1a3reports the wave constraint before PSO creation. Reciprocal Wave32-only controls and an unsized shader pass. The probe passed three fresh runs, both existing GPU precheck tests passed, and strict GPU/shader Clippy and policy passed. The single-width device ranges in this test are injected.@Xvania7 the patch is directly on your head if you want to take it. Please retain its Git author on cherry-pick, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding it into another commit. AI-assisted with Codex.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T02:02:10Z.
The new Proton report records a fixed WaveSize(64) compute PSO on a host advertising 32–32. This matches the range condition checked here. The log also contains a memory-allocation fallback cluster, so the evidence establishes the PSO refusal and leaves the cause of the process exit open. Proton report
I combined the exact #2194 head
f8277a6, the offline lower-bound fixb72e1a3, and #3633's root-signature diagnostics4982f53in 47c12a8. The merge was clean.I compiled three generated
cs_6_6fixtures with DXC 1.9.2609.5 and passed their actual metadata through the PR's live and offline gate logic. The combined code agreed in all nine cases across ranges 32–32, 64–64 and 4–128. The shader with no fixed width passed every gate. A fixed width outside the advertised range was refused. Withoutb72e1a3, the offline upper-bound-only check still admitted fixed Wave32 on 64–64. This run covered just the metadata and CPU gates. #3633's root-signature diagnostic path is preserved in the merge.Please preserve the Git author if cherry-picking or rebasing, or keep this trailer if folding the changes into another commit.
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.