gpu: measure default and -Od mesh pipeline creation across adapters #836

Merged
alvaroolt merged 2 commits from upstream-pr/842 into main 2026-11-23 12:04:22 +00:00
alvaroolt commented 2026-11-23 11:37:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by alvaroolt on 2026-11-23T11:37:39Z.


Change

Adds a cross-adapter measurement of default and -Od mesh shader DXIL for #810, using a source-built mesh shader with a known draw.

  • tools/mesh_od_pipeline.py generates a mesh shader in which threads 0-2 emit one triangle covering the 32x32 target. Before writing vertices, every thread runs a generated integer computation on a constant-buffer seed. The vertex depth stays inside the clip volume only when the result equals the value the tool computes in Python. The stress families (chain_N, branches_N, loops_N) grow that computation and keep the expected image.
  • Each variant is compiled twice with the same DXC and target (ms_6_5, default and -Od). Compile time, peak working set and outcome come from the runner in tools/dxc_compile_time.py. Every blob that compiles goes unchanged to offscreen_check <adapter> --mesh-entry, so both blobs share the root signature, pixel shader, pipeline stream and draw.
  • tests/mesh_entry_draw.cpp now prints and flushes mesh_pipeline_ms= around the mesh CreatePipelineState call. That separates pipeline time from process time and places a crash or timeout before or after pipeline creation. The line is printed only on the native mesh path. The existing mesh_* tests pass unchanged in dev and release.
  • Outcomes stay separate: pass, mismatch, unsupported (exit 77), hresult, timeout, crash (NTSTATUS) and error. Timeouts are caller-supplied policy values. The tool has no defaults and changes no watchdog, memory or host stack setting.
  • --seed changes every expected constant and therefore the DXIL, so the first creation in a run misses the driver shader cache.
  • mesh_od_pipeline_{hardware,warp} run control, chain_64, branches_64 and loops_16 with --check.

Refs #810. Apart from importing its runner, this does not change the tool from #801.

Verification

Checks below are from this branch rebased on 527a255; the measurements in the docs were taken on 523d9ac plus the same change. Windows 11 build 26300.9974, Ryzen 7 9800X3D, MSVC 14.52, Windows SDK 10.0.26100, DXC 1.9.2602.17, debug layer unavailable (Graphics Tools not installed).

cmake --preset dev; cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^mesh_od_pipeline_' -V
$env:XBOX2WINDOWS_ADAPTER = 'Radeon'; ctest --preset dev --no-tests=error -R '^mesh_od_pipeline_hardware$' -V
  • mesh_od_pipeline_hardware: passed on NVIDIA GeForce RTX 5080 (10de:2c02, 32.0.16.2124) and on the AMD Radeon iGPU (1002:13c0, 32.0.11034.2).
  • mesh_od_pipeline_warp: passed on WARP (1414:008c, 10.0.26100.9818).
  • No capability skips.
  • Full ctest --preset dev --no-tests=error: 415 passed, 7 skipped and 2 failed out of 424. The two failures are pixel_aot_e64_approx_hardware and pixel_aot_sdwa_unary_hardware on the RTX 5080, already reported in #828. They also fail on main without this change.
  • cmake --build --preset release succeeded, and ctest --preset release --no-tests=error -R '^mesh_' passed 28 of 28.
  • All 24 pure-Python checks from the workflow pass.
  • I did not run the Ubuntu LLVM 15 job. This change does not touch gfx1013 translation.

Negative controls:

  • On every blob that draws the reference, flipping one seed bit and expecting a missing triangle both give Draw reference mismatch (1024 pixels) on all three adapters.
  • --check fails when the renderer prints no mesh_pipeline_ms. With the binary built before this change, every blob reported no mesh_pipeline_ms line from the renderer.
  • During development the wrong_reference input was built with the default seed instead of the run seed, so it passed whenever --seed was not the default. The CTest command now uses a non-default seed. Reverting that fix makes --check --seed 0x5eed0001 exit 1 with control wrong_reference gave pass.

Evidence and follow-up

The measurements and the reproduction command are in the new docs/experiments.md section "Mesh shader -Od pipeline creation across adapters". In summary:

  • RTX 5080: -Od changes loop-variant pipeline time by less than 15 %. Both loops_8192 blobs exceed the 300 s policy at about 11.6 GiB working set.
  • Radeon iGPU: -Od turns the default-optimization timeouts of loops_4096 and loops_8192 into pipelines that draw the reference (17.6 s and 75.2 s).
  • WARP: pipeline creation returns for every blob, but the draw then fails:
    • branches_4096 -Od, loops_4096 and loops_8192 exit with 0xc0000005 or 0xc0000374 after pipeline creation.
    • loops_768 gives a wrong image at both optimization levels. loops_512 and loops_640 match.
    • loops_1024 alternates between a crash and a mismatch across runs.
    • The boundary follows the number of loops rather than the iteration count. The cause is not established.

The shaders are generated by the tool (MIT, this repository) and need no external input. They do not replay archive records. A passing draw establishes the reference image for that seed. It does not establish that default and -Od blobs are equivalent for other inputs.

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.

This change was AI-assisted (Claude Code); I reviewed the diff and the test results. The measurements were run on the hardware listed above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6558406299 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/842). Originally posted by [alvaroolt](https://github.com/alvaroolt) on 2026-11-23T11:37:39Z. --- ## Change Adds a cross-adapter measurement of default and `-Od` mesh shader DXIL for #810, using a source-built mesh shader with a known draw. - `tools/mesh_od_pipeline.py` generates a mesh shader in which threads 0-2 emit one triangle covering the 32x32 target. Before writing vertices, every thread runs a generated integer computation on a constant-buffer seed. The vertex depth stays inside the clip volume only when the result equals the value the tool computes in Python. The stress families (`chain_N`, `branches_N`, `loops_N`) grow that computation and keep the expected image. - Each variant is compiled twice with the same DXC and target (`ms_6_5`, default and `-Od`). Compile time, peak working set and outcome come from the runner in `tools/dxc_compile_time.py`. Every blob that compiles goes unchanged to `offscreen_check <adapter> --mesh-entry`, so both blobs share the root signature, pixel shader, pipeline stream and draw. - `tests/mesh_entry_draw.cpp` now prints and flushes `mesh_pipeline_ms=` around the mesh `CreatePipelineState` call. That separates pipeline time from process time and places a crash or timeout before or after pipeline creation. The line is printed only on the native mesh path. The existing `mesh_*` tests pass unchanged in dev and release. - Outcomes stay separate: `pass`, `mismatch`, `unsupported` (exit 77), `hresult`, `timeout`, `crash` (NTSTATUS) and `error`. Timeouts are caller-supplied policy values. The tool has no defaults and changes no watchdog, memory or host stack setting. - `--seed` changes every expected constant and therefore the DXIL, so the first creation in a run misses the driver shader cache. - `mesh_od_pipeline_{hardware,warp}` run `control`, `chain_64`, `branches_64` and `loops_16` with `--check`. Refs #810. Apart from importing its runner, this does not change the tool from #801. ## Verification Checks below are from this branch rebased on `527a255`; the measurements in the docs were taken on `523d9ac` plus the same change. Windows 11 build 26300.9974, Ryzen 7 9800X3D, MSVC 14.52, Windows SDK 10.0.26100, DXC 1.9.2602.17, debug layer unavailable (Graphics Tools not installed). ```powershell cmake --preset dev; cmake --build --preset dev ctest --preset dev --no-tests=error -R '^mesh_od_pipeline_' -V $env:XBOX2WINDOWS_ADAPTER = 'Radeon'; ctest --preset dev --no-tests=error -R '^mesh_od_pipeline_hardware$' -V ``` - `mesh_od_pipeline_hardware`: passed on NVIDIA GeForce RTX 5080 (`10de:2c02`, 32.0.16.2124) and on the AMD Radeon iGPU (`1002:13c0`, 32.0.11034.2). - `mesh_od_pipeline_warp`: passed on WARP (`1414:008c`, 10.0.26100.9818). - No capability skips. - Full `ctest --preset dev --no-tests=error`: 415 passed, 7 skipped and 2 failed out of 424. The two failures are `pixel_aot_e64_approx_hardware` and `pixel_aot_sdwa_unary_hardware` on the RTX 5080, already reported in #828. They also fail on `main` without this change. - `cmake --build --preset release` succeeded, and `ctest --preset release --no-tests=error -R '^mesh_'` passed 28 of 28. - All 24 pure-Python checks from the workflow pass. - I did not run the Ubuntu LLVM 15 job. This change does not touch gfx1013 translation. Negative controls: - On every blob that draws the reference, flipping one seed bit and expecting a missing triangle both give `Draw reference mismatch` (1024 pixels) on all three adapters. - `--check` fails when the renderer prints no `mesh_pipeline_ms`. With the binary built before this change, every blob reported `no mesh_pipeline_ms line from the renderer`. - During development the `wrong_reference` input was built with the default seed instead of the run seed, so it passed whenever `--seed` was not the default. The CTest command now uses a non-default seed. Reverting that fix makes `--check --seed 0x5eed0001` exit 1 with `control wrong_reference gave pass`. ## Evidence and follow-up The measurements and the reproduction command are in the new `docs/experiments.md` section "Mesh shader -Od pipeline creation across adapters". In summary: - **RTX 5080:** `-Od` changes loop-variant pipeline time by less than 15 %. Both `loops_8192` blobs exceed the 300 s policy at about 11.6 GiB working set. - **Radeon iGPU:** `-Od` turns the default-optimization timeouts of `loops_4096` and `loops_8192` into pipelines that draw the reference (17.6 s and 75.2 s). - **WARP:** pipeline creation returns for every blob, but the draw then fails: - `branches_4096 -Od`, `loops_4096` and `loops_8192` exit with `0xc0000005` or `0xc0000374` after pipeline creation. - `loops_768` gives a wrong image at both optimization levels. `loops_512` and `loops_640` match. - `loops_1024` alternates between a crash and a mismatch across runs. - The boundary follows the number of loops rather than the iteration count. The cause is not established. The shaders are generated by the tool (MIT, this repository) and need no external input. They do not replay archive records. A passing draw establishes the reference image for that seed. It does not establish that default and `-Od` blobs are equivalent for other inputs. ## 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. This change was AI-assisted (Claude Code); I reviewed the diff and the test results. The measurements were run on the hardware listed above.
upstream-sync closed this pull request 2026-11-24 06:45:02 +00:00
R0Y00 commented 2026-11-24 06:49:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T11:53:08Z.


Thanks for separating DXC time, PSO creation and draw outcomes across the three adapters. I pushed 930905b to make --check return 77 only when every blob compiles and every draw reports missing mesh capability. A compiler failure now remains a failure even if a different blob skips. The CLI also rejects non-finite timeouts. Local synthetic controls covered all-unsupported, unsupported mixed with a compile error or crash, all-pass, and NaN/infinite timeouts. The seed wording now distinguishes varying the DXIL from observing the driver's cache. The measured results are unchanged. The new commit is waiting on CI.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7100211880 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/842#issuecomment-7100211880). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T11:53:08Z. --- Thanks for separating DXC time, PSO creation and draw outcomes across the three adapters. I pushed `930905b` to make `--check` return 77 only when every blob compiles and every draw reports missing mesh capability. A compiler failure now remains a failure even if a different blob skips. The CLI also rejects non-finite timeouts. Local synthetic controls covered all-unsupported, unsupported mixed with a compile error or crash, all-pass, and NaN/infinite timeouts. The seed wording now distinguishes varying the DXIL from observing the driver's cache. The measured results are unchanged. The new commit is waiting on CI.
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!836
No description provided.