indirect clamp: count dispatch records by width and log them (RT-INDIRECT-DISPATCH-COUNTERS) #2408

Manually merged
github merged 1 commit from gh-pr/2408/head into gh-pr/2408/base 2026-11-27 00:35:31 +00:00
Owner

@⁠aslan2142 on GitHub · 2026-11-26 21:44 UTC · original
aslan2142:dispatch-width-counters → main · +339 −255 · 6 files · 1 commits · merged 2026-11-26 21:45 UTC

The indirect clamp now counts dispatch records by width and logs them, so a run shows how wide the title's dispatches are and whether a device's limit cuts any. This is the follow-up the review of #2230 asked for.

Claimed in the coordination issue as: RT-INDIRECT-DISPATCH-COUNTERS

What changes

  • indirect_clamp.comp: stats words 12 to 15 count the dispatch records, those wider than 65,535 groups in x, the widest x that runs, and those cut at the device's limits.
  • vulkan_indirect_clamp.h: reads the new counters with the others and prints one line every 10 s while dispatch records are clamped:
    indirect clamp dispatch: N records, W wider than 65535 groups in x, widest x X, C cut at the device's limits (x x y x z).
  • indirect_clamp_spv.h: regenerated from the shader as its header says (glslangValidator 16.6.0).
  • docs/d3d12_vulkan.md section 4.7: the bound per dimension is the device's (it still said 65,535), the new line, and the test.

No behaviour changes: the clamp decides exactly as after #2230.

Why

  • #2230 made the dispatch bound follow maxComputeWorkGroupCount. Nothing told us whether the title issues dispatches wider than 65,535, or when a device's own limit still cuts one (llvmpipe allows 65,535 in x; RADV allows 2^32 - 1).
  • A fork of VIctory reports tile dispatches of 67,440 groups in x for this title at 2560x1440 (crates/victory-gpu/src/indirect.rs in VIctory-Belobug-AMD; no code of it is used).

Tests

  • indirect_clamp_test cases 6b and 6c check the counters with a 70,000 x 1 x 1 record: counted as wider than 65,535 where the device runs it, and as cut where it does not. Run with the validation layer on llvmpipe, the Ryzen 9 7950X3D iGPU and the RX 7900 XTX (RADV, Mesa 26.3.1), with a clean kernel log.
  • tests/test_indirect_clamp_telemetry.py checks the new counters.
  • Linux runtime ctest: 114/114. Windows suite under Wine: 488 tests, none changed against main.
  • Registration, docs, line-ending and game-data checks pass.

World run

RX 7900 XTX, RADV, Wine, about four minutes: 22494 records, 0 wider than 65535 groups in x, widest x 28800, 0 cut at the device's limits (4294967295 x 65535 x 65535). In that run no dispatch reached the old bound.

Not tested

  • MSVC (CI builds it).
  • A run at a resolution where the title issues wider dispatches.

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

**@⁠aslan2142** on GitHub · 2026-11-26 21:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2408) `aslan2142:dispatch-width-counters` → `main` · +339 −255 · 6 files · 1 commits · merged 2026-11-26 21:45 UTC The indirect clamp now counts dispatch records by width and logs them, so a run shows how wide the title's dispatches are and whether a device's limit cuts any. This is the follow-up the review of #2230 asked for. Claimed in the coordination issue as: [RT-INDIRECT-DISPATCH-COUNTERS](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ## What changes - `indirect_clamp.comp`: stats words 12 to 15 count the dispatch records, those wider than 65,535 groups in x, the widest x that runs, and those cut at the device's limits. - `vulkan_indirect_clamp.h`: reads the new counters with the others and prints one line every 10 s while dispatch records are clamped: `indirect clamp dispatch: N records, W wider than 65535 groups in x, widest x X, C cut at the device's limits (x x y x z)`. - `indirect_clamp_spv.h`: regenerated from the shader as its header says (glslangValidator 16.6.0). - `docs/d3d12_vulkan.md` section 4.7: the bound per dimension is the device's (it still said 65,535), the new line, and the test. No behaviour changes: the clamp decides exactly as after #2230. ## Why - #2230 made the dispatch bound follow `maxComputeWorkGroupCount`. Nothing told us whether the title issues dispatches wider than 65,535, or when a device's own limit still cuts one (llvmpipe allows 65,535 in x; RADV allows 2^32 - 1). - A fork of VIctory reports tile dispatches of 67,440 groups in x for this title at 2560x1440 (`crates/victory-gpu/src/indirect.rs` in VIctory-Belobug-AMD; no code of it is used). ## Tests - `indirect_clamp_test` cases 6b and 6c check the counters with a 70,000 x 1 x 1 record: counted as wider than 65,535 where the device runs it, and as cut where it does not. Run with the validation layer on llvmpipe, the Ryzen 9 7950X3D iGPU and the RX 7900 XTX (RADV, Mesa 26.3.1), with a clean kernel log. - `tests/test_indirect_clamp_telemetry.py` checks the new counters. - Linux runtime `ctest`: 114/114. Windows suite under Wine: 488 tests, none changed against `main`. - Registration, docs, line-ending and game-data checks pass. ## World run RX 7900 XTX, RADV, Wine, about four minutes: `22494 records, 0 wider than 65535 groups in x, widest x 28800, 0 cut at the device's limits (4294967295 x 65535 x 65535)`. In that run no dispatch reached the old bound. ## Not tested - MSVC (CI builds it). - A run at a resolution where the title issues wider dispatches. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
#2230 bounds a dispatch record by the device's maxComputeWorkGroupCount instead of 65 535. Nothing said how wide
the title's dispatches are, nor when a device's own limit still cuts one (llvmpipe allows 65 535 in x; RADV 2^32 - 1),
which its review asked for. The title's tile passes ask for 67 440 groups in x at 2560x1440 (found in the
VIctory-Belobug-AMD fork of VIctory, crates/victory-gpu/src/indirect.rs; no code of it is used).

- indirect_clamp.comp: stats words 12-15 count dispatch records that run wider than 65 535 groups in x, the widest
  x that runs, those cut at the device's limits (and still running), and all of them.
- vulkan_indirect_clamp.h: the counters, read with the others (16 words a slot, words 8-15 zeroed before the pass),
  and a line every 10 s while dispatch records are clamped: `indirect clamp dispatch: N records, W wider than 65535
  groups in x, widest x X, C cut at the device's limits (x x y x z)`.
- indirect_clamp_spv.h regenerated from the .comp as its header says (glslangValidator 16.6.0).
- docs/d3d12_vulkan.md section 4.7: the device's bound per dimension (it still said 65 535), the line, and the test.

Tests: indirect_clamp_test's cases 6b and 6c check the counters (70 000 x 1 x 1: wider than 65 535 where the device
runs it, cut at its limit and counted where not). tests/test_indirect_clamp_telemetry.py checks the new atomics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:35:29 +00:00
github manually merged commit 359ba968d5 into gh-pr/2408/base 2026-11-27 00:35:31 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 21:45 UTC · original

Merging. This is a self-merge.

  • Why now: it is the log line #2230's review asked for, and it is what tells a tester whether wide dispatches play any part in the stale tiles some runs show. It changes no behaviour.
  • Tested on the #2230 merge plus this commit: indirect_clamp_test with the validation layer on llvmpipe, the integrated RDNA2 GPU and the RX 7900 XTX (RADV, Mesa 26.3.1); Linux ctest 114/114; the Windows suite under Wine with no test changed against main; the telemetry, registration, docs, line-ending and game-data checks.
  • World run: the line printed as intended; see the description for the numbers.

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

**@⁠aslan2142** on GitHub · 2026-11-26 21:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2408#issuecomment-7204026003) Merging. This is a self-merge. - **Why now:** it is the log line #2230's review asked for, and it is what tells a tester whether wide dispatches play any part in the stale tiles some runs show. It changes no behaviour. - **Tested** on the #2230 merge plus this commit: `indirect_clamp_test` with the validation layer on llvmpipe, the integrated RDNA2 GPU and the RX 7900 XTX (RADV, Mesa 26.3.1); Linux `ctest` 114/114; the Windows suite under Wine with no test changed against `main`; the telemetry, registration, docs, line-ending and game-data checks. - **World run:** the line printed as intended; see the description for the numbers. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
This discussion has been locked. Commenting is limited to contributors.
No description provided.