Shaders: DXC compiles skip dxil.dll's validator and XCL signs the DXIL #1618
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1618
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@chippy01 on GitHub · 2026-11-24 18:17 UTC · original
chippy01:dxc-bypass-hash→main· +103 −6 · 4 files · 1 commits · openPart 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
@DavidM1911 on GitHub · 2026-11-24 20:37 UTC · original
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.@chippy01 on GitHub · 2026-11-24 20:57 UTC · original
@DavidM1911 yep doing it as soon as i have time.
@chippy01 on GitHub · 2026-11-25 09:42 UTC · original
@DavidM1911 No more merge conflict if you want to test
@MatyEjsr on GitHub · 2026-11-24 20:12 UTC · original · edited 2026-11-26 12:30 UTC
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.@raylitebull on GitHub · 2026-11-25 10:49 UTC · original
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.@chippy01 on GitHub · 2026-11-25 15:00 UTC · original
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.@chippy01 on GitHub · 2026-11-25 15:00 UTC · original
@DavidM1911 Rebased again, onto
main06c9f55(head80fb8a4): no conflict, if you still want to test it.@DavidM1911 on GitHub · 2026-11-26 00:29 UTC · original
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.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.