gpu: reuse vertex fetch shaders across readback references #2247

Merged
RavenCurseBurg merged 1 commit from upstream-pr/2255 into main 2026-11-25 08:20:26 +00:00
RavenCurseBurg commented 2026-11-25 08:04:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T08:04:01Z.


The vertex fetch suite recompiles a format’s vertex shader and compute readback wrapper for every deliberately incorrect CPU reference. Those runs change only the words in the case file. Compile each normal format once and reuse its compute binary while checking the different references. Each mutated shader is still compiled separately as both VS and CS. The 52 device invocations, mismatch checks and capability skip are retained.

On Windows, starting at e94e14ff, I ran the full entry point with DXC 1.9 on WARP and a physical D3D12 adapter. For every device invocation I compared the SHA-256 of the compiled compute shader and the complete binary case file, in order, along with the exit status and first-word mismatch diagnostic. All 52 records matched between revisions on both adapters: 12 normal successes and 40 expected failures.

Measurement per full suite Before After
DXC invocations 104 42
Device readbacks 52 52
WARP wall time, three runs 12.743 / 12.962 / 12.532 s 8.013 / 8.975 / 8.130 s
Physical adapter wall time, one run 31.722 s 24.843 s

The WARP median fell from 12.743 to 8.130 seconds (36%). Both devices executed the tests. Reproduce with python -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warp and again with hardware. The controls, stream-fetch translation, documentation links, bidi check and git diff --check passed. This test-only change also merges cleanly with #2193 and #2006.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6599987413 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2255). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T08:04:01Z. --- The vertex fetch suite recompiles a format’s vertex shader and compute readback wrapper for every deliberately incorrect CPU reference. Those runs change only the words in the case file. Compile each normal format once and reuse its compute binary while checking the different references. Each mutated shader is still compiled separately as both VS and CS. The 52 device invocations, mismatch checks and capability skip are retained. On Windows, starting at e94e14ff, I ran the full entry point with DXC 1.9 on WARP and a physical D3D12 adapter. For every device invocation I compared the SHA-256 of the compiled compute shader and the complete binary case file, in order, along with the exit status and first-word mismatch diagnostic. All 52 records matched between revisions on both adapters: 12 normal successes and 40 expected failures. | Measurement per full suite | Before | After | | --- | ---: | ---: | | DXC invocations | 104 | 42 | | Device readbacks | 52 | 52 | | WARP wall time, three runs | 12.743 / 12.962 / 12.532 s | 8.013 / 8.975 / 8.130 s | | Physical adapter wall time, one run | 31.722 s | 24.843 s | The WARP median fell from 12.743 to 8.130 seconds (36%). Both devices executed the tests. Reproduce with `python -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warp` and again with `hardware`. The controls, stream-fetch translation, documentation links, bidi check and `git diff --check` passed. This test-only change also merges cleanly with #2193 and #2006.
upstream-sync closed this pull request 2026-11-25 09:04:03 +00:00
tedin7 commented 2026-11-25 09:04:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T08:11:17Z.

Review: COMMENTED


Review of head a4fba55a69 (test-only, tests/startup_vertex_fetch_formats_check.py).

Findings: 0 P1, 0 P2.

  • The change splits the old run() into compile_fetch() and run_reference(), so each format compiles its vertex and compute-wrapper shaders once and reuses the binary for every wrong-reference readback. Only the mutation cases still recompile, which is required because the HLSL differs there.
  • Behaviour is unchanged: stride constant, case layout (337 words), return-code checks (77 skip, 1 mismatch) and the word=N expected= assertion are the same. correct = expected(name) is hoisted and compared with the same values as before.
  • No competing open PR touches this file (checked open PRs mentioning vertex fetch: #2193, #2138, #2006 touch tools/tests for other formats, not this harness).

Commands executed locally:

  • python3 tests/docs_links_check.py -> 428 links OK
  • python3 tests/bidi_controls_check.py -> no bidi controls
  • git diff --check origin/main...HEAD -> clean
  • python3 tests/startup_vertex_fetch_formats_check.py controls -> passed
  • Mutation (controls): changed the alignment assertion threshold > 1 to > 9; the controls check failed as expected, then reverted. The GPU path (readback) cannot run on Linux, so its mutation coverage is the in-test MUTATIONS/WRONG cases, exercised on Win2025.
  • x2w_pipe.py win2025 2255 --scope direct --targets offscreen_check --regex startup_vertex_fetch_formats: Debug and Release /O2 each 100% passed (3/3: _warp, _hardware, _controls), [PASS].
  • CI: Build and test on Windows = pass, Linux Python checks = pass.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6053935560 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2255#pullrequestreview-6053935560). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T08:11:17Z. **Review:** COMMENTED --- Review of head a4fba55a698463da0039a1e8352d29ebaddb25ad (test-only, tests/startup_vertex_fetch_formats_check.py). Findings: 0 P1, 0 P2. - The change splits the old run() into compile_fetch() and run_reference(), so each format compiles its vertex and compute-wrapper shaders once and reuses the binary for every wrong-reference readback. Only the mutation cases still recompile, which is required because the HLSL differs there. - Behaviour is unchanged: stride constant, case layout (337 words), return-code checks (77 skip, 1 mismatch) and the `word=N expected=` assertion are the same. `correct = expected(name)` is hoisted and compared with the same values as before. - No competing open PR touches this file (checked open PRs mentioning vertex fetch: #2193, #2138, #2006 touch tools/tests for other formats, not this harness). Commands executed locally: - `python3 tests/docs_links_check.py` -> 428 links OK - `python3 tests/bidi_controls_check.py` -> no bidi controls - `git diff --check origin/main...HEAD` -> clean - `python3 tests/startup_vertex_fetch_formats_check.py controls` -> passed - Mutation (controls): changed the alignment assertion threshold `> 1` to `> 9`; the controls check failed as expected, then reverted. The GPU path (readback) cannot run on Linux, so its mutation coverage is the in-test MUTATIONS/WRONG cases, exercised on Win2025. - `x2w_pipe.py win2025 2255 --scope direct --targets offscreen_check --regex startup_vertex_fetch_formats`: Debug and Release /O2 each 100% passed (3/3: _warp, _hardware, _controls), [PASS]. - CI: Build and test on Windows = pass, Linux Python checks = pass. AI-assisted; commands listed were executed locally.
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!2247
No description provided.