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

Closed
opened 2026-11-26 22:46:10 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2408
Author: @aslan2142
Created: 11/26/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142

Base: main ← Head: dispatch-width-counters


📝 Commits (1)

  • 359ba96 indirect clamp: count dispatch records by width and log them (RT-INDIRECT-DISPATCH-COUNTERS)

📊 Changes

6 files changed (+339 additions, -255 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+13 -4)
📝 runtime/src/indirect_clamp.comp (+11 -0)
📝 runtime/src/indirect_clamp_spv.h (+267 -246)
📝 runtime/src/vulkan_indirect_clamp.h (+33 -3)
📝 runtime/test/indirect_clamp_test.cpp (+12 -0)
📝 tests/test_indirect_clamp_telemetry.py (+3 -2)

📄 Description

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)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2408 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/26/2026 **Status:** ✅ Merged **Merged:** 11/26/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `dispatch-width-counters` --- ### 📝 Commits (1) - [`359ba96`](https://github.com/ubiquitarianism/leonida/commit/359ba968d51907ece4438193e03e854ab7bf8d38) indirect clamp: count dispatch records by width and log them (RT-INDIRECT-DISPATCH-COUNTERS) ### 📊 Changes **6 files changed** (+339 additions, -255 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+13 -4) 📝 `runtime/src/indirect_clamp.comp` (+11 -0) 📝 `runtime/src/indirect_clamp_spv.h` (+267 -246) 📝 `runtime/src/vulkan_indirect_clamp.h` (+33 -3) 📝 `runtime/test/indirect_clamp_test.cpp` (+12 -0) 📝 `tests/test_indirect_clamp_telemetry.py` (+3 -2) </details> ### 📄 Description 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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7204002950) ## 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 22:46:10 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#2408
No description provided.