Skip to content

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

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

mrb-eel wants to merge 1 commit into
ItsNotRexed: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.

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.

6 participants