Skip to content

GPU: skip pipeline demand for empty compute dispatches - #2556

Open
andrewpozdnakov7-jpg wants to merge 3 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex1/empty-compute-dispatch
Open

andrewpozdnakov7-jpg wants to merge 3 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex1/empty-compute-dispatch

Conversation

@andrewpozdnakov7-jpg

@andrewpozdnakov7-jpg andrewpozdnakov7-jpg commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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 andrewpozdnakov7-jpg@users.noreply.github.com

Coordination claim

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

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 andrewpozdnakov7-jpg@users.noreply.github.com

@fuzeofficlal

Copy link
Copy Markdown
Contributor

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.

BastienRodz added a commit to BastienRodz/VIctory that referenced this pull request Nov 26, 2026
BastienRodz added a commit to BastienRodz/VIctory that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants