Shaders: translate for the host's wave sizes #223
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!223
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-223"
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?
@r4tedx on GitHub · 2026-11-24 01:35 UTC · original
r4tedx:shader/host-wave-sizes→main· +390 −35 · 20 files · 7 commits · openCurrent head
714b818, integrated withmainatffe310e. The emitter and its tests pass the host wave target through upstream’s structured descriptor tracking. Local Windows verification:cargo test --workspace --locked(346 passed, 6 ignored) and all-target, all-feature Clippy with warnings denied. No title run for this update. AI-assisted (Codex).Rebased onto
main8e79c80on 2026-11-24 (twice that day; upstream merged about 55 PRs and added CI). New upstream tests callemitand buildlower::Partsdirectly, so they now passTarget::ANY. Nothing else changed. Head1dfb859, wase0865d2before the rebases. CI's two clippy commands (-D warnings, with and without--all-features) are clean at this head. CI's first run here failed in one test of this PR,what_translates_for_the_host_creates_a_pipeline: the runner's default device is Windows' software renderer, whose waves are 4 lanes, so not even the wave32 program translates for it, and the test only expected that of the wave64 one. The test now accepts a host without waves of the program's size; reproduced and checked here withVICTORY_WARP=1.What
A compute shader that depends on the lane layout declares the console's wave size. On a host whose D3D12 wave range does not contain it (NVIDIA reports 32..32), a console wave64 program of that kind was refused at pipeline creation. Its dispatches were then dropped, and the log said only "host pipeline refused".
emit::Target { lanes_min, lanes_max }(D3D12 options 1,WaveLaneCountMin/Max) goes into translation:emit::translate_for(container, target), andemit::emittakes it too (translatekeeps its old meaning asTarget::ANY). A shader whose declared wave size the host does not run stops at translation, with the reason (console wave64 lanes on a host without 64-lane waves, or the one-wave-LDS case).victory-gpu:Host::target()reads the range once, logs it, and warns when there are no 64-lane waves. The shader cache keys entries by the build and the range, so a translation for one host's waves is never served to another.victory translate --host-lanes 32-32(or32-64, or a single size) counts these shaders without a GPU.--pipelinestranslates for the local device's range.shader::host::Hostused by tests and tools getstarget().This changes nothing for hosts that run 64-lane waves.
#208 also reads options 1, into
HostCaps(supports_wave64,wave_lane_count_max) for logging. It does not feed translation or the cache key. Whichever merges second,Host::target()can become a thin wrapper over those caps. #189, #192 and #54 change what the translator emits on such hosts. This PR only adds the plumbing they can key their choice on (and the cache key they need to stay correct when one machine has GPUs of both kinds), plus an explicit refusal where nothing handles the program yet.#235 (the non-Windows build) adds a stub
Hostfor hosts other than Windows that has notargetmethod, andtranslate.rscalls it here. The two merge without a textual conflict and then the app crate does not build on macOS or Linux (found by a reviewer on #439). Whichever lands second addstarget()returningTarget::ANYto that stub; I will do it on my side if #235 goes in first.Not verified
I did not count how many of the title's programs the refusal hits;
--host-lanes 32-32is there to do that. A tester has since counted it on their own copy: 321 compute programs declareWaveSize(64)onmainand are refused by a 32-lane driver.#54 has since gained a commit (
4083d25) that also queries the device's wave range and puts it in the shader cache key, through its ownWaveRangetype. The two overlap there; I have not merged them together, and whichever lands second has to adopt the other's type.Tested
Windows 11, an NVIDIA RTX 5070 (32..32), synthetic only:
emit::tests: a hand-assembled wave64 compute program withv_readlanetranslates forTarget::ANYand for 32..64, and stops with the reason for 32..32. The same code as wave32 translates for both. A program reading no other lanes translates for any range.ANYis refused by it (what this replaces).shader_cache: keys differ between 32..32 and 32..64 and between builds.cargo test --workspace: 268 passed, 0 failed, 4 ignored.cargo clippy --workspace --all-targets: nothing new.cargo xtask policy: ok.AI-assisted; no game assets were used.
🤖 Generated with Claude Code
940d32f) into the host wave sizes branch 02b955ffc9@ghost on GitHub · 2026-11-24 02:06 UTC · original
AMD run on a host that offers both wave sizes (RDNA4, 32–64): head
e0865d2(already onmaind2a4bae) passes. AMD Radeon RX 9060 XT, driver 32.0.32029.2010, Windows 11 Pro 26200, Rust 1.98.1, debug.cargo test --workspace: 268 passed, 0 failed, 4 ignored.cargo test -p victory-shader wave: 5 passed, includingconsole_lanes_translate_only_for_hosts_with_that_wave_sizeandprograms_reading_no_other_lanes_translate_for_any_wave_size.AI use
63bcca4) into the host wave sizes branch 91aa056741@r4tedx on GitHub · 2026-11-24 08:35 UTC · original
Rebased onto
main2e4e280, force-pushed with lease: head isb2adc37, wase0865d2.Upstream merged 32 PRs. This PR still merged without a textual conflict, but two new upstream tests in
emit/mod.rscallemitdirectly, and this PR adds the wave-range argument to it, so the merged tree did not build its tests. Those two calls now passTarget::ANY; nothing else changed.cargo check --workspace --all-targetspasses at this commit, and the three PRs stacked on it (#233, #320, #439) are rebased onto it.The title was not used in these tests. AI-assisted (Claude Code).
@MD5Visual on GitHub · 2026-11-24 11:12 UTC · original
RTX 3090 / 24 GB result for this branch, standalone on main (not the integration tree), to see what the wave-size naming does on its own.
Build
main ffe310e+ this PR's diff (1dfb859), diagnostics, DRED on, no debug layer,VICTORY_SHADER_LOOP_LIMIT=32, same manual menu route. Windows 11 Pro 26200, Ryzen 7 5800X3D, 64 GB, RTX 3090 24 GB, driver 32.0.16.1088 (610.88), title 1.0.2.1b99f876b.... (Local-only patch: the host device is created on an adapter picked by name, becauseD3D12CreateDevice(None)takes the display adapter here. Nothing else is patched.)main ffe310ehost pipeline refused0x80070057shader does not translateconsole wave64 lanes on a host without 64-lane wavesand 43a wave64 group sharing LDS without barriers on a host without 64-lane waves0x887A0006at 145 s0x887A0006at 124 sms=8905 lists=26ms=9069 lists=12no host textureSo the naming works exactly as intended - every refusal becomes a translation stop with a reason, and the 112 program hashes are the concrete list behind #293 - but on its own it does not stop the hang, and the draws still drop (668-1577 of 1191-2790 per frame), just for a different stated reason.
What the 112 are: all compute. The 43 LDS ones are the wave64 programs that need their whole wave to share LDS without a barrier, i.e. the case the two-halves emulation cannot do.
v_permlanex16_b32,the first half of an interpolationanda cross-lane operation outside computeappear once each among the rest.The fatal submission this time is mixed compute and mesh, 16 compute plus a long list of mesh/pixel pairs, e.g.
compute 9146291b38ea9ce1,mesh 0a2ea81ca59d6510/pixel 19acd330dacc8f32,mesh 1205b8f2c7f6b1ad/pixel 7333603e0e1b4e90. The DRED breadcrumb on its dispatches has the shape I keep seeing on this card:9146291b38ea9ce1 u4=0xf3f280 [heap 499604: Unordered(...)] u5=0x20 [heap 32: null]- the same program bound once into a real slot and once at index 32 of a 32-slot heap, which reads null.Frames, finally (this PR is the first tree I captured;
VICTORY_CAPTUREwas pointed at a folder and power-of-two frames are saved at half size): frames 1-128 fully black (boot), 256-1024 the Rockstar logo on#21212C(renders correctly), 2048 uniform#2C2C2C- the world load phase is a single flat fill, no geometry, no letterbox bars.@r4tedx on GitHub · 2026-11-24 11:14 UTC · original
@MD5Visual, thanks for isolating #223 on the RTX 3090. The host pipeline refusals fell from 124 to zero, and the translator reported 112 compute wave-size stops plus 43 LDS stops. Those counts come from separate runs, so I wouldn’t match individual refusals across them without the hashes. Both runs still hit
DEVICE_HUNG. The null UAV breadcrumb is worth keeping with the capture, but it doesn’t identify which operation caused the removal. The flat world-load frame gives the later stack a concrete comparison point.AI-assisted (Codex).
@Ilokaxt on GitHub · 2026-11-24 12:16 UTC · original
Tested on an RTX 3070 Ti Laptop (wave lanes 32..32, NVIDIA driver 610.88, Windows 11 build 26300), merged onto
mainffe310e, plus a local fix that creates the device on the high-performance adapter. Scripted run into the world, as in my note on #439.main, 344 with this PRExecuteIndirect.mainalone hangs the same way, at 199 s. That looks like #778 (wave64 mesh programs), not this PR's compute work.@juniorteixeiradev on GitHub · 2026-11-24 13:08 UTC · original
Tested on NVIDIA (wave32-only host) at head
714b818.Result
cargo test --workspace --locked: 346 passed, 0 failed, 6 ignored. Onmainatffe310e, the same machine gives 342 passed, 0 failed, 6 ignored, so the 4 extra tests are this PR's and nothing regressed.what_translates_for_the_host_creates_a_pipelinewith--nocaptureprintshost waves 32-32. So on this card the wave32 program translated and got a pipeline, and the wave64 one stopped at translation. The test also confirmed that the oldTarget::ANYtranslation of the wave64 program is still refused by the driver, which is the case this PR replaces.console_lanes_translate_only_for_hosts_with_that_wave_size,programs_reading_no_other_lanes_translate_for_any_wave_sizeandshader_cache::tests::keys_tell_hosts_wave_sizes_apart.Setup
rust-toolchain.toml, debug buildNot tested
AI use
@465d6a0eac on GitHub · 2026-11-24 16:29 UTC · original · edited 2026-11-24 17:20 UTC
Thank you for this, @r4tedx! Many pull requests here are still waiting to be merged, so I've ported this one to 465d6a0eac/AgentRecompVI, a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/29. It went in together with #233, which builds on it. You're credited as the author there. This pull request stays the original.
Test results
cargo clippy(both variants) andcargo test --workspacepass (358 passed, 0 failed);--host-lanes 32-32works and reports the host's 32-32 wave range.victory translateover the 26,148 shader programs in my own copy of the game with--host-lanes 32-32: 1,221 of 2,582 compute programs emit DXIL for a 32-lane host.@Ryanarcx2 on GitHub · 2026-11-24 20:54 UTC · original
Tested head
714b818on an RTX 5070 Ti (wave32 only, driver 32.0.16.1742), Windows 11, diag build withVICTORY_D3D12_DEBUG=1. Same route as amain(ffe310e) baseline: boot, account picker, settings, first story cutscene.ffe310e714b818CreateComputeShader: wants wave lane count 64, device max 32console wave64 lanes on a host without 64-lane waves is not supporteda wave64 group sharing LDS without barriers on a host without 64-lane waves is not supportedDXGI_ERROR_DEVICE_HUNG(TDR)DXGI_ERROR_DEVICE_HUNG(TDR), 30 lists in the last submissionThe pipeline-creation refusals are gone. On this title, though, about 120 wave64 programs are now refused at translation instead, so their work is still dropped (counts are of log lines, not unique shaders). Menus are unaffected. The cutscene still hangs the device at about the same point, so on this card wave64 alone does not appear to explain the hang. Other common translation failures in the same run:
a select on an untracked mask(84),a lane mask holding lanes elsewhere read as data(60),a descriptor read only as data(58).Happy to run another build.
@Marvisak on GitHub · 2026-11-25 00:21 UTC · original · edited 2026-11-26 07:21 UTC
Automated triage for the maintainers.
Merge candidate (as before the rebase). Reviewed head
fbfd3c6, which mergesmain63bcca4and adds two test-call fixes (draw.rsview-mark test uses..Options::default(),pipeline/placed_uav_tests.rspassesemit::Target::ANY).What I checked:
emit::TargetandOptions::targetincrates/victory-shader/src/emit/mod.rs; the refusal at the start ofLower::run(emit/lower.rs) readswave_size, whichLower::newalready sets, so it fires before any lowering;Host::target(victory-gpu/src/host.rs) reads D3D12 options 1 once and falls back toANY;shader_cache::host_keykeys entries by build and wave range, and the warm-up uses the samehost_target()as a run. Hosts with 64-lane waves see no change. The testers' NVIDIA runs show driver refusals replaced by named translation refusals, which is the stated intent; it does not by itself make more programs run.CI: passing.
Generated by Claude Code
@r4tedx on GitHub · 2026-11-25 07:08 UTC · original
Updated for the needs-rebase triage:
main(940d32f) is merged in, head02b955f(a merge commit, not a rebase: testers quote this stack's hashes). It merges cleanly intomain.Conflict resolutions worth reading:
main's newemit::Options { view_marks }/emit_with/translate_with: the host's wave range is now a field ofOptions(target, defaultTarget::ANY), somain's signatures stay andemit(.., target)fills it in.main's(result, cached)pair and write marks; this PR's key ishost_key.translate --cache's warm path now keys entries by the run's own host range (shader_cache::host_target(), the same function the runtime uses), so warm entries are not keyedANYand then missed on a 32-lane host. Thanks to @slatefield for pointing that path out on #1929.--cacheand--host-lanesnow conflict instead of one being ignored.emit/Partscall site ofmain's passesTarget::ANY.Both CI clippy commands are clean. Tests ran on the software renderer only at this level (the machine's GPUs are on a hold today), plus the CPU-only crates.
AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-25 10:21 UTC · original
Fixed in
0d20521: thetracing::warn!literal inHost::target(crates/victory-gpu/src/host.rs) had the next line's indentation inside it; it now reads as one sentence. No other change; clippy (default and all features) is clean on this head. The sharedCheckFeatureSupportquery is left as it is. AI-assisted.@r4tedx on GitHub · 2026-11-26 05:07 UTC · original
Merged current
main(63bcca4) in, with no rebase or force-push. Head now91aa056, and it merges cleanly withmain. The PRs above (#233,#320,#439) are merged from this head in turn. Details, conflict notes and the per-level checks are on #439 (policy ok, clippy clean, the WARP shader suite has onlymain's own 4 failures).Synthetic tests only; no title data used.
AI-assisted
@r4tedx on GitHub · 2026-11-26 05:14 UTC · original
Correction to my last comment: CI's clippy failed on the previous head. Main's view-mark draw test (
crates/victory-gpu/src/draw.rs) buildsemit::Options { view_marks: true }by hand, and this stack adds atargetfield toOptions. My local clippy run left out the test targets, so I missed it. New head0f6dec04has the fix: the test fills the remaining fields with..Options::default(). Nothing else changed.Verified on #223
0f6dec04and #4398a320556:cargo clippy --workspace --all-targets --locked -- -D warningsis clean, andcargo xtask policypasses. No title data was used.AI-assisted
@r4tedx on GitHub · 2026-11-26 05:18 UTC · original
Second follow-up: CI's diagnostics clippy (
--all-features) found one more call from main that this stack'sTargetargument breaks. Incrates/victory-gpu/src/pipeline/placed_uav_tests.rs:77,emit::emitwas called with six arguments. New headfbfd3c67has the fix: the call passesemit::Target::ANY, the same default the other callers use.Verified on #223
fbfd3c67and #43913be4c2c: both CI clippy commands are clean,cargo clippy --workspace --all-targets --locked -- -D warningsand the same command with--all-features. I didn't run the CIcargo test --workspacestep on this PC, so CI will be the first to run it on this head. No title data was used.AI-assisted
@fuzeofficlal on GitHub · 2026-11-26 12:39 UTC · original · approved these changes
Reviewed and verified at head
fbfd3c67againstorigin/main(63bcca43) on Windows 11 across both an NVIDIA RTX 5090 (wave32-only:32-32) and WARP (4-4), withVICTORY_D3D12_DEBUG=1and Windows SDKdxil.dll:Host::target()(crates/victory-gpu/src/host.rs:1074-1105) andemit::host::Host::target()(crates/victory-shader/src/emit/host.rs:201-221) queryD3D12_FEATURE_D3D12_OPTIONS1once (WaveOps && WaveLaneCountMin > 0), fall back cleanly toTarget::ANY(4..=128), and warn clearly when 64-lane waves are absent.shader_cache::host_key(crates/victory-gpu/src/shader_cache.rs:84-114) hashesbuild || target.key()(lanes_min || lanes_max) with BLAKE3 so shader cache entries are isolated per host wave range;victory translate --cache(apps/victory/src/translate.rs:360, 392) uses the samehost_target()and conflicts with--host-lanes(apps/victory/src/main.rs:108), preventing mismatched warm-up entries.s.wave_sizeis only set inLower::new(crates/victory-shader/src/emit/lower.rs:606) beforeLower::run(lower.rs:1298-1314) checks!self.x.target.runs(n), so every compute program declaring an unsupported wave size (cross-lane operations or single-wave barrierless LDS) stops cleanly at translation with a concrete reason instead of emitting DXIL refused at pipeline creation. Programs without lane-layout dependence and hosts supporting 64-lane waves are unaffected.crates/victory-shader/src/emit/lower.rsis 521,592 bytes (2,696 bytes below the 512 KiB policy limit).git merge-treeagainstorigin/main(63bcca43);cargo xtask policy(191 files ok);cargo clippy --workspace --all-targets --locked -- -D warningsclean with both default features and--all-features.dxil.dll:emit::tests::what_translates_for_the_host_creates_a_pipelineprintshost waves 32-32and passes (wave32 creates a pipeline, wave64 stops at translation, and theTarget::ANYwave64 fallback is confirmed refused by the driver); all 3 newemit::testswave tests pass;crosslane_tests+waterfall_tests+valu_tests+bvh_tests+semantics_tests93 passed, 0 failed, 1 ignored;apps/victory14 unit + 4 integration passed;victory-gpu(--features diagnostics,VICTORY_D3D12_DEBUG=1)shader_cache::tests+draw::tests25/25 passed.VICTORY_WARP=1,VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1):emit::tests::what_translates_for_the_host_creates_a_pipelineprintshost waves 4-4and passes;victory-gpushader_cache::tests+draw::tests25/25 passed.LGTM.
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.