Skip to content

gpu: reuse vertex fetch shaders across readback references - #2255

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
RavenCurseBurg:tests/vertex-fetch-compile-once
Nov 25, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
RavenCurseBurg:tests/vertex-fetch-compile-once

Conversation

@RavenCurseBurg

Copy link
Copy Markdown
Contributor

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 e94e14f, 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.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head a4fba55 (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.

@R0Y00
R0Y00 merged commit d45d091 into R0Y00:main Nov 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants