gpu: reuse vertex fetch shaders across readback references #2255

Manually merged
github merged 1 commit from gh-pr/2255/head into gh-pr/2255/base 2026-11-27 00:10:12 +00:00
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 08:04 UTC · original
RavenCurseBurg:tests/vertex-fetch-compile-once → main · +18 −11 · 1 files · 1 commits · merged 2026-11-25 08:20 UTC

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.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 08:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2255) `RavenCurseBurg:tests/vertex-fetch-compile-once` → `main` · +18 −11 · 1 files · 1 commits · merged 2026-11-25 08:20 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:10:10 +00:00
github manually merged commit a4fba55a69 into gh-pr/2255/base 2026-11-27 00:10:12 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 08:11 UTC · original · reviewed

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.

**@⁠tedin7** on GitHub · 2026-11-25 08:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2255#pullrequestreview-6053935560) · **reviewed** 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.