Repository navigation
startup: write translation requests for console pipelines used only by ExecuteIndirect - #2186
Conversation
…y ExecuteIndirect
Translation requests for console graphics pipelines were written only on
the direct-draw path, so a pipeline used only through list slot 61 was
never requested. When slot 61 refuses a draw for lack of a matching
desktop pipeline and the bound pipeline is a console one, take the draw
lock and call translation_for, the direct-draw request writer: same key,
same files, once per pipeline. Nothing is drawn and forwarding is
unchanged.
startup_indirect_requests_{warp,hardware}: a slot-57 pipeline bound and
used through one refused ExecuteIndirect draw writes its request (once
over two runs); bound without the call, only the stream pipeline's
request exists.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Resolves the X2W_SHADER_CACHE row: upstream's run.ps1 -Translate sentence and this branch's ExecuteIndirect sentence are both kept. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…Indirect requests apart; test the boundaries A recording now remembers the last pipeline slot 61 asked a translation for, so repeated refused calls skip draw_lock. The request is limited to pipelines without a desktop pipeline (own().real), not !pipeline_real, which also held for desktop pipelines usable by slot 61. Each lookup is logged (first 16), and the render totals end with 'pipelines requested by ExecuteIndirect N': only direct draws poll for a manifest, so these are shown apart. The fixture now checks three calls make one lookup, a Dispatch call with the console pipeline bound makes none, and a desktop pipeline makes none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nts them Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The merged ExecuteIndirect counters (R0Y00#2180) label the graphics-pipeline refusal; the request stays on that refusal, which keeps its reason index. Requested pipelines stay in the totals line, not the indirect line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tedin7
left a comment
There was a problem hiding this comment.
Review of head 561af3a806c8266f6f547138d3fdf3221183f677 (comment only).
Summary: the change is small and consistent. It reuses translation_for (same key, same files, once per pipeline via translation_by_pipeline()), takes draw_lock correctly, and resets requested_pipeline with the pass (pass = Pass{} at src/startup_stubs/d3d12_xs_device.cpp:1951). Title is neutral, no clean-room concerns seen. Mergeable: yes.
Commands executed locally in a worktree of this head:
git diff --stat origin/main...HEAD: 6 files, +200/-5.python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 404 links OK.python3 tests/bidi_controls_check.py: 1466 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.python3 -I -m py_compile tests/startup_indirect_requests_check.py: OK.gh pr checks 2186: Linux Python checks pass; Windows build/test and gfx1013 fixtures were still pending when I looked.
Not executed: the new startup_indirect_requests_* CTest and the C++ consumer need a Windows build, so I did not run them and did not do a logic mutation (the production logic is in the Windows-only D3D12 stand-in). The Windows run reported in the PR body is the evidence for those; please make sure the pending Windows CI job passes before merging.
Findings:
- P1: none.
- P2: none.
- nit:
request_translationlogs "already known" only when another path (direct draw) created the entry first. The test covers the "new" case and the two-process case; a case where a direct draw and an indirect refusal share one pipeline would exercise the "already known" counter branch (indirect_requestednot incremented). Optional. - nit: only the
!root / root mismatch / mesh mismatch / non-direct listrefusal branch (d3d12_xs_device.cpp:2157-2166) writes the request. Other slot-61 refusals (later checks) for a console pipeline do not. This matches the PR text ("no desktop pipeline and root match"), so just worth keeping in mind when reading the counter.
AI-assisted; commands listed were executed locally.
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 3efc640a0aa8b41e24ca5cb438a1fecfc8f17b4e (previous review covered 561af3a8; one new commit: "Distinguish indirect pipeline lookups from complete shader requests").
Result: no P1, no P2.
What I checked
- The new commit only renames the counter and log to "first looked up by ExecuteIndirect" and adds the note to
docs/startup-runtime.mdthatreq_<key>.ais the ready marker. This matches the code:request_translation(src/startup_stubs/d3d12_draw.inl) counts a pipeline only when it was not intranslation_by_pipeline(), so the counter is a lookup count, not a count of published files. The test now asserts the same wording. - Refusal path (
d3d12_xs_device.cpp~2157-2166): the request is made only for console pipelines (!own().real) with a bound pipeline.requested_pipelineis reset withpass = Pass{}at list reset (line 1951), so repeats within a list skipdraw_lock. Nothing is drawn. - The doc sentence that only direct draws poll for the manifest, so such a pipeline stays in
missing, is consistent with the diff. - CI on this head: Linux checks pass, Windows build and test pass, gfx1013 fixtures pass.
- PR is not Draft, mergeable, title is neutral, no clean-room concerns seen.
Commands executed locally (Linux, in a worktree of this head)
git diff --stat origin/main...HEAD: 6 files, +200/-5python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 404 linkspython3 tests/bidi_controls_check.py: no bidirectional controls in 1466 filesgit diff --check origin/main...HEAD: cleanpython3 -I -m py_compile tests/startup_indirect_requests_check.py: ok
Not done
- No source mutation run: the new test needs the Windows-only
startup_stream_consumer(D3D12), so it cannot be built on Linux. I relied on the passing Windows CI job and did not queue the Windows VM.
Nits
- nit:
requested_pipelineis a raw pointer compared per list, so a pipeline freed and reallocated at the same address inside one list would be skipped. The window is one command list, so the impact is negligible.
AI-assisted; commands listed were executed locally.
Change
Translation requests (
req_<key>.{a,b,root}) for console graphics pipelines were written only on the direct-draw path (draw_translated→translation_for). A pipeline used only throughExecuteIndirect(command-list slot 61) was never requested, so its translator gap never showed up in the shader cache.Slot 61 can refuse a graphics call because no desktop pipeline and root match; the
x2w-render indirectline (#2180) counts that refusal asgraphics-pipeline. When it does and the bound pipeline is a console pipeline (no desktop pipeline,own().realnull), the stand-in now takesdraw_lockand callstranslation_forthrough arequest_translationhelper next to it. That is the direct-draw request writer: same key, same files, and once per pipeline through its per-pipeline map.Each recording remembers the last pipeline it asked for, so repeated refused calls skip
draw_lock. Each lookup is logged (first 16). Thex2w-render totalsline now ends withpipelines requested by ExecuteIndirect N. That count is per pipeline, not per call, so it goes on the totals line besidepipelines translated / missing, not on the per-callx2w-render indirectline.Nothing is drawn. What is forwarded and refused is unchanged.
Not a duplicate:
req_*.rootfrom earlier runs). It covers an indirect-only pipeline only when another pipeline recorded the same root and its programs are adjacent in the archive. It cannot cover non-adjacent pairs or programs embedded in the executable. This change writes the exact key that the runtime pairing uses.Refs #1759 (ExecuteIndirect), #870.
Verification
Head
561af3a8(origin/maina2010c91merged in, including #2180), branchstartup/indirect-pipeline-requests. Windows 11 build 26300, release preset. Adapters: WARP (Microsoft Basic Render Driver, 10.0.26100.10068) and NVIDIA GeForce RTX 5090 (driver 32.0.16.2135). Thestartup_indirect_*C++ tests ran with the debug layer enabled. The consumer-based checks (startup_indirect_requests,startup_slot57_blend_draw,startup_stream_draw) ran without it (X2W_D3D12_DEBUG=0, noX2W_TEST_DEBUG_LAYER).How the fixture works:
startup_indirect_requests_{warp,hardware}usesstartup_stream_consumer, which gains two modes.slot57-drawbinds the slot-57 pipeline and records three refused Draw calls. The cache must then hold exactly one extra request, carrying the slot-57 shaders and root, and each process must log exactly one lookup. Two processes into one cache must still give one extra request.slot57-bound(negative control) binds the pipeline and records nothing. Only the stream pipeline's request may exist, and no lookup.slot57-dispatchbinds the same pipeline and records one Dispatch call, which is a compute-state refusal. It must write no request.desktop-drawbinds a slot-86 pipeline with desktop shaders and records one refused Draw call. The log must show that a real desktop pipeline was built, and there must be no lookup.Mutants, each built and run with
startup_indirect_requests_warp(all fail):3 lookups for 3 calls, expected 1slot57-dispatch: 1 extra requestsdesktop-draw: a desktop pipeline was looked up0 indirect-only requests, expected 1Evidence and follow-up
tests/startup_stream_draw_check.py. No title data is used.draw_lockfor one map lookup, as a direct draw does.x2w-draw pipeline ... blend fromline, within its existing 24-line limit.translation_for_targets). An indirect-only pipeline therefore stays in "missing" for the whole run. In a later run, once its manifest exists, it counts as "translated" even though it is never drawn. Thepipelines requested by ExecuteIndirect Ncounter shows these pipelines separately.if(EXISTS INTAKE_PYTHON)besidestartup_slot57_blend_draw. It runs in the full non-hardware suites, not in theprpreset.origin/maina2010c91is merged in. The request stays on the refusal that startup: count ExecuteIndirect calls by refusal reason and signature kind #2180 labelsgraphics-pipeline, and that refusal keeps its reason index. TheX2W_SHADER_CACHEdocs row keeps startup: translate shader requests during a -Render run (cold-cache black frames) #2120'srun.ps1 -Translatesentence.list_execute_indirectcontext.d3d12_draw.inlelsewhere.list_execute_indirect. I test-merged each PR head with this branch and withorigin/main. Each already conflicts withorigin/main(2 and 1 hunks ind3d12_xs_device.cpp). Merging this branch first adds no conflict hunk, and none of their conflict hunks touch this change's lines. No textual conflict with this change is expected beyond what they already have withmain.Checklist
X2W_SHADER_CACHErow indocs/startup-runtime.md: request, polling and the totals counter).AI-assisted (Claude Code).
🤖 Generated with Claude Code