Shader tests: one command queue per test host (78 s to 16 s on a GPU) #11

Open
God489 wants to merge 1 commit from upstream-pr/11 into main
God489 commented 2026-11-25 02:54:55 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by God489 on 2026-11-25T02:41:04Z.


Host::dispatch and Host::draw (test builds only) created a new D3D12 command queue on every call. On a hardware adapter that is most of the cost of a GPU test case. On an RTX 3050 a one-instruction dispatch took about 28 ms; on WARP it takes 0.4 ms.

The queue is now made once per Host, on first use (a test-only OnceCell field). Nothing changes outside cfg(test). The allocator, list, resources and fence are still made per call, and each call still waits for its own fence, so the cases stay independent.

Measured on Windows 11 with an RTX 3050:

before after
200 dispatches of one shader, hardware 5.65 s 0.41 s
200 dispatches of one shader, WARP 0.09 s 0.05 s
cargo test -p victory-shader --lib (210 tests) 78.3 s 16.0 s

Hosted CI runners have no hardware adapter, so CI time barely changes. Anyone running the tests on a GPU waits a fraction as long.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Zettrox/ztrx:issue:6595951346 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/11). Originally posted by [God489](https://github.com/God489) on 2026-11-25T02:41:04Z. --- `Host::dispatch` and `Host::draw` (test builds only) created a new D3D12 command queue on every call. On a hardware adapter that is most of the cost of a GPU test case. On an RTX 3050 a one-instruction dispatch took about 28 ms; on WARP it takes 0.4 ms. The queue is now made once per `Host`, on first use (a test-only `OnceCell` field). Nothing changes outside `cfg(test)`. The allocator, list, resources and fence are still made per call, and each call still waits for its own fence, so the cases stay independent. Measured on Windows 11 with an RTX 3050: | | before | after | |---|---|---| | 200 dispatches of one shader, hardware | 5.65 s | 0.41 s | | 200 dispatches of one shader, WARP | 0.09 s | 0.05 s | | `cargo test -p victory-shader --lib` (210 tests) | 78.3 s | 16.0 s | Hosted CI runners have no hardware adapter, so CI time barely changes. Anyone running the tests on a GPU waits a fraction as long. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
futurepro62 commented 2026-11-25 07:06:30 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by futurepro62 on 2026-11-25T06:38:25Z.


Full-suite run on Windows, since this PR has no test report yet. Tested exact head 38bc631 (on its base 90b529f).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (rust-toolchain.toml), DXC + dxil.dll 1.9.2602.17, debug.
  • cargo test --workspace --locked: 496 passed, 0 failed, 7 ignored (main 90b529f on this machine: 496 passed, 0 failed, 7 ignored).
  • cargo clippy --workspace --all-targets --locked -- -D warnings (the CI lint step): passed.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings (the CI lint step): passed.
  • No new #[test] functions in the diff.

Not tested

  • AMD (ztrx targets NVIDIA), a release build, the game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Zettrox/ztrx:comment:7155002636 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/11#issuecomment-7155002636). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-25T06:38:25Z. --- Full-suite run on Windows, since this PR has no test report yet. Tested exact head `38bc631` (on its base `90b529f`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (`rust-toolchain.toml`), DXC + dxil.dll 1.9.2602.17, debug. - `cargo test --workspace --locked`: **496 passed, 0 failed, 7 ignored** (main `90b529f` on this machine: 496 passed, 0 failed, 7 ignored). - `cargo clippy --workspace --all-targets --locked -- -D warnings` (the CI lint step): passed. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` (the CI lint step): passed. - No new `#[test]` functions in the diff. **Not tested** - AMD (ztrx targets NVIDIA), a release build, the game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Artking175 commented 2026-11-25 14:11:04 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Artking175 on 2026-11-25T13:21:42Z.


Independent A/B on Windows 10 22H2, RTX 2060, driver 531.41.
I compared #121 (ac7093d) with the same revision plus #11 (38bc631),
combining the Host constructor changes in an isolated build. Both
executables used Agility SDK 1.608.2 and DXIL validator 1.8.2505.32.
The adapter probe confirmed hardware SM 6.6 on both. WARP reported SM 6.2.

Three alternating single-threaded runs of the built shader unit-test
binaries, excluding build time, took 73.46 / 73.71 / 73.01 s for
the control and 24.98 / 24.47 / 24.61 s with #11. Median 73.46 → 24.61 s
(2.98×, −66.5%). All six runs had 210 passed, 0 failed, 3 ignored.
Every named test outcome and conditional skip matched. All 22 GPU tests
that had previously failed on this machine passed. No game files were used.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7163664945 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/11#issuecomment-7163664945). Originally posted by [Artking175](https://github.com/Artking175) on 2026-11-25T13:21:42Z. --- Independent A/B on Windows 10 22H2, RTX 2060, driver 531.41. I compared #121 (ac7093d) with the same revision plus #11 (38bc631), combining the Host constructor changes in an isolated build. Both executables used Agility SDK 1.608.2 and DXIL validator 1.8.2505.32. The adapter probe confirmed hardware SM 6.6 on both. WARP reported SM 6.2. Three alternating single-threaded runs of the built shader unit-test binaries, excluding build time, took 73.46 / 73.71 / 73.01 s for the control and 24.98 / 24.47 / 24.61 s with #11. Median 73.46 → 24.61 s (2.98×, −66.5%). All six runs had 210 passed, 0 failed, 3 ignored. Every named test outcome and conditional skip matched. All 22 GPU tests that had previously failed on this machine passed. No game files were used.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/11:upstream-pr/11'
git switch 'upstream-pr/11'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/11'
git switch 'upstream-pr/11'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/11'
git switch 'upstream-pr/11'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/11'
git switch 'main'
git merge --squash 'upstream-pr/11'
git switch 'main'
git merge --ff-only 'upstream-pr/11'
git switch 'main'
git merge 'upstream-pr/11'
git push origin 'main'
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
Zettrox/ztrx!11
No description provided.