Repository navigation
Shaders: signature rows of one register in the validator's order - #1022
ThiagoAlexsander wants to merge 1 commit into
Conversation
The validator rebuilds ISG1/OSG1 from the module's signatures and compares bytes. It sorts rows by register, then by semantic name offset (DXC's sort_sig), not by column: with validator 1.6 every arbitrary semantic has its own name, so rows of one register keep element order. We sorted them by column, and a register whose elements come in another order (a w channel declared before the xyz of the same register) failed with "Container part 'Program Input/Output Signature' does not match expected for module". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catminou4
left a comment
There was a problem hiding this comment.
Signature rows of one register now sort by name offset (element order) instead of column, matching the validator's sort_sig; comment documents the rule precisely. New container test pins TEXCOORD-before-NORMAL ordering. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p <crate> --locked. Shader execution tests (valu_tests/host) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. victory-shader: 97 passed, 0 failed.
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 57e2cde on Windows 11, RTX 5070, MSVC:
cargo test -p victory-shader -- --test-threads=1passes on the head (121 passed, 1 ignored).- Merged into our fork: workspace tests, shader tests and
clippy -D warnings(default and all features) are all clean.
The change matches DXC. sort_sig in DxilContainerAssembler orders by stream, then register, then the SemanticName field, which is the name's offset in the string table. It does not sort by column, so keying the sort on offsets[i] reproduces it, including system values sharing their first offset. The new test checks the case that mattered: a .w element declared before the .xyz of the same register.
A static measurement on a full game package, counts only, with translate --validate --list before and after this PR:
- Programs failing with
Program Input/Output Signature does not match: 53 → 0. - All 53 now stop at the next container check,
Pipeline State Validation does not match. So this frees no program yet, but it removes the first blocker. - No program that validated before stops validating.
The PSV part probably needs the same row order in its signature element table, if that table is built from a separately ordered list.
AI-assisted (Claude Code).
…ter in the validator's order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alidator's order
…alidator's order
Where a fork-only change duplicates upstream's own version of a feature, upstream's is kept and the fork's dropped: - victory-shader is upstream's crate with the fork-only merges replayed onto it oldest first; those that do not apply onto upstream are dropped (37 of 63: among them Marvisak#704/raw views, gather4_l, the lane-mask and Marvisak#308 ports, Marvisak#947, Marvisak#1022, Marvisak#1112, Marvisak#1090, Marvisak#1182). Marvisak#284 (legacy fused madds) and Marvisak#98 (permlane16 in whole-wave sections) are dropped too: the first disagrees with upstream's hardware-checked model, the second refused 46 programs upstream translates. - translate: upstream's --cache replaces Marvisak#254's write-cache and work queue; Marvisak#378, Marvisak#517, Marvisak#673 and the victory.toml console are re-applied. - victory-gpu: upstream's stride table, page table and heap views replace the fork's Marvisak#704/stride-table wiring; fork-only fixes re-applied on top. Package (shaders.rpf, translate --validate --list, counts): vertex/pixel emitted 12559 -> 14295 of 14337, compute 2359 -> 2628 validated, mesh 2730 -> 2811 validated. Tests: the failures left (rect fourth corner, two stride tests, row order, gather4 at a level, memory table, dynamic heap slots) fail on upstream main as well on this host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Closing because this change is already in Signature rows are sorted by register only with element order kept in main (emit/container.rs signature(), stable sort; 13091f6), which is what this PR arrives at. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Validator 1.6 orders the rows of one register by semantic name offset
(DXC's `sort_sig`: stream, register, name). `signature` kept element
order, which is the same order except where a system value repeats: its
later elements share the first one's name, so they sort before an
arbitrary semantic declared between them. With SV_ClipDistance1 packed
into a row after a TEXCOORD, the validator refused the container
("Container part 'Program Output Signature' does not match expected for
module").
The key is the one Marvisak#1022 proposed.
Test: `packed_signature_rows_follow_system_value_name_order`, both
declaration orders through dxil.dll.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
36 emitted programs fail validation with
Container part 'Program Input Signature' does not match expected for module(15) or... 'Program Output Signature' ...(21), reported in #201. The validator rebuildsISG1/OSG1from the module's signature metadata and compares the bytes. The two disagree on the order of rows within one register.Cause
DXC's
DxilProgramSignatureWritersorts the rows withsort_sig: by stream, then register, then semantic name offset, not by column (lib/DxilContainer/DxilContainerAssembler.cpp). With validator 1.6 names are not deduplicated by content: each arbitrary semantic gets its own offset in element order, and system values share theirs, as the comment insignaturealready says. So rows of one register keep element order.signaturesorted them by column.The two orders differ when a register's elements are declared in another order than their columns. In
VS_RasterizeWaterIndirectHW_MeshBased_Meshlets, for example, register 5 holdsTEXCOORD3in w, declared beforeNORMAL0in xyz. The metadata listsTEXCOORD3first andOSG1listedNORMAL0first.Change
One sort key in
container::signature:(register, name offset)instead of(register, column). The comment now says how the validator orders rows.Results
victory translate --validateover the title's files (mainffe310eagainst this branch, Windows SDKdxil.dll10.0.26100), compared program by program:mainContainer part ... does not matchAll 36 now validate. No other program changes. The D3D12 runtime already created pipelines for these modules (#201), so this makes the container agree with the module rather than unblock pipelines.
Testing
rows_of_one_register_keep_element_order_not_column_orderinemit/container.rs: a w element declared before an xyz element of the same register is written first. Withmain's key it fails ([(0, 0), (0, 1), (3, 1)]against[(0, 0), (3, 1), (0, 1)]).cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored (342 onmainplus the new test). That includes the GPU tests that create graphics pipelines from translated signatures.cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features: clean.rustfmt --edition 2024 --checkoncontainer.rs: clean.cargo xtask policy: 154 files ok.Related: #554 makes rows of one interpolation mode and notes that it uncovers some of these errors. It changes how elements get their rows, this changes the order they are written in, so the two fit together.
AI use: Claude Code (Claude Opus 5.5) traced the mismatch by comparing one failing module's metadata with its
OSG1, checked DXC's sort, wrote the change and the test, and ran everything above. I reviewed the diff and the results.🤖 Generated with Claude Code