startup: count ExecuteIndirect calls by refusal reason and signature kind #2172
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2180"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T03:01:22Z.
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
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:08:32Z.
Review: COMMENTED
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").return refuse(...)is counted exactly once. The forwarded counter is bumped only afterlist->ExecuteIndirect(...), so a call cannot be counted twice.InterlockedIncrement64counters, never reset. The 1024-byte line buffer fits the worst case (5 outcomes x 5 kinds x 19 digits plus labels).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.Findings:
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.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.AI-assisted; commands listed were executed locally.