GPU: skip pipeline demand for empty compute dispatches #2556

Open
github-bot wants to merge 3 commits from github-bot/gh-2556 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 15:40 UTC · original
andrewpozdnakov7-jpg:codex1/empty-compute-dispatch → main · +38 −0 · 2 files · 3 commits · open

A compute dispatch with a zero group count on any axis has no shader work. Through both Dispatch and DispatchX, VIctory still requested the pending pipeline and could wait for it or count the command as dropped. Skip the empty grid before pipeline lookup. D3D12 dispatch arguments

The same synthetic pipeline-demand test fails on da82e444ec46a162ca779c82d4cf191a69182971 and passes on 1fe443d75b3a41b64c50ff95b583c323024ae131. Zero X, Y and Z leave the pipeline unused with the patch. A nonempty control still requests it.

Windows/WARP GPU suite passed with 199 passed and 1 ignored under both D3D12 debug flag settings. Strict GPU Clippy passed with default and all features, and the asset policy passed. AI-assisted.

GitHub CI passed the GPU crate tests. The shader test heap_direct_texture_reads_mark_their_heap_index failed at the same WARP assertion on both the PR and the unmodified base. Base CI · PR CI

Please preserve Git authorship if cherry-picking. If this is folded into another commit, please include the trailer below.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

Coordination claim

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 15:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2556) `andrewpozdnakov7-jpg:codex1/empty-compute-dispatch` → `main` · +38 −0 · 2 files · 3 commits · open A compute dispatch with a zero group count on any axis has no shader work. Through both `Dispatch` and `DispatchX`, VIctory still requested the pending pipeline and could wait for it or count the command as dropped. Skip the empty grid before pipeline lookup. [D3D12 dispatch arguments](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_dispatch_arguments) The same synthetic pipeline-demand test fails on `da82e444ec46a162ca779c82d4cf191a69182971` and passes on `1fe443d75b3a41b64c50ff95b583c323024ae131`. Zero X, Y and Z leave the pipeline unused with the patch. A nonempty control still requests it. Windows/WARP GPU suite passed with 199 passed and 1 ignored under both D3D12 debug flag settings. Strict GPU Clippy passed with default and all features, and the asset policy passed. AI-assisted. GitHub CI passed the GPU crate tests. The shader test `heap_direct_texture_reads_mark_their_heap_index` failed at the same WARP assertion on both the PR and the unmodified base. [Base CI](https://github.com/Marvisak/VIctory/actions/runs/45646502480/job/139318811414) · [PR CI](https://github.com/Marvisak/VIctory/actions/runs/45647862807/job/139323647978) Please preserve Git authorship if cherry-picking. If this is folded into another commit, please include the trailer below. Co-authored-by: andrewpozdnakov7-jpg <[email protected]> [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:09:10 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:38 UTC · original · edited 2026-11-26 00:24 UTC

Automated triage for the maintainers.

Merge candidate. Re-reviewed after the rebase (301b753, merges cleanly into current main). State::dispatch (crates/victory-gpu/src/draw.rs) now returns before the pipeline lookup when any group count is zero. Such a dispatch launches no work (see the D3D12 dispatch-argument documentation linked in the PR), so it no longer waits for a pending pipeline or counts as dropped. The skipped steps (bind, the diagnostics probes) only prepare for work that would not run, and the next dispatch binds again. The new test in pipeline/make.rs checks that zero X, Y and Z leave a pending pipeline unrequested and that a 1x1x1 dispatch still requests it. CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 18:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2556#issuecomment-7171183965) · edited 2026-11-26 00:24 UTC <!-- victory-triage v1 head=301b75364cad10cc79dd26876571a328d75d2b70 verdict=merge-candidate at=2026-11-26T00:24:07Z --> Automated triage for the maintainers. **Merge candidate.** Re-reviewed after the rebase (`301b753`, merges cleanly into current `main`). `State::dispatch` (`crates/victory-gpu/src/draw.rs`) now returns before the pipeline lookup when any group count is zero. Such a dispatch launches no work (see the D3D12 dispatch-argument documentation linked in the PR), so it no longer waits for a pending pipeline or counts as dropped. The skipped steps (`bind`, the diagnostics probes) only prepare for work that would not run, and the next dispatch binds again. The new test in `pipeline/make.rs` checks that zero X, Y and Z leave a pending pipeline unrequested and that a 1x1x1 dispatch still requests it. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 22:32 UTC · original

I resolved the conflict with #1320 in 301b753. Both tests are retained.

With the same WARP fixture on f3578e3, the pipeline is marked as requested after the first zero-sized dispatch. With this update it stays unrequested through zero X, Y and Z, then a 1×1×1 dispatch requests it. The upstream skip-queue test passes as well. The serial GPU suite passed 244 tests and ignored one in each D3D12 debug setting. Both strict Clippy modes and asset policy passed.

Please retain the Git author on cherry-pick or rebase. If you fold the fix or test into another commit, please add this trailer.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 22:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2556#issuecomment-7176493823) I resolved the conflict with #1320 in [301b753](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/301b75364cad10cc79dd26876571a328d75d2b70). Both tests are retained. With the same WARP fixture on `f3578e3`, the pipeline is marked as requested after the first zero-sized dispatch. With this update it stays unrequested through zero X, Y and Z, then a `1×1×1` dispatch requests it. The upstream skip-queue test passes as well. The serial GPU suite passed 244 tests and ignored one in each D3D12 debug setting. Both strict Clippy modes and asset policy passed. Please retain the Git author on cherry-pick or rebase. If you fold the fix or test into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:35 UTC · original

Code review and hardware + WARP verification at head 301b75364cad merged cleanly onto main (63bcca43c6a0):

  • Code review: Early-returning in State::dispatch when x == 0 || y == 0 || z == 0 runs before pipeline::host_pipeline, self.bind(list, p, true), list.note_op, diagnostic probes, and DROPPED/DISPATCHED counters. Skipping empty compute dispatches leaves State dirty flags and list_bound cache coherent without stalling on on-demand shader translation or issuing unnecessary barriers/copies.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok
    • cargo clippy --locked -p victory-gpu --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • RTX 5090 (--features diagnostics, VICTORY_D3D12_DEBUG=1, draw::tests list::tests pipeline::): 51/51 passed (including zero_group_dispatches_do_not_request_a_pipeline)
    • WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1, draw::tests list::tests pipeline::): 51/51 passed

Looks clean and ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2556#issuecomment-7178922546) Code review and hardware + WARP verification at head `301b75364cad` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review**: Early-returning in `State::dispatch` when `x == 0 || y == 0 || z == 0` runs before `pipeline::host_pipeline`, `self.bind(list, p, true)`, `list.note_op`, diagnostic probes, and `DROPPED`/`DISPATCHED` counters. Skipping empty compute dispatches leaves `State` dirty flags and `list_bound` cache coherent without stalling on on-demand shader translation or issuing unnecessary barriers/copies. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok` - `cargo clippy --locked -p victory-gpu --tests -- -D warnings` (default + `--features diagnostics`): 0 warnings - RTX 5090 (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `draw::tests list::tests pipeline::`): 51/51 passed (including `zero_group_dispatches_do_not_request_a_pipeline`) - WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `draw::tests list::tests pipeline::`): 51/51 passed Looks clean and ready to merge.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2556/head:github-bot/gh-2556'
git switch 'github-bot/gh-2556'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2556'
git switch 'github-bot/gh-2556'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2556'
git switch 'github-bot/gh-2556'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2556'
git switch 'main'
git merge --squash 'github-bot/gh-2556'
git switch 'main'
git merge --ff-only 'github-bot/gh-2556'
git switch 'main'
git merge 'github-bot/gh-2556'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2556
No description provided.