CLI: keep distinct DXIL dumps when shader labels collide #3029

Open
github-bot wants to merge 2 commits from github-bot/gh-3029 into main AGit
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 03:56 UTC · original
passerbyyhx:fix/translate-dump-filenames → main · +40 −10 · 1 files · 2 commits · open

victory translate --list can report two emitted and validated shaders while leaving only one .dxil in VICTORY_EMIT_DUMP. On 63bcca43, pass-a.bin and pass_a.bin at offset zero both wrote pass_a_bin_0x0_Vs.dxil. Reversing the input order changed which shader survived. Long labels with the same final 100 characters also collided.

This keeps the 100-byte stem limit and puts the readable, sanitized source label first. A 128-bit BLAKE3 suffix identifies the full original label and the native program’s index in its source container. The index is assigned before translation. Changing the emitted bytes leaves the filename stable across emitter revisions.

The index resolves a real collision inside a single input. A synthetic DXBC with two native VS entries produces two different validated DXIL outputs. Both lines are displayed as two-vs.bin@0x0 Vs. Each dump matched a separate translation of its source program. I then changed only LLVM producer metadata in a local emitter build. Both outputs changed and passed Windows SDK validation again. On a495ecf5, neither filename matched the first run. On fa57db39, both filenames matched and a repeat into the same directory left exactly the two updated files.

I also checked punctuation, truncation to 100 bytes, and packed records under --jobs 4. Eight simultaneous CLI processes using the same output directory retained both expected outputs. The CLI package passed all 19 tests, strict all-targets/all-features Clippy passed, and the changed Rust file passed rustfmt.

Original synthetic CLI fixture · Coordination claim

**@⁠passerbyyhx** on GitHub · 2026-11-26 03:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029) `passerbyyhx:fix/translate-dump-filenames` → `main` · +40 −10 · 1 files · 2 commits · open `victory translate --list` can report two emitted and validated shaders while leaving only one `.dxil` in `VICTORY_EMIT_DUMP`. On `63bcca43`, `pass-a.bin` and `pass_a.bin` at offset zero both wrote `pass_a_bin_0x0_Vs.dxil`. Reversing the input order changed which shader survived. Long labels with the same final 100 characters also collided. This keeps the 100-byte stem limit and puts the readable, sanitized source label first. A 128-bit BLAKE3 suffix identifies the full original label and the native program’s index in its source container. The index is assigned before translation. Changing the emitted bytes leaves the filename stable across emitter revisions. The index resolves a real collision inside a single input. A synthetic DXBC with two native VS entries produces two different validated DXIL outputs. Both lines are displayed as `two-vs.bin@0x0 Vs`. Each dump matched a separate translation of its source program. I then changed only LLVM producer metadata in a local emitter build. Both outputs changed and passed Windows SDK validation again. On `a495ecf5`, neither filename matched the first run. On `fa57db39`, both filenames matched and a repeat into the same directory left exactly the two updated files. I also checked punctuation, truncation to 100 bytes, and packed records under `--jobs 4`. Eight simultaneous CLI processes using the same output directory retained both expected outputs. The CLI package passed all 19 tests, strict all-targets/all-features Clippy passed, and the changed Rust file passed rustfmt. [Original synthetic CLI fixture](https://github.com/passerbyyhx/VIctory/blob/b3752917978f1fb3d8f5cdb8ce67125a41933918/tests/verify_list_dump_names.py) · [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:26:55 +00:00
Hash the full source label and the native program index before emission. This keeps names comparable when DXIL changes and preserves separate files when one container has multiple programs at the same stage. Put the readable source text first so related outputs sort together.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 04:00 UTC · original · approved these changes

Reviewed a495ecf5 against main (63bcca43):

  • Clean, minimal fix for VICTORY_EMIT_DUMP filename collisions: dump_filename hashes length-prefixed label plus emitted dxil bytes with BLAKE3 and keeps a readable ASCII suffix within a 100-byte stem, avoiding overwrites across truncated labels, sanitization collisions (- vs _), and distinct DXIL outputs sharing a label.
  • Safe UTF-8 slicing on the ASCII-sanitized suffix, solid unit tests, and CI is green.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 04:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029#pullrequestreview-6068369626) · **approved these changes** Reviewed `a495ecf5` against `main` (`63bcca43`): - Clean, minimal fix for `VICTORY_EMIT_DUMP` filename collisions: `dump_filename` hashes length-prefixed `label` plus emitted `dxil` bytes with BLAKE3 and keeps a readable ASCII suffix within a 100-byte stem, avoiding overwrites across truncated labels, sanitization collisions (`-` vs `_`), and distinct DXIL outputs sharing a label. - Safe UTF-8 slicing on the ASCII-sanitized suffix, solid unit tests, and CI is green.
Author
Owner

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

LGTM — keying on len+label+dxil discriminates both label collisions and same-label different shaders; the ASCII map makes the byte slice safe, suffix budget keeps the 100-char stem. Test hits both collision directions and the over-length case.

**@⁠kotekompotek** on GitHub · 2026-11-26 04:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029#pullrequestreview-6068614520) · **approved these changes** LGTM — keying on len+label+dxil discriminates both label collisions and same-label different shaders; the ASCII map makes the byte slice safe, suffix budget keeps the 100-char stem. Test hits both collision directions and the over-length case.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 06:17 UTC · original · edited 2026-11-26 08:26 UTC

Automated triage for the maintainers.

Merge candidate (recommending a look, not approving). Thanks for the update. In fa57db3, dump_filename (apps/victory/src/translate.rs) no longer hashes the emitted DXIL, so a shader keeps its dump name across emitter revisions. The readable, sanitised label now comes first (its last 67 characters), followed by a 32-hex BLAKE3 suffix of the full label and the program index, which keeps the stem at 100 bytes.

On your reply: you're right about the index. translate loops over every entry native_programs returns for one container, and two entries of the same stage share a label, so a key built from the label alone would overwrite one of them. The index comes from enumerate() over the parsed programs, before translation, so it is stable from run to run. check has only this one caller, and blake3 is already a dependency of the app. The new test covers names that differ only in punctuation, a different index, and long labels with the same tail.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 06:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029#issuecomment-7184284361) · edited 2026-11-26 08:26 UTC <!-- victory-triage v1 head=fa57db39419335e4c194cb187e962d4389bc4d00 verdict=merge-candidate at=2026-11-26T08:16:15Z --> Automated triage for the maintainers. **Merge candidate** (recommending a look, not approving). Thanks for the update. In `fa57db3`, `dump_filename` (`apps/victory/src/translate.rs`) no longer hashes the emitted DXIL, so a shader keeps its dump name across emitter revisions. The readable, sanitised label now comes first (its last 67 characters), followed by a 32-hex BLAKE3 suffix of the full label and the program index, which keeps the stem at 100 bytes. On your reply: you're right about the index. `translate` loops over every entry `native_programs` returns for one container, and two entries of the same stage share a label, so a key built from the label alone would overwrite one of them. The index comes from `enumerate()` over the parsed programs, before translation, so it is stable from run to run. `check` has only this one caller, and `blake3` is already a dependency of the app. The new test covers names that differ only in punctuation, a different index, and long labels with the same tail. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 07:43 UTC · original

Updated in fa57db39. Dump filenames now start with the readable source label and no longer depend on emitted DXIL bytes. I kept the source program index in the hash because a single input can contain two native entries of the same stage. The CLI validated two distinct VS programs from one synthetic DXBC and printed two-vs.bin@0x0 Vs for both. A label-only key would overwrite one of them. The index comes from the parsed input, before either entry is translated.

I tested the same input with two local emitter builds that differ only in LLVM producer metadata. Both DXIL outputs changed and still validated. On the previous PR revision neither filename joined across builds; on fa57db39 both joined, and rerunning into the same directory left exactly two files. The PR description has the other collision and concurrency checks.

**@⁠passerbyyhx** on GitHub · 2026-11-26 07:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029#issuecomment-7185774514) Updated in `fa57db39`. Dump filenames now start with the readable source label and no longer depend on emitted DXIL bytes. I kept the source program index in the hash because a single input can contain two native entries of the same stage. The CLI validated two distinct VS programs from one synthetic DXBC and printed `two-vs.bin@0x0 Vs` for both. A label-only key would overwrite one of them. The index comes from the parsed input, before either entry is translated. I tested the same input with two local emitter builds that differ only in LLVM producer metadata. Both DXIL outputs changed and still validated. On the previous PR revision neither filename joined across builds; on `fa57db39` both joined, and rerunning into the same directory left exactly two files. The PR description has the other collision and concurrency checks.
Author
Owner

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

Verified against origin/main (63bcca4):

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

Cleanly keeps DXIL dump filenames distinct when shader labels collide.

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

**@⁠Dukestar69** on GitHub · 2026-11-26 10:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029#pullrequestreview-6072156126) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory -- --test-threads=1`: 15 lib + 4 integration tests passed (including `translate::tests::dump_names_distinguish_full_source_labels_and_native_programs`). - `cargo clippy -p victory --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly keeps DXIL dump filenames distinct when shader labels collide. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

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

dump_filename in apps/victory/src/translate.rs cleanly resolves label sanitization collisions, long-label tail collisions, and multiple native programs sharing a stage within one container. Slicing after ASCII mapping stays UTF-8 safe, the 100-byte stem budget is respected, and hashing the full label plus fixed-width program_index keeps dump names stable across emitter changes.

Verified locally on Windows 11 x64 (fa57db39):

  • rustfmt --edition 2024 --check apps/victory/src/translate.rs: clean
  • cargo run --locked -p xtask -- policy: passed (191 files ok)
  • cargo clippy -p victory --all-targets --locked -- -D warnings (default and --all-features): clean
  • cargo test -p victory --locked (default and --all-features): 19 passed, 0 failed each

Optional follow-up: surfacing std::fs::write errors when VICTORY_EMIT_DUMP points to a missing directory.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 10:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029#pullrequestreview-6072736160) · **approved these changes** `dump_filename` in `apps/victory/src/translate.rs` cleanly resolves label sanitization collisions, long-label tail collisions, and multiple native programs sharing a stage within one container. Slicing after ASCII mapping stays UTF-8 safe, the 100-byte stem budget is respected, and hashing the full label plus fixed-width `program_index` keeps dump names stable across emitter changes. Verified locally on Windows 11 x64 (`fa57db39`): - `rustfmt --edition 2024 --check apps/victory/src/translate.rs`: clean - `cargo run --locked -p xtask -- policy`: passed (`191 files ok`) - `cargo clippy -p victory --all-targets --locked -- -D warnings` (default and `--all-features`): clean - `cargo test -p victory --locked` (default and `--all-features`): 19 passed, 0 failed each Optional follow-up: surfacing `std::fs::write` errors when `VICTORY_EMIT_DUMP` points to a missing directory.
Author
Owner

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

NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head fa57db3 (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: 867 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: dump_names_distinguish_full_source_labels_and_native_programs.
  • --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:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/3029#issuecomment-7200973152) NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head `fa57db3` (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`: **867 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `dump_names_distinguish_full_source_labels_and_native_programs`. - `--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/3029/head:github-bot/gh-3029'
git switch 'github-bot/gh-3029'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3029'
git switch 'github-bot/gh-3029'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3029'
git switch 'github-bot/gh-3029'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3029'
git switch 'main'
git merge --squash 'github-bot/gh-3029'
git switch 'main'
git merge --ff-only 'github-bot/gh-3029'
git switch 'main'
git merge 'github-bot/gh-3029'
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!3029
No description provided.