gpu: record forced-wave pipeline creation at startup #1154

Merged
roansystemlabs merged 1 commit from upstream-pr/1161 into main 2026-11-24 02:41:13 +00:00
roansystemlabs commented 2026-11-24 02:04:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T02:04:48Z.


Change

Add a CRT-free startup fixture for forced-wave compute pipelines (Refs #870).

  • tests/wave_startup_exe.cpp is built once per shader variant and adapter (/ENTRY:fixture_entry /NODEFAULTLIB). From its entry point it enables the debug layer when installed, creates a device on WARP or the first hardware adapter (XBOX2WINDOWS_ADAPTER filters), reads D3D12_OPTIONS1.WaveLaneCountMin/Max and calls CreateComputePipelineState once.
  • tests/wave_startup.hlsl compiles as cs_6_6 with no attribute, [WaveSize(4)] or [WaveSize(32)]; the attribute is the only difference.
  • The EXE prints the exact HRESULT and every debug-layer message stored by the call. When creation succeeds it dispatches one 64-thread group and reads back WaveGetLaneCount() from every invocation.
  • Exit 0 when the outcome matches the reported range; 77 when a forced width is outside the range and the pipeline is refused; 1 when creation contradicts the range. XBOX2WINDOWS_DEBUG_LAYER=off repeats the attempt without the layer.
  • Six CTests wave_startup_{0,4,32}_{warp,hardware}. No existing test changes.

Verification

Windows 11 build 26200.9974, MSVC 19.44.35230, DXC from Windows SDK 10.0.26100, dev and release, three runs each with the debug layer and three with XBOX2WINDOWS_DEBUG_LAYER=off. Each run: 4 passed, 2 skipped (77), 0 failed. Results were identical across runs.

Adapter Lane range No attribute [WaveSize(4)] [WaveSize(32)]
WARP (in-box, 10.0.26100.9818) 4..4 S_OK, readback 4 S_OK, readback 4 0x80070057 (E_INVALIDARG), skip 77
NVIDIA GeForce RTX 3070 (10de/2484, 32.0.16.2101) 32..32 S_OK, readback 32 0x80070057 (E_INVALIDARG), skip 77 S_OK, readback 32
  • Each refusal stores exactly one debug-layer message, D3D12 error 622:
    ID3D12Device::CreateComputeShader: Shader wants wave lane count of 32 but maximum wave lane count for device is 4. To check for support, check device caps via the CheckFeatureSupport() API (WARP), and the mirrored wants wave lane count of 4 but minimum wave lane count for device is 32 (RTX 3070). Successful creation and dispatch store none.
  • Without the debug layer the refusals return the same 0x80070057.
  • Every readback had 64 invocations agreeing on one width.
  • Negative controls, local builds only: an EXE expecting width 32 around the unforced shader created a pipeline on WARP that its 4..4 range excludes, and an EXE expecting 32 around the [WaveSize(4)] shader was refused on the RTX 3070 inside its 32..32 range. Both exited 1.
  • Comparison, #1132 unchanged at 1f172a06, same machine, dev and release, three runs each: shader_wave_hardware native 32 and shader_wave32_hardware forced 32 passed (sum_ones=32, sum_lanes=496, debug errors 0); shader_wave_warp native 4 passed (sum_ones=4, sum_lanes=6); shader_wave32_warp and both wave64 tests skipped 77. #1132 skips on WARP from the reported range before creating the pipeline; this fixture makes the creation call and records its result.
  • Fresh clone of the branch, release: 4 passed, 2 skipped.
  • docs_links_check.py, form_coverage_check.py, bidi_controls_check.py: passed. git diff --check origin/main...HEAD: clean.
  • All runs used the Windows loader only. Not run: this EXE under pe_map, AMD or Intel hardware, the app-local WARP or Agility SDK runtimes, [WaveSize(64)], full CTest.

Evidence and follow-up

  • The in-box WARP refuses a forced-wave32 pipeline at creation, with or without the debug layer, with E_INVALIDARG and debug error 622, as a capability limit of its 4..4 range. The fixture uses a source-built shader, no translated code and no title data.
  • The desktop readback of wave operations at native and forced widths stays with #1132; this fixture answers only whether creation is refused, with which HRESULT and message.
  • docs/experiments.md records the fixture, the table and the messages.
  • No game files, dumps, shader bytes from a title, paths or secrets are included.

Checklist

  • One reviewable behavior: the forced-wave pipeline creation outcome.
  • Positive widths and named capability skips; contradictions fail.
  • WARP and hardware results with adapter, driver, Windows build and debug-layer state.
  • Negative controls caught.
  • No existing tests changed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572942808 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1161). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T02:04:48Z. --- ## Change Add a CRT-free startup fixture for forced-wave compute pipelines (Refs #870). - `tests/wave_startup_exe.cpp` is built once per shader variant and adapter (`/ENTRY:fixture_entry /NODEFAULTLIB`). From its entry point it enables the debug layer when installed, creates a device on WARP or the first hardware adapter (`XBOX2WINDOWS_ADAPTER` filters), reads `D3D12_OPTIONS1.WaveLaneCountMin/Max` and calls `CreateComputePipelineState` once. - `tests/wave_startup.hlsl` compiles as `cs_6_6` with no attribute, `[WaveSize(4)]` or `[WaveSize(32)]`; the attribute is the only difference. - The EXE prints the exact HRESULT and every debug-layer message stored by the call. When creation succeeds it dispatches one 64-thread group and reads back `WaveGetLaneCount()` from every invocation. - Exit 0 when the outcome matches the reported range; 77 when a forced width is outside the range and the pipeline is refused; 1 when creation contradicts the range. `XBOX2WINDOWS_DEBUG_LAYER=off` repeats the attempt without the layer. - Six CTests `wave_startup_{0,4,32}_{warp,hardware}`. No existing test changes. ## Verification Windows 11 build 26200.9974, MSVC 19.44.35230, DXC from Windows SDK 10.0.26100, `dev` and `release`, three runs each with the debug layer and three with `XBOX2WINDOWS_DEBUG_LAYER=off`. Each run: 4 passed, 2 skipped (77), 0 failed. Results were identical across runs. | Adapter | Lane range | No attribute | `[WaveSize(4)]` | `[WaveSize(32)]` | | --- | --- | --- | --- | --- | | WARP (in-box, 10.0.26100.9818) | 4..4 | `S_OK`, readback 4 | `S_OK`, readback 4 | `0x80070057` (`E_INVALIDARG`), skip 77 | | NVIDIA GeForce RTX 3070 (10de/2484, 32.0.16.2101) | 32..32 | `S_OK`, readback 32 | `0x80070057` (`E_INVALIDARG`), skip 77 | `S_OK`, readback 32 | - Each refusal stores exactly one debug-layer message, D3D12 error 622: `ID3D12Device::CreateComputeShader: Shader wants wave lane count of 32 but maximum wave lane count for device is 4. To check for support, check device caps via the CheckFeatureSupport() API` (WARP), and the mirrored `wants wave lane count of 4 but minimum wave lane count for device is 32` (RTX 3070). Successful creation and dispatch store none. - Without the debug layer the refusals return the same `0x80070057`. - Every readback had 64 invocations agreeing on one width. - Negative controls, local builds only: an EXE expecting width 32 around the unforced shader created a pipeline on WARP that its 4..4 range excludes, and an EXE expecting 32 around the `[WaveSize(4)]` shader was refused on the RTX 3070 inside its 32..32 range. Both exited 1. - Comparison, #1132 unchanged at `1f172a06`, same machine, `dev` and `release`, three runs each: `shader_wave_hardware` native 32 and `shader_wave32_hardware` forced 32 passed (`sum_ones=32`, `sum_lanes=496`, debug errors 0); `shader_wave_warp` native 4 passed (`sum_ones=4`, `sum_lanes=6`); `shader_wave32_warp` and both wave64 tests skipped 77. #1132 skips on WARP from the reported range before creating the pipeline; this fixture makes the creation call and records its result. - Fresh clone of the branch, `release`: 4 passed, 2 skipped. - `docs_links_check.py`, `form_coverage_check.py`, `bidi_controls_check.py`: passed. `git diff --check origin/main...HEAD`: clean. - All runs used the Windows loader only. Not run: this EXE under `pe_map`, AMD or Intel hardware, the app-local WARP or Agility SDK runtimes, `[WaveSize(64)]`, full CTest. ## Evidence and follow-up - The in-box WARP refuses a forced-wave32 pipeline at creation, with or without the debug layer, with `E_INVALIDARG` and debug error 622, as a capability limit of its 4..4 range. The fixture uses a source-built shader, no translated code and no title data. - The desktop readback of wave operations at native and forced widths stays with #1132; this fixture answers only whether creation is refused, with which HRESULT and message. - `docs/experiments.md` records the fixture, the table and the messages. - No game files, dumps, shader bytes from a title, paths or secrets are included. ## Checklist - [x] One reviewable behavior: the forced-wave pipeline creation outcome. - [x] Positive widths and named capability skips; contradictions fail. - [x] WARP and hardware results with adapter, driver, Windows build and debug-layer state. - [x] Negative controls caught. - [x] No existing tests changed. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:46:36 +00:00
tedin7 commented 2026-11-24 06:46:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:15:38Z.

Review: COMMENTED


Reviewed at 2ae62ad27d59f18dfb5e143631dfd29727c8b403.

  • Code & structure: tests/wave_startup_exe.cpp and tests/wave_startup.hlsl cleanly isolate a CRT-free (/ENTRY:fixture_entry /NODEFAULTLIB) startup probe per width (0, 4, 32) and adapter (warp, hardware). Turning off /RTC1, providing _RTC_InitBase/_RTC_Shutdown/memset, and keeping buffers static avoids CRT/stack-probe dependencies, and run() checks D3D12_OPTIONS1 (WaveOps, WaveLaneCountMin..Max) + SM 6.6, drains ID3D12InfoQueue, and exits 77 only when refused outside reported capabilities. (Minor: the early return on CreateRootSignature failure skips COM Release() calls, though ExitProcess follows immediately.)
  • Linux checks run: python3 -B tests/docs_links_check.py (15 files, 254 links), python3 -B tests/bidi_controls_check.py (945 files), python3 -B tests/gpu_report_format_check.py (10 tests), and python3 -B tests/xgameruntime_table_check.py — all passed.
  • CI / Windows: gh pr checks 1161 currently shows all 4 Windows checks pending; Windows MSVC build, WARP, and hardware execution rely on CI.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032632885 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1161#pullrequestreview-6032632885). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:15:38Z. **Review:** COMMENTED --- Reviewed at `2ae62ad27d59f18dfb5e143631dfd29727c8b403`. - **Code & structure**: `tests/wave_startup_exe.cpp` and `tests/wave_startup.hlsl` cleanly isolate a CRT-free (`/ENTRY:fixture_entry /NODEFAULTLIB`) startup probe per width (`0`, `4`, `32`) and adapter (`warp`, `hardware`). Turning off `/RTC1`, providing `_RTC_InitBase`/`_RTC_Shutdown`/`memset`, and keeping buffers static avoids CRT/stack-probe dependencies, and `run()` checks `D3D12_OPTIONS1` (`WaveOps`, `WaveLaneCountMin..Max`) + SM 6.6, drains `ID3D12InfoQueue`, and exits 77 only when refused outside reported capabilities. (Minor: the early return on `CreateRootSignature` failure skips COM `Release()` calls, though `ExitProcess` follows immediately.) - **Linux checks run**: `python3 -B tests/docs_links_check.py` (15 files, 254 links), `python3 -B tests/bidi_controls_check.py` (945 files), `python3 -B tests/gpu_report_format_check.py` (10 tests), and `python3 -B tests/xgameruntime_table_check.py` — all passed. - **CI / Windows**: `gh pr checks 1161` currently shows all 4 Windows checks pending; Windows MSVC build, WARP, and hardware execution rely on CI.
ChazY11 commented 2026-11-24 06:50:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T02:09:38Z.


Independent verification on three backends, including an Intel Xe2 adapter with an 8-wide minimum

Reviewed 2ae62ad2 (your head, based on edee8d07; mergeable against current main). Independent reviewer, not the
author; I did not touch the branch.

Environment: Windows 11 build 26300.9974, x64, Core Ultra 9 285H; MSVC 14.44.35207, Windows SDK 10.0.26100,
DXC 1.8.2502.11, CMake+Ninja, Python 3.12.10. Debug layer enabled by the fixture itself.

cmake --preset dev
cmake --build --preset dev                       # no FAILED target
ctest --preset dev --no-tests=error -R 'wave_startup'
adapter _0_hardware _4_hardware _32_hardware WARP variants
NVIDIA RTX 5080 Laptop (32.0.15.8142) pass skip pass _0 _4 pass, _32 skip
Intel Arc 140T (32.0.101.8132) pass skip pass _0 _4 pass, _32 skip
Microsoft Basic Render Driver (10.0.26100.9818) — (WARP rows above)

6 of 6 cases behave as pass or a named skip on both adapters, with no unexpected debug messages.

What the Arc reports, and why the skip is the right answer there

forced_wave_size=0 (no attribute)  wave_ops=1 wave_lane_count_min=8 wave_lane_count_max=32 highest_shader_model=0x66
  readback lane_count=32 invocations=64 mismatches=0

forced_wave_size=32                readback lane_count=32 invocations=64 mismatches=0

forced_wave_size=4                 debug_message stage=create_pipeline severity=error id=622:
  ID3D12Device::CreateComputeShader: Shader wants wave lane count of 4 but minimum wave lane count
  for device is 8. To check for support, check device caps via the CheckFeatureSupport() API
  skip: wave startup variant requires SM 6.6, WaveOps and a wave lane range containing the forced width

That is a clean capability skip: the fixture keeps the D3D12 message and the device capability that explains it,
rather than failing. On an adapter whose range is 8..32, a [WaveSize(4)] pipeline cannot exist, and the test says so
in one line. Worth keeping exactly as it is.

One observation that supports the design

This fixture prints the device range (wave_lane_count_min/max) and the observed lane count separately, and
its oracle does not assume a width. That is exactly the pairing I have been arguing for in #768: on this same adapter,
a non-forced module's reported lane count is not stable across processes (a probe of mine saw 16 on the first
dispatch of a freshly compiled module and 32 on later ones), while a [WaveSize(32)] module here always reports 32.
Having both numbers in the output is what makes that visible instead of mysterious, so if you ever extend this fixture
to repeat a dispatch, please keep both fields per dispatch.

Verdict

Verified, no objection. Skips are separated from passes as the repository asks, the WaveSize attribute is confirmed
in the compiled DXIL, and the printed HRESULT and debug message make a rejected variant diagnosable without the
console. Happy to re-run on the same machine after a rebase.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119815187 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1161#issuecomment-7119815187). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T02:09:38Z. --- ## Independent verification on three backends, including an Intel Xe2 adapter with an 8-wide minimum Reviewed `2ae62ad2` (your head, based on `edee8d07`; mergeable against current `main`). Independent reviewer, not the author; I did not touch the branch. Environment: Windows 11 build 26300.9974, x64, Core Ultra 9 285H; MSVC 14.44.35207, Windows SDK 10.0.26100, DXC 1.8.2502.11, CMake+Ninja, Python 3.12.10. Debug layer enabled by the fixture itself. ```powershell cmake --preset dev cmake --build --preset dev # no FAILED target ctest --preset dev --no-tests=error -R 'wave_startup' ``` | adapter | `_0_hardware` | `_4_hardware` | `_32_hardware` | WARP variants | |---|---|---|---|---| | NVIDIA RTX 5080 Laptop (32.0.15.8142) | pass | skip | pass | `_0` `_4` pass, `_32` skip | | Intel Arc 140T (32.0.101.8132) | pass | **skip** | pass | `_0` `_4` pass, `_32` skip | | Microsoft Basic Render Driver (10.0.26100.9818) | — (WARP rows above) | | | | 6 of 6 cases behave as pass or a named skip on both adapters, with no unexpected debug messages. ### What the Arc reports, and why the skip is the right answer there ```text forced_wave_size=0 (no attribute) wave_ops=1 wave_lane_count_min=8 wave_lane_count_max=32 highest_shader_model=0x66 readback lane_count=32 invocations=64 mismatches=0 forced_wave_size=32 readback lane_count=32 invocations=64 mismatches=0 forced_wave_size=4 debug_message stage=create_pipeline severity=error id=622: ID3D12Device::CreateComputeShader: Shader wants wave lane count of 4 but minimum wave lane count for device is 8. To check for support, check device caps via the CheckFeatureSupport() API skip: wave startup variant requires SM 6.6, WaveOps and a wave lane range containing the forced width ``` That is a clean capability skip: the fixture keeps the D3D12 message and the device capability that explains it, rather than failing. On an adapter whose range is 8..32, a `[WaveSize(4)]` pipeline cannot exist, and the test says so in one line. Worth keeping exactly as it is. ### One observation that supports the design This fixture prints the **device** range (`wave_lane_count_min/max`) and the **observed** lane count separately, and its oracle does not assume a width. That is exactly the pairing I have been arguing for in #768: on this same adapter, a non-forced module's reported lane count is not stable across processes (a probe of mine saw 16 on the first dispatch of a freshly compiled module and 32 on later ones), while a `[WaveSize(32)]` module here always reports 32. Having both numbers in the output is what makes that visible instead of mysterious, so if you ever extend this fixture to repeat a dispatch, please keep both fields per dispatch. ### Verdict Verified, no objection. Skips are separated from passes as the repository asks, the `WaveSize` attribute is confirmed in the compiled DXIL, and the printed HRESULT and debug message make a rejected variant diagnosable without the console. Happy to re-run on the same machine after a rebase.
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!1154
No description provided.