shader: re-sign retargeted DXIL containers and verify compute PSO creation #341
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/346"
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 alexander-src on 2026-11-21T22:51:35Z.
Change
Implements DXBC container re-signing and desktop
CreateComputePipelineStateverification for retargeteddxil-ms-xb2shaders, closing the separate-work item noted indocs/experiments.md("Retargeting dxil-ms-xb2 modules to desktop DXIL").Previously,
tools/dxil_retarget.pyzeroed the 16-byte DXBC header digest after rewritingdxil-ms-xb2bitcode and clearing XboxRTS0flags (0x03000000), so retargeted containers could passdxil.dllvalidation without being loadable into desktopCreateComputePipelineState.tools/root_probe.cpp: add--sign, which validates and signs a DXBC container in place throughdxil.dll(IDxcValidator::ValidatewithDxcValidatorFlags_InPlaceEdit) and writes the signed container to binary stdout (or diagnostics to stderr with exit code 5 on failure).tools/root_device_probe.cpp: add--compute-pso(combinable with--warp-only), reporting each adapter's shader model plusCreateRootSignatureandCreateComputePipelineStateHRESULTs for a DXBC container on stdin.tools/dxil_retarget.py: addsign_container,check_compute_pso, and CLI flags--sign,--pso-probe, and--warp-onlyin both single-file and--pemodes.tests/desktop_gpu.h,tests/compute_check.cpp,tests/offscreen_check.cpp: add--compute-root-file <path>(check_compute_file) to run an externalcompute_root.csobinary throughrun_computewith CPU readback and D3D12 debug-layer checks.tests/dxil_retarget_check.py,CMakeLists.txt,docs/experiments.md: extenddxil_retarget_controlsanddxil_retarget_probewith signing,CreateComputePipelineState, and WARP compute dispatch controls and update the documentation.Verification
Commit
9350177(Linux host, Python 3.13, no Windows SDK / D3D12 runtime locally):python3 -B tests/dxil_retarget_check.py->pure-python dxil_retarget controls: ok(coverssign_container,check_compute_pso, and CLI flag rejection controls).python3 -B tests/shader_probe_check.py-> all 9 controls passed.python3 -B tests/docs_links_check.py->Checked 10 Markdown files and 69 links.python3 -B tests/bidi_controls_check.py->Checked 286 tracked source, script and build/CI files: no bidirectional controls.Windows build,
root_probe --sign, WARPCreateComputePipelineState(root_device_probe --compute-pso --warp-only), and live WARP compute dispatch (offscreen_check warp --compute-root-file) could not be executed locally on this Linux host and are verified by thebuild-and-testWindows CI job (dxil_retarget_probe).Evidence and follow-up
tests/compute.hlsl->compute_root.cso,tests/buffer_ops.hlsl->CopyBlocks.cso, MIT license) and synthetically injected withdxil-ms-xb2,xbox.compiler.options,BitcodeOffset=112, andRTS0flags0x03000000.root_probe --signrejects invalid syntheticxb2,dxil-ms, and--keep-root-flagscontainers without writing stdout bytes.CreateComputePipelineStateon WARP rejects unsigned (zero-digest) retargeted containers and 1-bit-tampered signed containers.offscreen_check warp --compute-root-filerejects the unsigned retargetedcompute_root.csoand passes withmismatches=0for the re-signed container.CopyBlocks.cso(cs_6_5), the WARP PSO check inspectswarp_shader_modeland skips on WARP adapters below SM 6.5 (such as Windows 10 in-box WARP 6.2), matching the repo's existingcs_6_5test policy.XboxBvhBuilder.dll: runningtools/dxil_retarget.py --pe ... --only-without-xbox-calls --sign --probe root_probe.exe --pso-probe root_device_probe.execan now test live desktopCreateComputePipelineStateacross the 9 modules withoutxbox.*calls.Checklist
AI-assisted: yes.
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-21T23:22:15Z.
Windows run of #346 on real hardware, since the description notes it could only be checked on Linux plus the WARP CI job.
Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3070 (
10de:2484, driver 32.0.16.2101, SM 6.5 reported), WARP 10.0.26100.9818, MSVC 19.44.35230 (VS Build Tools 2022), Windows SDK 10.0.26100.0 DXC/dxil.dll, Python 3.12. D3D12 debug layer not installed on this PC.Tested head:
e2d9f02ed678cc135d52d69469ac492c687eebf3(as pushed, baseb860dd5).Full suite: 146/146 passed, 3 capability skips (
bvh_wave64_hardware,bvh_wave64_warp,wave_shuffle_warp, the same asmainbc24dfdon this PC). No build warnings.Hardware path (not covered by the ctest, which passes
--warp-only). I rebuilt the same synthetic xb2 containers with the test's own helpers (_inject_xb2_into_container,retarget_container,sign_container) and ranroot_device_probe --compute-psowithout--warp-only, thenoffscreen_check hardware --compute-root-file:CreateRootSignatureCreateComputePipelineStatecompute_rootunsigned (zero digest)0x000000000x800700570x80070057compute_rootre-signed0x000000000x000000000x00000000compute_root1-bit tampered digest0x000000000x800700570x80070057CopyBlocksunsigned0x000000000x800700570x80070057CopyBlocksre-signed0x000000000x000000000x00000000CopyBlocks1-bit tampered digest0x000000000x800700570x80070057So the signing behaves the same on an NVIDIA driver as on WARP: for both fixtures only the re-signed container creates a PSO, and the re-signed
compute_rootdispatches with the CPU-checked readback matching (CopyBlockswas checked up to PSO creation only). No problems found.Optional: a
dxil_retarget_probe_hardwarevariant (without--warp-only, skipping with 77 when there is no hardware adapter) would keep this covered on contributors' GPUs, in line with the other_warp/_hardwaretest pairs.AI-assisted: run and prepared with the support of Roan System.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-22T02:24:08Z.
Windows 10 GTX 1060 and in-box WARP results at
e2d9f02.Tested on Windows 10 22H2 build 19045.6456 with a GTX 1060 6 GB (10de:1c03, driver 32.0.15.6094, SM 6.5) and in-box WARP 10.0.19041.5794 (SM 6.2). Release build with MSVC 19.44.35230, Windows SDK 10.0.26100.0 and dxil.dll 1.9.2602.17.
ctest --test-dir out/build/inbox --no-tests=error -V -R "^dxil_retarget_(controls|probe)$". I also ranroot_device_probe --compute-psowith both adapters enabled.compute_rootfailed pipeline creation on both adapters with 0x80070057. After signing,offscreen_check <hardware|warp> --compute-root-filepassed on both with 257 output words, 63 guard words and zero mismatches. The enabled D3D12 debug layer reported zero errors or warnings on the signed dispatches.CopyBlockscreated a pipeline on the GTX 1060. In-box WARP rejected even the original SM 6.5 compiler output, consistent with its SM 6.2 limit.I also tried the documented local DLL follow-up with the matching SHA-256. I ran
dxil_retarget.py --pe <local-dll> --only-without-xbox-calls --probe <root_probe> --pso-probe <root_device_probe>with and without--sign. All nine selected SM 6.5 shaders passed container and module validation. On the GTX 1060 all nine created compute pipelines after signing, and all nine unsigned controls returned 0x80070057. In-box WARP accepted their root signatures and rejected pipeline creation. The DLL was read as data and the check ended at pipeline creation.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-22T03:11:27Z.
Follow-up dispatch check at
e2d9f02on the GTX 1060 6 GB (driver 32.0.15.6094, Shader Model 6.5, Windows 10 22H2 build 19045.6456). I checked the documented span-copy operation from the hash-matched local DLL. The re-signed shader uses the same root signature as the source-built CopySpan fixture.I used the four span cases from bvh_buffer_ops_hardware with disjoint buffers, one or two groups, and source length parameters 0 and 16 (64 and 1,088 bytes). For the package shader, I set the reset constant to 0 and 1 in separate runs and omitted the fixture's second dispatch in both. Each variant passed 10/10 runs with all 384 readback words per case matching the CPU reference and zero D3D12 debug errors or warnings.
The source-built control passed with the ordered ResetBounds dispatch. With that dispatch removed, all four cases failed at word 4, expected 0x7f7fffff and observed 0x000272b7. That control confirms the fixture can detect a missing reset. The result covers the tested buffer layout and dispatch settings on this adapter.
AI-assisted.