shader: add dxil_retarget_probe_hardware test for GPU signing and dispatch #515

Merged
alexander-src merged 1 commit from upstream-pr/521 into main 2026-11-22 10:02:09 +00:00
alexander-src commented 2026-11-22 08:53:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-22T08:53:24Z.


Change

Adds dxil_retarget_probe_hardware as a follow-up to @roansystemlabs's review note on #346 so contributors running CTest on physical GPUs automatically exercise re-signed dxil-ms-xb2 pipeline creation and live compute dispatch on hardware (matching the repo's _hardware test pattern with SKIP_RETURN_CODE 77).

  • tests/dxil_retarget_check.py: accept an optional 7th positional backend argument (warp or hardware, defaulting to warp so existing dxil_retarget_probe invocations stay unchanged). On hardware, run root_device_probe --compute-pso without --warp-only, check hardware_root/hardware_pso/hardware_shader_model, run offscreen_check hardware --compute-root-file, and exit 77 when root_device_probe exits 5 (no compatible hardware adapter) or offscreen_check exits 77.
  • tests/dxil_retarget_check.py: add pure-Python mock controls verifying _probe_compute_pso maps exit 5 on hardware to skip (None) while propagating exit 5 on warp and non-adapter exit 6 on hardware.
  • CMakeLists.txt, docs/experiments.md: register dxil_retarget_probe_hardware (TIMEOUT 60, SKIP_RETURN_CODE 77) and document the hardware probe alongside dxil_retarget_probe.

Verification

Commit 7558bd2 (Linux host, Python 3.13, no Windows GPU locally):

  • python3 -B tests/dxil_retarget_check.py -> pure-python dxil_retarget controls: ok
  • python3 -B tests/docs_links_check.py -> Checked 10 Markdown files and 102 links.
  • python3 -B tests/bidi_controls_check.py -> Checked 474 tracked source, script and build/CI files: no bidirectional controls.

Windows CI exercises dxil_retarget_controls and dxil_retarget_probe (WARP) in build-and-test; dxil_retarget_probe_hardware is excluded by CI's -E '_hardware$' filter and can be verified on a Windows GPU host with ctest --preset dev --no-tests=error -R '^dxil_retarget_' -V.

Evidence and follow-up

  • Reuses the existing source-built compute_root.cso and CopyBlocks.cso fixtures (MIT license) and the same synthetic dxil-ms-xb2 injection and negative controls as #346.
  • Negative controls check that unsigned (zero-digest) and 1-bit-tampered signed containers fail CreateComputePipelineState on the selected backend, that offscreen_check <backend> --compute-root-file rejects the unsigned container with exit 1 and "Create compute pipeline" in stderr, and that _probe_compute_pso only turns exit 5 on hardware into a capability skip.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: yes.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6540494270 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/521). Originally posted by [alexander-src](https://github.com/alexander-src) on 2026-11-22T08:53:24Z. --- ## Change Adds `dxil_retarget_probe_hardware` as a follow-up to `@roansystemlabs`'s review note on #346 so contributors running CTest on physical GPUs automatically exercise re-signed `dxil-ms-xb2` pipeline creation and live compute dispatch on hardware (matching the repo's `_hardware` test pattern with `SKIP_RETURN_CODE 77`). - `tests/dxil_retarget_check.py`: accept an optional 7th positional backend argument (`warp` or `hardware`, defaulting to `warp` so existing `dxil_retarget_probe` invocations stay unchanged). On `hardware`, run `root_device_probe --compute-pso` without `--warp-only`, check `hardware_root`/`hardware_pso`/`hardware_shader_model`, run `offscreen_check hardware --compute-root-file`, and exit `77` when `root_device_probe` exits `5` (no compatible hardware adapter) or `offscreen_check` exits `77`. - `tests/dxil_retarget_check.py`: add pure-Python mock controls verifying `_probe_compute_pso` maps exit `5` on `hardware` to skip (`None`) while propagating exit `5` on `warp` and non-adapter exit `6` on `hardware`. - `CMakeLists.txt`, `docs/experiments.md`: register `dxil_retarget_probe_hardware` (`TIMEOUT 60`, `SKIP_RETURN_CODE 77`) and document the hardware probe alongside `dxil_retarget_probe`. ## Verification Commit `7558bd2` (Linux host, Python 3.13, no Windows GPU locally): - `python3 -B tests/dxil_retarget_check.py` -> `pure-python dxil_retarget controls: ok` - `python3 -B tests/docs_links_check.py` -> `Checked 10 Markdown files and 102 links.` - `python3 -B tests/bidi_controls_check.py` -> `Checked 474 tracked source, script and build/CI files: no bidirectional controls.` Windows CI exercises `dxil_retarget_controls` and `dxil_retarget_probe` (WARP) in `build-and-test`; `dxil_retarget_probe_hardware` is excluded by CI's `-E '_hardware$'` filter and can be verified on a Windows GPU host with `ctest --preset dev --no-tests=error -R '^dxil_retarget_' -V`. ## Evidence and follow-up - Reuses the existing source-built `compute_root.cso` and `CopyBlocks.cso` fixtures (MIT license) and the same synthetic `dxil-ms-xb2` injection and negative controls as #346. - Negative controls check that unsigned (zero-digest) and 1-bit-tampered signed containers fail `CreateComputePipelineState` on the selected backend, that `offscreen_check <backend> --compute-root-file` rejects the unsigned container with exit `1` and `"Create compute pipeline"` in stderr, and that `_probe_compute_pso` only turns exit `5` on `hardware` into a capability skip. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: yes.
upstream-sync closed this pull request 2026-11-24 06:43:29 +00:00
roansystemlabs commented 2026-11-24 06:48:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-22T09:02:51Z.


Ran dxil_retarget_probe_hardware on a physical GPU, as the verification section asks.

Environment. Windows 11 build 26200.9974, NVIDIA GeForce RTX 3070 (10de:2484, Ampere), driver 32.0.16.2101, D3D12 debug layer enabled. dev preset (Debug, Ninja, MSVC Build Tools 2022, CMake/CTest 3.31.6), Python 3.12.10 with requirements-dev.txt. Tested the PR head 7558bd2 merged locally onto current main (80a5dcc); the merge is clean and main has not touched tests/dxil_retarget_check.py, tools/dxil_retarget.py, tools/root_device_probe.cpp or tests/offscreen_check.cpp since the PR's base.

Result. ctest --preset dev --no-tests=error -R '^dxil_retarget_' -V: 3/3 passed.

fixture compute_root.cso: ... pso=(hardware:unsigned=0x80070057 signed=0x00000000 tampered=0x80070057 dispatch=ok)
fixture CopyBlocks.cso:   ... pso=(hardware:unsigned=0x80070057 signed=0x00000000 tampered=0x80070057)
dxil_retarget_probe_hardware .....   Passed    3.99 sec

The hardware path really runs on the GPU: root_device_probe --compute-pso reports adapter_id 10de:2484 and hardware_shader_model 0x65, so the CopyBlocks.cso PSO checks are not skipped on this adapter. The offscreen_check hardware dispatch prints adapter=NVIDIA GeForce RTX 3070, mismatches=0, debug_errors=0. With --repeat until-fail:10 all three tests passed 10/10. Across all runs the hardware test took 3.6–4.0 s, well under its TIMEOUT 60.

Negative controls. I made two temporary local mutations to the test, then reverted them and checked that the tree matches the PR again:

  • No bit flipped in the "tampered" digest: the test fails on the hardware adapter (hardware_pso 0x00000000 hits the != 0 assertion). So the RTX 3070 driver itself rejects the 1-bit-tampered container, not only WARP.
  • The unsigned container replaced by the signed one in the bad_run dispatch: the test fails (offscreen_check hardware exits 0 with mismatches=0 where exit 1 is expected). So the unsigned-container rejection on hardware is tested for real.

I did not exercise the exit-77 skip path on a machine without a hardware adapter. It is covered only by the PR's mock controls, which pass.

Raw ctest -V logs are available if useful.

AI-assisted: run and prepared with the support of Roan System (AI-assisted development), reviewed before posting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7076896288 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/521#issuecomment-7076896288). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-22T09:02:51Z. --- Ran `dxil_retarget_probe_hardware` on a physical GPU, as the verification section asks. **Environment.** Windows 11 build 26200.9974, NVIDIA GeForce RTX 3070 (`10de:2484`, Ampere), driver 32.0.16.2101, D3D12 debug layer enabled. `dev` preset (Debug, Ninja, MSVC Build Tools 2022, CMake/CTest 3.31.6), Python 3.12.10 with `requirements-dev.txt`. Tested the PR head `7558bd2` merged locally onto current `main` (`80a5dcc`); the merge is clean and `main` has not touched `tests/dxil_retarget_check.py`, `tools/dxil_retarget.py`, `tools/root_device_probe.cpp` or `tests/offscreen_check.cpp` since the PR's base. **Result.** `ctest --preset dev --no-tests=error -R '^dxil_retarget_' -V`: 3/3 passed. ```text fixture compute_root.cso: ... pso=(hardware:unsigned=0x80070057 signed=0x00000000 tampered=0x80070057 dispatch=ok) fixture CopyBlocks.cso: ... pso=(hardware:unsigned=0x80070057 signed=0x00000000 tampered=0x80070057) dxil_retarget_probe_hardware ..... Passed 3.99 sec ``` The hardware path really runs on the GPU: `root_device_probe --compute-pso` reports `adapter_id 10de:2484` and `hardware_shader_model 0x65`, so the `CopyBlocks.cso` PSO checks are not skipped on this adapter. The `offscreen_check hardware` dispatch prints `adapter=NVIDIA GeForce RTX 3070`, `mismatches=0`, `debug_errors=0`. With `--repeat until-fail:10` all three tests passed 10/10. Across all runs the hardware test took 3.6–4.0 s, well under its `TIMEOUT 60`. **Negative controls.** I made two temporary local mutations to the test, then reverted them and checked that the tree matches the PR again: - No bit flipped in the "tampered" digest: the test fails on the hardware adapter (`hardware_pso 0x00000000` hits the `!= 0` assertion). So the RTX 3070 driver itself rejects the 1-bit-tampered container, not only WARP. - The unsigned container replaced by the signed one in the `bad_run` dispatch: the test fails (`offscreen_check hardware` exits 0 with `mismatches=0` where exit 1 is expected). So the unsigned-container rejection on hardware is tested for real. I did not exercise the exit-77 skip path on a machine without a hardware adapter. It is covered only by the PR's mock controls, which pass. Raw `ctest -V` logs are available if useful. AI-assisted: run and prepared with the support of Roan System (AI-assisted development), reviewed before posting.
alexander-src commented 2026-11-24 06:48:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-22T09:08:08Z.


Thanks for verifying this on the RTX 3070 and running both negative-control mutations, @roansystemlabs. Good to confirm the NVIDIA driver itself rejects the 1-bit-tampered container and the unsigned dispatch path on hardware.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7076954493 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/521#issuecomment-7076954493). Originally posted by [alexander-src](https://github.com/alexander-src) on 2026-11-22T09:08:08Z. --- Thanks for verifying this on the RTX 3070 and running both negative-control mutations, @roansystemlabs. Good to confirm the NVIDIA driver itself rejects the 1-bit-tampered container and the unsigned dispatch path on hardware.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!515
No description provided.