Shaders: DXC compiles skip dxil.dll's validator and XCL signs the DXIL #1608
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1618"
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 ivall/xcl. Originally posted by chippy01 on 2026-11-24T18:17:01Z.
Part of #1269.
Every DXC compile runs
dxil.dll's validator, which signs the container: D3D12 refuses DXIL without a valid hash. Since #1426, XCL computes that hash itself (gpu::dxil::container::hash, the retail DXBC digest). A title's compiles andxcl shaders --precompilenow run DXC with-Vdand sign the container in XCL: the same bytes as before, without the validator's run. On 253 programs of the retail title's pack the validator was 6.4 % of DXC's time and refused none of them.(The first revision of this PR used the runtime's BYPASS hash instead; it was reworked onto #1426's digest once that was merged, so it no longer depends on the runtime and the caches see the same DXIL as before.)
What is in it
crates/xcl/src/gpu/recomp/dxc.rs:compile_without_validator()turns it on for the process (XCL_DXC_VALIDATE=1keeps the validator);compile_hereadds-Vdandsignwrites the digest into the container DXC left unsigned. Tests:unsigned_containers_get_the_hash_the_validator_writes(four DXC-signed containers oftests/data/dxilget their own hash back after it is zeroed) andunvalidated_compiles_give_the_validators_container(a CS and a PS through DXC both ways: the same bytes).crates/xcl/src/host.rs: the title host turns it on.crates/xcl/src/shaders.rs:xcl shaders --precompileturns it on. The unit tests do not: the validator stays their oracle.README.md: one line.Tested
NVIDIA GeForce RTX 3070 Ti 8 GB (driver 621.24), AMD Ryzen 9 7900X, 32 GB RAM, Windows 11 Pro 26200, rustc 1.100.0
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (Windows SDK 10.0.26100.0); tests in debug, runs in release.cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4onmain06c9f55with this change: 1267 passed, 0 failed, 46 ignored. SKIPPED: 21 GPU cases for want of wave64 on this card (among themgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,dispatch_chain_native_wave64_builds_wholeand thelower/lower_dxilwave64 comparisons), 3lower_dxilf16 / f32 per-lane cases the per-lane form refuses, andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Seen while testing, in code this PR does not touch:
06c9f55, the first suite run: the lib test binary stopped on a device removal (0x887a0006, device hung) while thehle::d3d12x::list_xcross-queueWait64BitValueXtests ran (the log ends withcross_queue_cycle_and_same_queue_fifo_do_not_deadlock's>= 0x702waits). The lib tests never turn this PR's path on (only the title host and--precompiledo); the lib binary alone, and then the whole suite above, passed.f087b99(the previous base): two tests failed with and without this change; #2245 has fixed both onmain.c160d86:concurrent_cache_misses_compile_oncefailed once on its timing check (cached-only waited 1.09 s, limit 200 ms) and passed in the next run.With the
signcall removed,unvalidated_compiles_give_the_validators_containerfails; with the digest taken over the wrong bytes, both new tests fail.DXC time with and without the validator, on 253 programs of the retail title's
shaders.rpf(every 100th by name:xcl shaders --recompwithXCL_DUMP_HLSL,XCL_RECOMP_WINDOWS=4), with XCL's arguments (-HV 2021,-O1over 1 MB of HLSL) and the SDK'sdxc.exe, one compile at a time, the order alternating per program:-Vd-O1)All 253 compile both ways and the validator refused none. For all 253,
container::hashof the-Vdcontainer equals the hashdxil.dllwrote, and the rest of the container is identical.The same 253 in one process on 23 threads, one
IDxcCompiler3per thread as in XCL's pool: 38.8 s and 37.5 s validated, 35.8 s and 37.3 s with-Vd(alternating; the largest programs set the wall time); peak commit 3.7 – 3.8 GB either way.Retail title, 60 s runs of
scripts/smoke.ps1on the working tree before the commit, onc160d86: from an emptyXCL_DXIL_CACHE, the log hasDXC: compiles skip dxil.dll's validator and are signed by XCL, 12 compiles, 0 failures, 0 failed pipelines, 1393 frames; all 12 containers carry the correct hash and are byte for byte the onesmain's validator made for the same programs in its own run from an empty cache. On06c9f55, with the shared warm cache: 1593 and 1643 frames (main06c9f55: 1555 and 1625). No device removal or crash in these runs. The title stays in its menus in 60 s, so they show the output is unchanged, not a speed-up.One run of an earlier head (
8b9fec0, onc160d86) ended at 34.6 s with an access violation intitle_textures::refresh→subresources→ the detiler, reading title memory that was no longer mapped (the class of #1393). This PR does not touch that path; the next run of the same build was clean, and no run of this change or ofmainon this machine has crashed since.Regression run
main(06c9f55), the second of two runs (the first showed 1555 frames):this PR's head:
Not tested
XCL_DXC_VALIDATE=1brings the validator back for a title.AI use
[PR #1618] Shaders: skip DXC's validator where the runtime takes the BYPASS hashto [PR #1618] Shaders: DXC compiles skip dxil.dll's validator and XCL signs the DXILImported from ivall/xcl. Originally posted by MatyEjsr on 2026-11-24T20:12:38Z.
Updated independent Windows / NVIDIA GPU verification on the rebased head
b6f4f75b8f17c66cbbd02787ff55612fbda6a46c(superseding earlier run on8b9fec0; base1d027e5, verified clean merge with currentmain568e7db) using DXC 1.9.2602.17.Tested
stable-x86_64-pc-windows-msvc), debug and release builds, Windows SDK DXCdxcompiler 1.9.2602.17 (21d28f72)+dxil 1.9.2602.17git merge-tree --write-tree main HEAD(againstmain568e7db): exit 0 (no conflicts, including alongsideb937c33indxc.rs)cargo build --workspace -j 8: ok (14.78s, 0 errors, 0 warnings in PR files)cargo build --release --workspace -j 8: ok (35.64s, 0 errors, 0 warnings in PR files)cargo test --workspace -j 8 -- --test-threads=4: 961 passed, 0 failed, 43 ignored, 22 SKIPPEDno wave64skips (gpu::recomp::lower::tests::{a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu},gpu::recomp::lower_dxil::tests::{a_per_lane_2d_or_3d_group_runs_on_the_gpu, f16_programs_on_the_gpu [2 wave64 cases], f32_programs_on_the_gpu [6 wave64 cases], f64_programs_on_the_gpu, integer_programs_on_the_gpu [2 wave64 cases]},gpu::recomp::tests::{gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware})gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpuwave32 f16 arithmetic / f16 packed,f32_programs_on_the_gpuwave32 f32 conversions)no heap windowsskip (heap_window_out_of_memory_falls_back_to_the_switch_form)cargo test -p xcl --lib -- "gpu::recomp::dxc::" --nocapture: 16 passed, 0 failed, 0 ignored, 0 SKIPPED (0.44s withdxil.dll; 0.45s with adxcompiler.dll-only directory withoutdxil.dll). Bothunsigned_containers_get_the_hash_the_validator_writesandunvalidated_compiles_give_the_validators_containerpass on DXC 1.9.2602.17.cargo test --test e2e -j 8 -- --nocapture: 3 passed, 0 failed, 0 ignored, 0 SKIPPED across all four configurations:-Vd+ XCL signing, 1.92s): logsDXC: compiles skip dxil.dll's validator and are signed by XCL (XCL_DXC_VALIDATE=1 validates them)XCL_DXC_VALIDATE=1(1.90s): opt-out works; validator stays enabledXCL_DIRECT_DXIL=1(1.92s): passes with XCL signing enabled for DXC compilesdxcompiler.dll-only directory withoutdxil.dll(1.93s): logsno dxil.dlland signs in XCL; D3D12 accepts the resulting shadersxcl shaders <pack> --precompile --limit 256(alternating 2x2 runs withXCL_TRANSLATED_CACHE=0,XCL_PSO_DISK_CACHE=0,XCL_PSO_PRELOAD=0, and a freshXCL_DXIL_CACHEper run; 7 compile threads, 4 memory windows, split wave64):-Vd+ XCL signing): 285 compiled, 115 already cached, 0 errors, 6 GS skipped — wall time 6.61 s and 6.70 s (6.6 sreported)XCL_DXC_VALIDATE=1(dxil.dll1.9.2602.17): 285 compiled, 115 already cached, 0 errors, 6 GS skipped — wall time 6.90 s and 6.97 s (6.8 sand6.9 sreported).dxiloutputs on DXC 1.9.2602.17: 285/285 byte-for-byte identical (0mismatches,0missing on either side), with a consistent ~4% wall-clock speedup on this 7-thread slice.Code review
1d027e5resolved the earlier merge conflict cleanly and merges cleanly with currentmain(568e7db).dxc.rs,host.rs,shaders.rs,README.md):WITHOUT_VALIDATORstays off in tests and diagnostic CLI sweeps (--compile,--measure-pso), enables only inhost_mainandxcl shaders --precompile, honorsXCL_DXC_VALIDATE=1, leavestoolchain_identity()intact for disk cache compatibility, andsign()only populates zeroedDXBChashes.Not tested
XCL_HEAP_WINDOWS=1), retail titlescripts/smoke.ps1/ world-load runs, Wine / vkd3d-proton, andXCL_SAMPLE_*tests.AI use
--precompilebyte-identity and timing checks, and wrote/audited this report.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:37:44Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
mainincrates/xcl/src/gpu/recomp/pso.rs— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by chippy01 on 2026-11-24T20:57:14Z.
@DavidM1911 yep doing it as soon as i have time.
Imported from ivall/xcl. Originally posted by chippy01 on 2026-11-25T09:42:09Z.
@DavidM1911 No more merge conflict if you want to test
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:49:19Z.
Diff audit on
b6f4f75(dxc.rs,host.rs,shaders.rs,README.md) looks clean,Build and test+PR descriptionare green, and RTX 3070 Ti + RTX 3090 verification is thorough (285/285 byte-for-byte DXIL parity with DXC-Vd+ XCLcontainer::hash).Only item needed before merge is an AMD (and/or Intel) verification pass on
b6f4f75.Imported from ivall/xcl. Originally posted by chippy01 on 2026-11-25T15:00:28Z.
Thanks for the audit. I have no AMD or Intel card, so those stay under Not tested. The driver gets the same bytes it gets on
main: XCL's digest matcheddxil.dll's signature on 253/253 programs here (DXC 1.8) and 285/285 in MatyEjsr's run (DXC 1.9). A run on AMD or Intel from anyone is welcome.Since your audit the PR was rebased twice, onto
main06c9f55now (head80fb8a4). Its added and removed lines are the same as inb6f4f75; only the code around them onmainchanged.Imported from ivall/xcl. Originally posted by chippy01 on 2026-11-25T15:00:34Z.
@DavidM1911 Rebased again, onto
main06c9f55(head80fb8a4): no conflict, if you still want to test it.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:29:05Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by rgroenewoudt on 2026-11-26T19:21:23Z.
AMD Windows test of head
80fb8a4(on its basemain06c9f55, not rebased; the PR conflicts with currentmain).Tested
stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); debug build.cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4: 1265 passed, 2 failed, 46 ignored.unsigned_containers_get_the_hash_the_validator_writes,unvalidated_compiles_give_the_validators_container(DXC-Vd+ XCL's digest gives the same container asdxil.dll, CS and PS, on this DXC).fuzz_validate_and_gpu_1(seed 722: res[30] = 0x1, CPU 0x7fffffff) andfuzz_validate_and_gpu_3(seed 1599: res[193] = 0x1, CPU 0x0). The base06c9f55without the PR fails the same two seeds the same way (cargo test -p xcl --lib fuzz_validate_and_gpu: 2 passed, 2 failed).heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Not tested
scripts/smoke.ps1with this PR, and the DXC time saved: not measured here.main:compile_hereis nowcompile_whole+compile_linkedthere, so the linked path (IDxcLinker) needs-Vdandsigntoo; not checked.AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:18:06Z.
Triage (#1607) – head
80fb8a4No open or merged PR skips the DXC validator (
-Vd) and signs the container withgpu::dxil::container::hash. #2202 is about the coverage gate's validator sweep and does not change this path.The diff looks correct:
signonly fills a zero hash on aDXBCcontainer, and the test compares it with the validator's output.One cost to weigh: with the validator off, a translator bug that makes invalid DXIL is no longer refused with a message at compile time. It reaches the driver signed, as a PSO failure or a device removal.
XCL_DXC_VALIDATE=1is the only way back.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.