CLI: deduplicate translate containers by declared container bytes instead of DXIL payload alone #3003

Open
github-bot wants to merge 1 commit from github-bot/gh-3003 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 03:05 UTC · original
fuzeofficlal:fix/cli-translate-container-dedup → main · +72 −1 · 1 files · 1 commits · open

Summary

  • Hash the parsed DXBC container through its validated declared size (&bytes[..size]) in apps/victory/src/translate.rs::translate instead of hashing only the DXIL/ACCC part payload, matching warm()'s container-level deduplication.
  • Prevents offline victory translate from silently skipping distinct containers that share an identical DXIL/ACCC payload but carry different container-level metadata/signatures (ISG1, OSG1, PSV0, etc.) read by emit::emit_with, while still deduplicating identical containers followed by differing trailing file bytes.
  • Add two synthetic unit tests covering distinct ISG1 signatures with identical payloads and identical containers with trailing padding bytes.

Verification

  • cargo test -p victory --locked: 16 unit tests + 4 integration tests passed.
  • cargo clippy -p victory --locked --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 191 files ok.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 03:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/3003) `fuzeofficlal:fix/cli-translate-container-dedup` → `main` · +72 −1 · 1 files · 1 commits · open ## Summary - Hash the parsed DXBC container through its validated declared size (`&bytes[..size]`) in `apps/victory/src/translate.rs::translate` instead of hashing only the `DXIL`/`ACCC` part payload, matching `warm()`'s container-level deduplication. - Prevents offline `victory translate` from silently skipping distinct containers that share an identical `DXIL`/`ACCC` payload but carry different container-level metadata/signatures (`ISG1`, `OSG1`, `PSV0`, etc.) read by `emit::emit_with`, while still deduplicating identical containers followed by differing trailing file bytes. - Add two synthetic unit tests covering distinct `ISG1` signatures with identical payloads and identical containers with trailing padding bytes. ## Verification - `cargo test -p victory --locked`: 16 unit tests + 4 integration tests passed. - `cargo clippy -p victory --locked --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 191 files ok.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:19:52 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 03:22 UTC · original

Independent Windows verification of c84b7ee, compared with its exact parent 63bcca4 (current main): the change does what it says.

Scope is the claim in #1633. I checked the head, the single parent, CLEAN state and green check before starting and again before posting. No overlapping run reports were found. Only synthetic DXBC bytes were used, with no game files.

Host. Windows 11 Pro 10.0.26200, rustc and cargo 1.98.1, -j 4 --locked, dedicated target directory, cargo clean -p between worktrees. No GPU is involved: Checks { host: None, validator: None }.

Code check. Container::parse rejects total > data.len() or total < HEADER_SIZE, and the hash runs only after a successful parse, so &bytes[..size] cannot go out of bounds.

Commands. Head: cargo test -j 4 --locked -p victory -- --nocapture --test-threads=1. Parent: the PR's two tests copied unchanged into the parent's mod tests, plus the same temporary probe on both revisions (not committed), run with cargo test -j 4 --locked -p victory --bin victory -- dedup probe_3003 --nocapture.

Case (two containers fed to translate) Parent duplicates Head duplicates
PR test dedup_keeps_distinct_input_signatures: different ISG1, identical DXIL payload 1 (test fails: left: 1, right: 0) 0 (pass)
PR test dedup_ignores_trailing_file_bytes: identical declared bytes + 16 zero trailing bytes 1 (pass) 1 (pass)
Probe: identical declared bytes + 37 nonzero trailing bytes 1 1
Probe: byte-identical containers 1 1
Probe: extra PSV0 part, larger declared size, identical DXIL payload 1 0
Probe: only the 16-byte header digest differs 1 0

So on the parent, distinct declared containers with the same payload are collapsed. On the head they are kept apart, and identical declared bytes are still deduplicated whatever bytes follow them. The last row is a side effect: the digest is inside the declared bytes, so it now counts. That matches warm()'s container-level key.

Head full run: 17 unit tests (the 16 existing plus the probe) and 4 integration tests pass. Clippy and the asset policy were not re-run here.

AI-assisted: verification run and written by Claude Code (Claude Opus 5.5). The figures above come from these runs on this host.

**@⁠oni-swr** on GitHub · 2026-11-26 03:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3003#issuecomment-7181661050) **Independent Windows verification of `c84b7ee`, compared with its exact parent `63bcca4` (current `main`): the change does what it says.** Scope is the claim in https://git.gtahub.st/github/Marvisak--VIctory/issues/1633. I checked the head, the single parent, CLEAN state and green `check` before starting and again before posting. No overlapping run reports were found. Only synthetic DXBC bytes were used, with no game files. **Host.** Windows 11 Pro 10.0.26200, rustc and cargo 1.98.1, `-j 4 --locked`, dedicated target directory, `cargo clean -p` between worktrees. No GPU is involved: `Checks { host: None, validator: None }`. **Code check.** `Container::parse` rejects `total > data.len()` or `total < HEADER_SIZE`, and the hash runs only after a successful parse, so `&bytes[..size]` cannot go out of bounds. **Commands.** Head: `cargo test -j 4 --locked -p victory -- --nocapture --test-threads=1`. Parent: the PR's two tests copied unchanged into the parent's `mod tests`, plus the same temporary probe on both revisions (not committed), run with `cargo test -j 4 --locked -p victory --bin victory -- dedup probe_3003 --nocapture`. | Case (two containers fed to `translate`) | Parent duplicates | Head duplicates | |---|---|---| | PR test `dedup_keeps_distinct_input_signatures`: different `ISG1`, identical `DXIL` payload | **1** (test fails: `left: 1, right: 0`) | **0** (pass) | | PR test `dedup_ignores_trailing_file_bytes`: identical declared bytes + 16 zero trailing bytes | 1 (pass) | 1 (pass) | | Probe: identical declared bytes + 37 nonzero trailing bytes | 1 | 1 | | Probe: byte-identical containers | 1 | 1 | | Probe: extra `PSV0` part, larger declared size, identical `DXIL` payload | **1** | **0** | | Probe: only the 16-byte header digest differs | 1 | 0 | So on the parent, distinct declared containers with the same payload are collapsed. On the head they are kept apart, and identical declared bytes are still deduplicated whatever bytes follow them. The last row is a side effect: the digest is inside the declared bytes, so it now counts. That matches `warm()`'s container-level key. Head full run: 17 unit tests (the 16 existing plus the probe) and 4 integration tests pass. Clippy and the asset policy were not re-run here. AI-assisted: verification run and written by Claude Code (Claude Opus 5.5). The figures above come from these runs on this host.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 03:42 UTC · original

I checked the emitted vertex shaders as a follow-up to the duplicate-count tests above. This was a CPU-only run of victory translate --list --validate on Windows. A and B contain identical synthetic vertex instructions. Their input signatures name the same float4 register INPUT_A and INPUT_B, respectively. The shader copies all four components to SV_Position.

On the direct parent 63bcca43, a single worker emitted only A for the file order A/B/A and only B for B/A/B. On c84b7eef, both orders emitted A and B and skipped the repeated container. With --jobs 4 and A/B/A, the parent emitted A in this run and the PR emitted both.

I read ISG1 from the emitted binaries. Each PR output matched its corresponding parent output byte-for-byte, passed the Windows SDK 10.0.28000.0 DXIL validator, and disassembled to four input loads and four output stores. Standalone reproducer and build commands.

**@⁠passerbyyhx** on GitHub · 2026-11-26 03:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/3003#issuecomment-7181954814) I checked the emitted vertex shaders as a follow-up to the duplicate-count tests above. This was a CPU-only run of `victory translate --list --validate` on Windows. A and B contain identical synthetic vertex instructions. Their input signatures name the same float4 register `INPUT_A` and `INPUT_B`, respectively. The shader copies all four components to `SV_Position`. On the direct parent `63bcca43`, a single worker emitted only A for the file order A/B/A and only B for B/A/B. On `c84b7eef`, both orders emitted A and B and skipped the repeated container. With `--jobs 4` and A/B/A, the parent emitted A in this run and the PR emitted both. I read `ISG1` from the emitted binaries. Each PR output matched its corresponding parent output byte-for-byte, passed the Windows SDK 10.0.28000.0 DXIL validator, and disassembled to four input loads and four output stores. [Standalone reproducer and build commands](https://github.com/passerbyyhx/VIctory/blob/43b8606d175da1f257c4e6c09c680fba2a19e63f/tests/verify_translate_dedup.py).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 05:41 UTC · original

Automated triage for the maintainers.

Merge candidate. translate() in apps/victory/src/translate.rs deduplicated containers by a hash of the DXIL/ACCC payload alone. Two containers with the same program but different signatures, which the translation depends on, were counted as one and the second was never translated or validated. The PR hashes the whole declared container (bytes[..size], the size at 0x18), the same container-level key that the cache warm path already uses (blake3::hash(container)). I checked the slice bound: Container::parse (crates/victory-shader/src/dxbc.rs) already rejects a declared size above the data or below the header, and this code runs only after a successful parse, so it cannot go out of bounds. Bytes after the container in a raw source still don't count. One side effect: the 16-byte digest is now part of the key, so containers that differ only there are no longer merged. That matches the warm path. The two synthetic-container tests cover both cases.

CI: passing (check).

Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 05:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/3003#issuecomment-7183721914) <!-- victory-triage v1 head=c84b7eefb9d9ad39252303cf7b634686c627f25c verdict=merge-candidate at=2026-11-26T05:41:41Z --> Automated triage for the maintainers. **Merge candidate.** `translate()` in `apps/victory/src/translate.rs` deduplicated containers by a hash of the `DXIL`/`ACCC` payload alone. Two containers with the same program but different signatures, which the translation depends on, were counted as one and the second was never translated or validated. The PR hashes the whole declared container (`bytes[..size]`, the size at `0x18`), the same container-level key that the cache warm path already uses (`blake3::hash(container)`). I checked the slice bound: `Container::parse` (`crates/victory-shader/src/dxbc.rs`) already rejects a declared size above the data or below the header, and this code runs only after a successful parse, so it cannot go out of bounds. Bytes after the container in a raw source still don't count. One side effect: the 16-byte digest is now part of the key, so containers that differ only there are no longer merged. That matches the warm path. The two synthetic-container tests cover both cases. CI: passing (`check`). Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 03:07 UTC · original · approved these changes

LGTM — hashing only the DXIL part collapsed distinct containers that shared DXIL but differed in signatures/metadata; hashing bytes[..size] (the DXBC size field at 0x18) covers the whole declared container, and the declared-boundary cut correctly keeps a raw source's trailing bytes out of the key. Both tests discriminate: distinct ISG1 semantics stay distinct, trailing padding still dedups.

**@⁠kotekompotek** on GitHub · 2026-11-26 03:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/3003#pullrequestreview-6068015122) · **approved these changes** LGTM — hashing only the DXIL part collapsed distinct containers that shared DXIL but differed in signatures/metadata; hashing bytes[..size] (the DXBC size field at 0x18) covers the whole declared container, and the declared-boundary cut correctly keeps a raw source's trailing bytes out of the key. Both tests discriminate: distinct ISG1 semantics stay distinct, trailing padding still dedups.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 09:10 UTC · original · approved these changes

Verified against origin/main (63bcca4):

  • cargo test -p victory -- --test-threads=1: 16 lib + 4 integration tests passed (including translate::tests::dedup_ignores_trailing_file_bytes and translate::tests::dedup_keeps_distinct_input_signatures).
  • cargo clippy -p victory --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly deduplicates translate containers by declared container bytes so distinct input signatures are preserved while trailing bytes are ignored.

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

**@⁠Dukestar69** on GitHub · 2026-11-26 09:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3003#pullrequestreview-6071270216) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory -- --test-threads=1`: 16 lib + 4 integration tests passed (including `translate::tests::dedup_ignores_trailing_file_bytes` and `translate::tests::dedup_keeps_distinct_input_signatures`). - `cargo clippy -p victory --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly deduplicates translate containers by declared container bytes so distinct input signatures are preserved while trailing bytes are ignored. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 18:35 UTC · original

NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head c84b7ee (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: dedup_keeps_distinct_input_signatures, dedup_ignores_trailing_file_bytes.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 18:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/3003#issuecomment-7200628294) NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head `c84b7ee` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **868 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `dedup_keeps_distinct_input_signatures`, `dedup_ignores_trailing_file_bytes`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3003/head:github-bot/gh-3003'
git switch 'github-bot/gh-3003'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3003'
git switch 'github-bot/gh-3003'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3003'
git switch 'github-bot/gh-3003'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3003'
git switch 'main'
git merge --squash 'github-bot/gh-3003'
git switch 'main'
git merge --ff-only 'github-bot/gh-3003'
git switch 'main'
git merge 'github-bot/gh-3003'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3003
No description provided.