tooling: add a translator corpus hash check and an IR dump option #3791
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3791"
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 R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T22:54:14Z.
Problem
There is no single check that says whether a change to the native translator alters its output. Refactors, build-flag changes and cache changes each have to argue "no output change" from individual fixtures.
Change
tests/translator_corpus_hash.pyrunscompile_dxilover a source-built corpus (graphics pairs, RTV variants, compute requests, raw mesh shaders) and writes a sorted TSV: one row per request with its status and either a SHA-256 fingerprint of the published DXIL or the refusal reason. Running the same script and DXC directory against two builds and diffing the TSVs compares their output.compile_dxil --dump-irwrites the exact text handed to the compiler beside each stage asOUTPUT.cso.ir. The corpus script accepts--irto fingerprint that text instead.native_translator_corpus_dxilandnative_translator_corpus_ir, check known compilations and refusals and compare two cold snapshots byte for byte. The IR test also compares DXIL from runs with and without the dump option.docs/experiments/translator-corpus.mdhas the base-to-head procedure.Possible follow-up: a
translator-corpusjob inwindows.ymlthat buildscompile_dxilfor the PR head and its merge base and requires identical TSVs.Validation
Windows, MSVC,
devpreset, at2568a0d59: 8/8 tests passed.Comparing two builds:
Fixtures are generated from the synthetic instruction words already in the repository's tests.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T01:56:03Z.
The reviewed head passed Windows and Linux CI, but GitHub reports a merge conflict against current main. Please rebase
compile_dxil.cppwhile preserving #3794's MSVC warning handling, and rerun the batch, refusal and IR-dump tests on the rebased head.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T04:13:39Z.
Rebased onto
main(0dd65da11) after #3794 merged. The only conflict was intools/startup/compile_dxil.cpp, where the IR dump option now sits after the#pragma warning(suppress: 4996)that #3794 added. The CTest selection from the description passes again with MSVC on the new head.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T05:17:55Z.
Review: APPROVED
Thanks for the rebase. I confirmed the MSVC warning suppression still surrounds the legacy environment lookup and the explicit dump path is reserved alongside the output paths. On Windows Debug at
13625d24, the eight tests selected byctest --preset dev --no-tests=error -j 2 -R '^(native_translator_corpus_(dxil|ir)|native_compile_dxil_(refusals|rekey|watch)|native_direct_mesh|native_rtv_variant_controls|startup_compute_translate_requests)$' --output-on-failurepassed.