Skip to content

Runtime: split statistics once for counted indirect dispatches - #7213

Closed
mrb-eel wants to merge 1 commit into
ProjectLeonida:mainfrom
mrb-eel:fix/counted-dispatch-statistics
Closed

mrb-eel wants to merge 1 commit into
ProjectLeonida:mainfrom
mrb-eel:fix/counted-dispatch-statistics

Conversation

@mrb-eel

@mrb-eel mrb-eel commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What changes

The query segmentation added in #2359 brackets every ExecuteIndirect in the emit loop. GPU-counted compute dispatch already brackets its internal count helper. When a pipeline-statistics query is active, both paths emit the same query end and begin, and the helper runs inside the resumed query. Coordination claim.

Apply the draw transition only to draws and indirect draws. The counted-dispatch path ends the old statistics segment, runs the helper, resumes the query once, and then executes the application's indirect dispatches.

Validation

  • The new CPU regression in replay_query_predication checks exact Vulkan event order through the query resolve. Its assertion fails on unchanged main and passes with the fix.
  • replay_query_predication, replay_query_edges, and predicated_copy passed.
  • Eight synthetic GPU cases matched native WARP's CSInvocations on an RTX 4070 SUPER (616.92), with Vulkan validation and synchronization validation enabled. The cases include zero count, the maximum, count clamping and a GPU overwrite. The local probe used test: root UAV s4:s5 in the counted indirect dispatch shader #6566's corrected shader fixture to exercise the independent statistics change. This PR leaves that fixture untouched.

AI-assisted. No game files were used.

@AirKyzzZ

Copy link
Copy Markdown
Contributor

Tested 43e077206 on RTX 2060 (NVIDIA 566.14), Windows 10 22H2, clang-cl 23.1.6 + lld-link (MSVC 14.44 STL), SDK 10.0.26100: pass

Built replay_query_predication_test, replay_query_edges_test and predicated_copy_test at the head as is. ctest -R "^(replay_query_predication|replay_query_edges|predicated_copy)$": 3/3 pass. With vulkan_replay.h from the merge base: replay_query_predication fails on counted dispatch: suspend and resume statistics once around the helper, so the new check fails on main. Not run with Vulkan validation (no Khronos layer on this machine). No game files. AI-assisted (Claude Code).

@junaydirfan

Copy link
Copy Markdown

Tested 43e07720 merged into main 8575d36e (clean) on Linux (CachyOS), GCC, RelWithDebInfo, with the new replay_query_predication regression included: pass.

GPU driver ctest run_gpu_tests.py
Intel Raptor Lake-S iGPU (Xe-LP) Mesa ANV 26.3.1 same as main; the only failure is vk_predicated_copy, which fails on main there too (#4709) unchanged
RTX 4080 Laptop NVIDIA 620.73.04 same as main unchanged

(xdxr_build_check crashed once in this run. It is a Python test, it passed 2 of 3 reruns here, and the crash is this machine's Python 3.14, not this PR.)

With #4792. That PR also changes how statistics segments are split around helper commands (transfers, on ANV), so I merged both into main with the two-line build fix from my #4792 comment. They merge without conflicts, and ctest passes 63/63 on both GPUs, including vk_predicated_copy on ANV with #4792's workaround.

@umnitus

umnitus commented Nov 23, 2026

Copy link
Copy Markdown

Independent Windows clang-cl/xwin check at 43e0772. replay_query_predication, replay_query_edges and predicated_copy passed (3/3), including the counted-dispatch query order regression. This was the stock test set. AI-assisted testing.

@Pierrot1398

Copy link
Copy Markdown

Tested 43e0772 on NVIDIA GeForce RTX 5060 Ti, driver 621.24 (32.0.16.2124), Windows 11 Pro 26300, MSVC (VS 18 Build Tools) RelWithDebInfo, Vulkan headers via -DLEONIDA_VULKAN_HEADERS_FETCH=ON: pass.

  • replay_query_predication_test: 3/3 runs (CPU, mocked Vulkan), including the new case 17: the counted-dispatch helper runs between statistics segments 9:0 and 9:1 and the resolve sums 9:0+2.

Read the diff first: one condition in emit plus the test. No game files. AI-assisted (Claude Code).

@eizispark

Copy link
Copy Markdown

Tested 43e0772 merged cleanly onto main (dde82f27e) on AMD Radeon RX 9070 XT, Adrenalin 26.11.1 (LLPC / Vulkan 1.4.359), Windows 11.

  • python -I scripts/check_no_game_data.py runtime/src/vulkan_replay.h runtime/test/replay_query_predication_test.cpp: pass
  • ctest (RelWithDebInfo): replay_query_predication (including new Case 17 counted-dispatch statistics segmentation check), replay_query_edges, predicated_copy, vk_predicated_copy, d3d12_predicated_copy, and d3d12_query_rules all passed (6/6).

AI-assisted verification; no game data used.

Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
…otRexed#7145 ItsNotRexed#7327 ItsNotRexed#7391 ItsNotRexed#7186 ItsNotRexed#7220 ItsNotRexed#7260 ItsNotRexed#7279 ItsNotRexed#7294 ItsNotRexed#7301 ItsNotRexed#7404 ItsNotRexed#7449 ItsNotRexed#7459 ItsNotRexed#7481 ItsNotRexed#7029 ItsNotRexed#7157 ItsNotRexed#7161 ItsNotRexed#7210 ItsNotRexed#7213 ItsNotRexed#7241 ItsNotRexed#7256 ItsNotRexed#7268

ItsNotRexed#8919 fork integration. Each parent after the first is an exact reviewed PR head.

ItsNotRexed#5180 554ddf4 ItsNotRexed#5180 (comment)
ItsNotRexed#5887 1894146 ItsNotRexed#5887 (comment)
ItsNotRexed#7145 8366ec8 ItsNotRexed#7145 (comment)
ItsNotRexed#7327 0392f03 ItsNotRexed#7327 (comment)
ItsNotRexed#7391 4abe9b3 ItsNotRexed#7391 (comment)
ItsNotRexed#7186 f27a7e8 ItsNotRexed#7186 (comment)
ItsNotRexed#7220 7fe517a ItsNotRexed#7220 (comment)
ItsNotRexed#7260 007d10f ItsNotRexed#7260 (comment)
ItsNotRexed#7279 d6b5221 ItsNotRexed#7279 (comment)
ItsNotRexed#7294 d895219 ItsNotRexed#7294 (comment)
ItsNotRexed#7301 ec5b887 ItsNotRexed#7301 (comment)
ItsNotRexed#7404 3e2978f ItsNotRexed#7404 (comment)
ItsNotRexed#7449 dfedc14 ItsNotRexed#7449 (comment)
ItsNotRexed#7459 90045c5 ItsNotRexed#7459 (comment)
ItsNotRexed#7481 fd9231a ItsNotRexed#7481 (comment)
ItsNotRexed#7029 97211c7 ItsNotRexed#7029 (comment)
ItsNotRexed#7157 4d13060 ItsNotRexed#7157 (comment)
ItsNotRexed#7161 40066d7 ItsNotRexed#7161 (comment)
ItsNotRexed#7210 9c8950e ItsNotRexed#7210 (comment)
ItsNotRexed#7213 43e0772 ItsNotRexed#7213 (comment)
ItsNotRexed#7241 50aef11 ItsNotRexed#7241 (comment)
ItsNotRexed#7256 e83aa4e ItsNotRexed#7256 (comment)
ItsNotRexed#7268 b75d669 ItsNotRexed#7268 (comment)

AI-assisted integration.
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.

7 participants