CLI: keep distinct DXIL dumps when shader labels collide #3027
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3029"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-26T03:56:38Z.
victory translate --listcan report two emitted and validated shaders while leaving only one.dxilinVICTORY_EMIT_DUMP. On63bcca43,pass-a.binandpass_a.binat offset zero both wrotepass_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. Ona495ecf5, neither filename matched the first run. Onfa57db39, 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
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T04:00:39Z.
Review: APPROVED
Reviewed
a495ecf5againstmain(63bcca43):VICTORY_EMIT_DUMPfilename collisions:dump_filenamehashes length-prefixedlabelplus emitteddxilbytes 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.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:37:37Z.
Review: APPROVED
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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:17:31Z.
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.
translateloops over every entrynative_programsreturns 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 fromenumerate()over the parsed programs, before translation, so it is stable from run to run.checkhas only this one caller, andblake3is 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:
checkpassing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-26T07:43:59Z.
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 printedtwo-vs.bin@0x0 Vsfor 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
fa57db39both joined, and rerunning into the same directory left exactly two files. The PR description has the other collision and concurrency checks.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T10:10:42Z.
Review: APPROVED
Verified against
origin/main(63bcca4):cargo test -p victory -- --test-threads=1: 15 lib + 4 integration tests passed (includingtranslate::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).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T10:46:16Z.
Review: APPROVED
dump_filenameinapps/victory/src/translate.rscleanly 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-widthprogram_indexkeeps dump names stable across emitter changes.Verified locally on Windows 11 x64 (
fa57db39):rustfmt --edition 2024 --check apps/victory/src/translate.rs: cleancargo run --locked -p xtask -- policy: passed (191 files ok)cargo clippy -p victory --all-targets --locked -- -D warnings(default and--all-features): cleancargo test -p victory --locked(default and--all-features): 19 passed, 0 failed eachOptional follow-up: surfacing
std::fs::writeerrors whenVICTORY_EMIT_DUMPpoints to a missing directory.Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T18:53:58Z.
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 base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo 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.dump_names_distinguish_full_source_labels_and_native_programs.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#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_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-26T21:34:51Z.
Follow-up to the optional dump-write feedback in the review:
0e0a5037408f237ee12c835cdef5982b4bac7152now reports a failed requested DXIL write, including the output path and OS error, and exits unsuccessfully after the batch summary.On Windows x64 the same synthetic vertex shader retained its filename and byte-identical DXIL with a writable destination. With either a missing directory or a regular file used as the directory, the prior head exited 0; the new one exited 1 with the failing DXIL path. A two-container, two-worker control blocked only one of the outputs: the other DXIL still matched byte for byte. Omitting
--listkept its existing behavior. The victory crate tests passed (19 tests). No title files were used.AI-assisted with Codex.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.