Skip to content

CLI: report emitted shader wave sizes in translate - #1462

Open
gurvancampion wants to merge 1 commit into
Marvisak:mainfrom
gurvancampion:topic/translate-wave-size-tally
Open

gurvancampion wants to merge 1 commit into
Marvisak:mainfrom
gurvancampion:topic/translate-wave-size-tally

Conversation

@gurvancampion

Copy link
Copy Markdown
Contributor

Summary

victory translate now reports how many emitted programs are unrestricted or require a fixed wave size. HostShader::wave_size carries the size already declared in DXIL through emission and cache reads. The CLI totals successful emissions across stages and includes each size with --list. The offline tally is available on systems such as the RTX 4090 in #1323, where wave64 compute pipelines are refused.

 victory translate --list
   3 emitted of 3 compute programs; 0 validated, 0 pipelines
+  wave sizes   1 unrestricted, 1 wave32, 1 wave64
+  unrestricted@0x0 Cs  emitted, unrestricted
+  wave32@0x0 Cs  emitted, wave32
+  wave64@0x0 Cs  emitted, wave64

Evidence

Both revisions exited 0 and emitted three synthetic compute programs with cargo xwin run -p victory --locked --target x86_64-pc-windows-msvc -- translate "Z:<synthetic-directory>" --list --jobs 2. The added lines above are from that run with paths shortened.

Check Base ffe310e Head
cargo xwin test -p victory-shader --locked --target x86_64-pc-windows-msvc emit::tests::host_shader_reports_the_emitted_wave_size -- --exact Control failed, field was None for wave32 1 passed, including both PSV0 bounds
cargo xwin test -p victory --locked --target x86_64-pc-windows-msvc translate::counts_and_lists_emitted_wave_sizes -- --exact Control failed, all counts were zero 1 passed, including the merged totals and listing
cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings Pass Pass
cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings Pass Pass
cargo xwin test -p victory -p victory-shader --locked --target x86_64-pc-windows-msvc 106 passed, 15 failed, 1 ignored 108 passed, same 15 failed, 1 ignored
cargo xwin test --workspace --locked --target x86_64-pc-windows-msvc --no-fail-fast 322 passed, 20 failed, 6 ignored 324 passed, same 20 failed, 6 ignored
cargo xwin test --workspace --all-features --locked --target x86_64-pc-windows-msvc --no-fail-fast 326 passed, 20 failed, 6 ignored 328 passed, same 20 failed, 6 ignored
cargo test -p victory-shader --locked 96 passed, 1 ignored 97 passed, 1 ignored
cargo test -p victory-core -p victory-formats -p victory-game -p victory-pipeline -p victory-shader -p xtask --locked, then with --all-features 140 passed, 5 ignored each 141 passed, 5 ignored each
cargo test -p xtask --locked repository_passes_policy Pass Pass
cargo xtask policy --staged Pass Pass, 7 files
rustfmt --check --edition 2024 --config skip_children=true <changed Rust files> 4 pre-existing diffs Same 4 diffs
git diff --check origin/main HEAD Pass Pass

The control runs add the new assertions to base with shims that preserve its missing wave metadata and lack of recording. The unfiltered Wine runs used NO_GPU=1. Their 20 failures require a D3D12 device, a window, a Winsock export, a working nested Cargo path, or guest Git. With those tests filtered, the default and all-features suites passed 322 and 326 tests on base and 324 and 328 on head. A filtered all-features head run stalled in the save subprocess test and passed on retry. The workspace suites also exercised the shader cache round-trip for unrestricted, wave32, and wave64 metadata.

Not verified

Native Windows, hardware or WARP pipeline creation, DXIL validation with dxil.dll, and retail-scale translation were outside the CPU-only run.

Merge Danger

Door: Two-way

A revert restores the previous CLI output and public struct. Shader cache entries are rebuildable and keyed by the executable fingerprint.

Blast Radius: module

The change affects victory translate output, callers that construct HostShader, and the internal shader-cache record.

AI disclosure

OpenAI Codex (gpt-6.2-sol) wrote the patch, tests, and PR draft and ran the checks documented above. Antigravity (Gemini 4 Neon) coordinated and reviewed the diff. The author reviewed the diff and description before opening the PR.

@sinan-cmyk

Copy link
Copy Markdown

Offline measurement on a retail dump, and the shader tests on Ada

Result: no count change against main.

Offline. I merged head 9bab357 onto main ffe310e (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 21,724 on main, 21,724 with this PR.

No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on main. The count shows that the change rejects nothing. It does not show whether the output is right.

Tests: with the same merge, cargo test --locked -p victory-shader --lib passed 121, failed 0. The bitcode benchmark is ignored, as on main, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with VICTORY_WARP unset.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate (re-checked after the rebase, 6f80b10). It merges cleanly into main again. HostShader gets a wave_size field, taken from the size the emitter already declares (Shader::wave_size, through Lowered in emit/lower.rs). victory translate (apps/victory/src/translate.rs, check/Tally) then counts unrestricted, wave32 and wave64 programs and prints the size with --list. The rebase only adds the field to the new memory_tests fixtures.

shader_cache.rs encode/decode now write one more word. Old entries are not misread, because the cache key and folder come from the translator's sources. The new test in emit/mod.rs checks the field against the PSV0 wave-size range, so it tests the emitted DXIL rather than repeating the field.

CI: passing (check).


Generated by Claude Code

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally merged onto origin/main (63bcca43) at PR head 6f80b103 (Windows 11 x64, NVIDIA RTX 5090 + Microsoft WARP, VICTORY_D3D12_DEBUG=1).

Blocking issue: workspace build failure after merging onto current main

Although git merge-tree has no textual conflict, crates/victory-gpu/src/pipeline/depth_bounds_test.rs:59 (added on main since this branch's base) constructs a victory_shader::emit::HostShader literal without the new wave_size field. Merging onto origin/main (63bcca43) fails both cargo clippy --locked --workspace --all-targets [--all-features] -- -D warnings and cargo test --locked -p victory-gpu --lib with:

error[E0063]: missing field `wave_size` in initializer of `victory_shader::emit::HostShader`
  --> crates\victory-gpu\src\pipeline\depth_bounds_test.rs:59:15

Verified fix & rest of patch

Rebasing onto main and adding wave_size: None, to that HostShader initializer in crates/victory-gpu/src/pipeline/depth_bounds_test.rs:59 resolves the build cleanly. With that 1-line addition applied on the merged tree:

  • cargo xtask policy: 191 files ok (crates/victory-shader/src/emit/lower.rs is 520,636 B, under the 524,288 B limit).
  • cargo clippy --locked --workspace --all-targets -- -D warnings (default and --all-features): 0 warnings.
  • cargo test --locked -p victory-shader --lib emit::tests::host_shader_reports_the_emitted_wave_size: passed (verifies HostShader::wave_size matches PSV0 wave-size min/max bounds for unrestricted, wave32, and wave64).
  • cargo test --locked -p victory --bin victory translate::counts_emitted_wave_sizes: passed (Tally recording, merge, summary, and labels).
  • cargo test --locked -p victory-gpu --features diagnostics --lib -- shader_cache::tests:: pipeline::depth_bounds_test::: 6/6 passed on both RTX 5090 and WARP with VICTORY_D3D12_DEBUG=1 (covering shader_cache encode/decode round-tripping None, Some(32), and Some(64) plus depth_bounds_test).

Please rebase onto current main and populate wave_size in crates/victory-gpu/src/pipeline/depth_bounds_test.rs:59. Synthetic tests only.

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested against origin/main (63bcca4). victory-shader tests (emit::tests:: 18/18) pass, but victory-gpu fails to compile tests after merging onto origin/main because a newly added test constructs HostShader without the new wave_size field:

error[E0063]: missing field `wave_size` in initializer of `victory_shader::emit::HostShader`
  --> crates/victory-gpu/src/pipeline/depth_bounds_test.rs:59:15

Adding wave_size to that HostShader literal after rebasing onto main will fix the build.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

@ColorMeBoom

Copy link
Copy Markdown

Does not build on current main (found in an RDNA1 batch run; not hardware-specific).

Head 6f80b10 merges onto main 63bcca4 with no textual conflict, but cargo test -p victory-gpu --lib then stops:

error[E0063]: missing field `wave_size` in initializer of `victory_shader::emit::HostShader`
  --> crates\victory-gpu\src\pipeline\depth_bounds_test.rs:59:15

depth_bounds_test.rs came in with #158 (842b0cb), after the last rebase, and builds a HostShader without the field this PR adds. Adding wave_size there is probably all it needs; I have not tried it. The victory-shader tests it changes pass on the RX 5700 XT (206 passed).

AI use: Claude Code (Claude Opus 5.5).

@ColorMeBoom

ColorMeBoom commented Nov 26, 2026 •

Copy link
Copy Markdown

Follow-up: the one-line fix works. Head 6f80b10 merged onto main 63bcca4, plus:

--- a/crates/victory-gpu/src/pipeline/depth_bounds_test.rs
+++ b/crates/victory-gpu/src/pipeline/depth_bounds_test.rs
@@ fn host_shader
         host: victory_shader::emit::HostShader {
             stage: hw_stage,
+            wave_size: None,
             dxil: bytes.to_vec(),

None matches the PR's other hand-built HostShaders; the shader here is plain vs_5_1 HLSL with no wave size.

With it, on the RX 5700 XT (RDNA1, Windows 11 26200):

  • cargo test -p victory-gpu -p victory-shader -p victory --lib --bins --locked -- --test-threads=1: gpu 231 passed (1 ignored), shader 303 passed (3 ignored), victory 15 passed, 0 failed. That includes the PR's translate::counts_emitted_wave_sizes and emit::tests::host_shader_reports_the_emitted_wave_size, and both depth_bounds_test tests on hardware (vertex depth bounds on AMD Radeon RX 5700 XT: true).
  • cargo clippy -p victory-gpu -p victory-shader -p victory --all-targets --locked -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

AI use: Claude Code (Claude Opus 5.5).

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

@gurvancampion I reproduced the test-build error from @ColorMeBoom's report after merging 6f80b10 onto 63bcca4. The ready branch keeps your original commit and adds ff34c26 with the suggested wave_size: None on the depth-bounds fixture.

Both depth-bounds tests passed on app-local WARP. The synthetic shader metadata test host_shader_reports_the_emitted_wave_size and CLI test counts_emitted_wave_sizes passed too. Strict all-targets, all-features Clippy for victory, victory-gpu and victory-shader and the asset policy check passed.

The branch is ready to take. Please retain the Git authors and ColorMeBoom's co-author trailer. If folding the fixture change into another commit, please also add:

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted with Codex. Synthetic shader and CLI tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants