Repository navigation
startup: count ExecuteIndirect calls by refusal reason and signature kind - #2180
Merged
Merged
Conversation
…kind The slot-61 refusal log stops after 16 lines, so a run could not tell how many calls fall under each reason. Keep 64-bit counters per outcome (forwarded, graphics pipeline, compute pipeline, placeholder signature, other) and signature kind, and print one x2w-render indirect line beside the render totals heartbeat. Forwarding is unchanged. startup_indirect_draw_indexed now refuses one call per counted reason, presents 300 empty frames and asserts the line; the count-control run expects one forwarded call too many and must report the mismatch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rol to the counts The draw and mesh variants no longer set X2W_TRAP_LOG, so they leave no log file; the control must report the observed and the wrong forwarded count; the line buffer fits every outcome with 19-digit counts; the docs paragraph follows the totals comparison. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…sals under the signature kind The control's pattern held a semicolon, so CMake split it into a list and the expected-string half always matched. It now holds no semicolon and requires the mismatch report's observed line with the real counts. The signature kind is read before the first refusal, so a two-command call is counted as other under its kind; the fixture now sends one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Keeps upstream's query-slot code beside list_execute_indirect; the refuse path is unchanged upstream (19 refuse sites), so the counters apply as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tedin7
reviewed
Nov 25, 2026
tedin7
left a comment
Collaborator
There was a problem hiding this comment.
Review of head c8668856ea100a483dbb504db7a6fbc0a271cf3f (comment only).
Summary: the per-reason / per-kind ExecuteIndirect counters look correct. I found no P1 or P2.
Checked by reading src/startup_stubs/d3d12_xs_device.cpp:
IndirectCommandhas 5 values (none, dispatch, draw, draw_indexed, dispatch_mesh). The[outcomes][5]array, thekinds[]names in the printer and thestatic_cast<int>(kind)index all line up.sigis now resolved before the first refusal.as_wrapper(nullptr)is handled andown()is only touched after the null check, so a null signature counts asnone("other").- Every
return refuse(...)is counted exactly once. The forwarded counter is bumped only afterlist->ExecuteIndirect(...), so a call cannot be counted twice. - 64-bit
InterlockedIncrement64counters, never reset. The 1024-byte line buffer fits the worst case (5 outcomes x 5 kinds x 19 digits plus labels). - The new line is printed in the same
frame % 300style as the existing totals, and therefusedlog still stops after 16.
Commands executed locally (worktree at the head SHA):
git diff --stat origin/main...HEAD: 5 files, +113/-7.python3 tests/docs_links_check.py: pass (18 Markdown files, 401 links).python3 tests/bidi_controls_check.py: pass (1456 files).git diff --check origin/main...HEAD: clean.python3 x2w_pipe.py win2025 2180 --wait 1200(Win2025, WARP, release/O2): ctest 25/25 passed, includingstartup_indirect_draw_indexed_warpandstartup_indirect_counts_control_warp.- CI when I looked: Linux Python checks pass, Windows jobs still pending.
Findings:
- P1: none.
- P2: none.
- nit:
CMakeLists.txt(PASS_REGULAR_EXPRESSIONofstartup_indirect_counts_control_warp) hard-codes the whole expected line. A later change in how the other draw tests count calls will break it with a hard-to-read failure. A short comment saying which calls produce each number would help. - nit:
tests/startup_indirect_draw_indexed.cppwrites a log file to the temp dir. Please make sure it is deleted on every exit path, including a failing check. - Scope: I did not run a source mutation of the counter logic. The negative-control test covers "one forwarded call too many", and the Windows run above exercised it.
- Clean-room, MIT and title: neutral, no concerns.
AI-assisted; commands listed were executed locally.
5 tasks done
clquwu
added a commit
to clquwu/leonida-ultimate
that referenced
this pull request
Nov 25, 2026
…d, indirect clamp & action_offset Implements five replay/barrier/indirect improvements on blend/stage2-replay-barriers-indirect: - Placed/simultaneous-access texture preservation across LAYOUT_UNDEFINED enhanced barriers (DesignWithTommy/i95@08ae3e8, GPL-3.0; ResourceBinding::placed_texture + LEONIDA_PLACED_UNDEFINED=1 opt-out). - Compute/copy queue graphics-only layout guard in TransitionBarrier, TextureBarrier, and DiscardResource (ThatRecompDev/five-star-recomp@9b0070d, GPL-3.0). - ExecuteIndirect !cmd.has_draw out-of-renderpass skip + counter (no vkCmdDrawIndirect* outside a Vulkan render pass). - Backwards-compatible CommandSignature trailing action_offset threaded through command_list.h, d3d12_com.{h,cpp}, and vulkan_replay.h (Marvisak/VIctory#956 GPL-3.0, R0Y00/Xbox2Windows#2091 MIT). - Non-destructive GPU indirect argument clamping for DISPATCH/DRAW/DRAW_INDEXED/DISPATCH_MESH into submission-local scratch (LEONIDA_INDIRECT_CLAMP=0 kill-switch; ThatRecompDev/five-star-recomp@1936a2b, DesignWithTommy/i95@000516c GPL-3.0) + per-kind/outcome counters (R0Y00/Xbox2Windows#2180 MIT).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
list_execute_indirect(command-list slot 61) logs its first 16 refusals and then goes quiet, so a run cannot tell how many calls fall under each reason or signature kind. In a one-frame capture of a local run, every slot-61 call was refused, for three reasons: no matching desktop graphics pipeline and root, no desktop compute pipeline and root, or a placeholder signature.This change:
volatile LONG64counters per outcome × signature kind (draw,drawindexed,dispatch,dispatchmesh,otherfor a placeholder or unknown signature). The kind is read before the first check, so even an early refusal, such as a call with two commands, is counted under its signature's kind. They are cumulative and never reset, so they neither wrap nor stall. The existing 16-linefirst_callslog is unchanged.x2w-render totalsheartbeat:Nothing else changes: the same calls are forwarded and refused.
Refs #1759 (ExecuteIndirect), #1412 (the compute-pipeline reason), #870.
Overlap: open #2173 (rectangle-list indirect Draw arguments) edits refusal lines in the same function, so a textual conflict is expected with whichever lands second; this change only adds a reason index to those calls, and I will rebase it on #2173 if that merges first.
Verification
Head
c8668856(origin/maine3e39c43merged in), branchstartup/indirect-refusal-counts. Windows 11 build 26300, release preset, D3D12 debug layer enabled in every run. Adapters: WARP (Microsoft Basic Render Driver, 10.0.26100.10068) and NVIDIA GeForce RTX 5090 (driver 32.0.16.2135).How the line is checked:
startup_indirect_draw_indexed(the indexed variant) now does three extra things.X2W_TRAP_LOGand compares the lastx2w-render indirectline with the expected counts. The expected forwarded count is 3 (the unrefused runs). The threeotherrefusals come from the existing short-argument and invalid-index cases and the two-command call.Negative control:
startup_indirect_counts_control_warpruns the same test but expects one forwarded call too many (4). The test printsgot '<line>'only when it reports a mismatch. The control'sPASS_REGULAR_EXPRESSIONis a single pattern, written without semicolons because CMake would split it into a list where any one item could match. It requiresgotfollowed by the whole observed line with the real counts. So the control passes only when the mismatch is reported and the observed counts are right. A crash or an empty line does not pass it.Mutants, each built and run with both tests (
startup_indirect_draw_indexed_warp/startup_indirect_counts_control_warp):Evidence and follow-up
tests/startup_indirect_draw_indexed.cpp. No new inputs.startup_indirect_draw_indexed_warpand the control run in theprpreset (regex extended) and in the full non-hardware suites. Each test process uses its ownX2W_TRAP_LOGfile in%TEMP%and deletes it.startup/indirect-pipeline-requests. It touches the samerefuse(...)line, so whichever lands second needs a trivial rebase.list_execute_indirect.list_execute_indirectcontext that is already onmain, so a textual conflict is possible.Checklist
docs/startup-runtime.md, section 3).AI-assisted (Claude Code).
🤖 Generated with Claude Code