Repository navigation
Conversation
…some
`finish` wrote the console's LDS size into PSV0's GroupSharedBytesUsed
whenever the mesh state declared one. DXC counts the bytes of the
group-shared globals in the module, and the global is made only when an
LDS instruction is lowered. A mesh program that declares LDS and never
touches it has no such global, so the validator's rebuilt PSV0 holds 0
and the container is refused ("Container part 'Pipeline State
Validation' does not match expected for module").
The size is now written only when the global exists.
Test: `unused_mesh_lds_is_not_counted_in_psv0`, the triangle mesh
program with and without declared LDS through dxil.dll.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Reviewed and verified
|
kotekompotek
left a comment
There was a problem hiding this comment.
Matches DXC's rule: PSV0 group-shared bytes come from the module's globals, and a mesh program whose code never touches declared LDS has no such global — reporting the console's lds_bytes would make PSV0 inconsistent with the module and fail validation. Gating on self.lds.is_some() (an actual access, not the declared size) is the right signal, and the dxil.dll validation test proves both sides. LGTM.
AwsAli05
left a comment
There was a problem hiding this comment.
I compared this with #2857. Both production changes emit zero PSV0 shared bytes when there is no LDS global, and lds_dwords * 4 when the global exists. The current #2857 also has its validation test on the same module path. Please coordinate which branch should carry the fix so the same shader-container change lands once.
AI-assisted static review.
|
Automated triage for the maintainers. In This is a recommendation for a maintainer to look, not an approval. Generated by Claude Code |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (63bcca4) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:
- Counting shared memory in a mesh shader's PSV0 only when shared memory is actually used passes all emit tests cleanly.
cargo test -p victory-shader emit::tests: 18/18 passed on RTX 5090, 18/18 passed on WARP (includingunused_mesh_lds_is_not_counted_in_psv0).cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 192 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…ory only when it has some
…s shared memory only when it has some
Problem
For a mesh program
Shader::finishwrites the console's LDS size into PSV0'sGroupSharedBytesUsedwhenever the mesh state declares one (lds_dwords, set from the program'slds_bytes). DXC fills that field from the module: it adds up the sizes of the globals in the group-shared address space (lib/DxilContainer/DxilPipelineStateValidation.cpp). Here the group-shared global is made lazily, byShader::lds, when an LDS instruction is lowered.So a mesh program whose state declares LDS and whose code never touches it has no such global: the validator's rebuilt PSV0 holds 0, ours holds the declared size, and the whole runtime info is compared byte for byte:
Fix
The size is written only when the global exists.
Test
emit::tests::unused_mesh_lds_is_not_counted_in_psv0: the triangle mesh program of the existing tests, withlds_bytes0 (a control) and 16, both throughdxil.dll. The program has no LDS instruction.Verification
GitHub Actions on
windows-latest, on the fork, with the jobs narrowed tovictory-shaderandxtask; the validator ran in both (the control prints that it validated):270 passed; 1 failed;271 passed; 0 failed; 3 ignored.Not checked: the title's shaders. I do not know how many mesh programs declare LDS without using it, nor whether any of the mesh programs that still fail validation (#201) are this case.
Notes
emit/mod.rs, in different places; the two merge together without conflict.Credit
The mismatch came out of comparing
emit/shader.rsandemit/container.rswith DXC's PSV0 writer; Devin wrote the test and the change and ran both arms.— Devin & Fable