Skip to content

startup: write translation requests for console pipelines used only by ExecuteIndirect - #2186

Merged
R0Y00 merged 6 commits into
R0Y00:mainfrom
NiiRoZz:startup/indirect-pipeline-requests
Nov 25, 2026
Merged

R0Y00 merged 6 commits into
R0Y00:mainfrom
NiiRoZz:startup/indirect-pipeline-requests

Conversation

@NiiRoZz

@NiiRoZz NiiRoZz commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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 through ExecuteIndirect (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 indirect line (#2180) counts that refusal as graphics-pipeline. When it does and the bound pipeline is a console pipeline (no desktop pipeline, own().real null), the stand-in now takes draw_lock and calls translation_for through a request_translation helper 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). The x2w-render totals line now ends with pipelines requested by ExecuteIndirect N. That count is per pipeline, not per call, so it goes on the totals line beside pipelines translated / missing, not on the per-call x2w-render indirect line.

Nothing is drawn. What is forwarded and refused is unchanged.

Not a duplicate:

Refs #1759 (ExecuteIndirect), #870.

Verification

Head 561af3a8 (origin/main a2010c91 merged in, including #2180), branch startup/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). The startup_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, no X2W_TEST_DEBUG_LAYER).

cmake --build --preset release --target startup_stream_consumer startup_indirect_dispatch startup_indirect_draw_indexed
ctest --preset release --no-tests=error -R '^startup_(indirect_(requests|dispatch|root_constants|draw_indexed|draw|mesh|counts_control)|slot57_blend_draw|stream_draw)_(warp|hardware)$'
# 100% tests passed, 0 tests failed out of 17 (no capability skips)
git diff --check origin/main...HEAD
# no output
python -B tests/docs_links_check.py
# Checked 18 Markdown files and 404 links.

How the fixture works: startup_indirect_requests_{warp,hardware} uses startup_stream_consumer, which gains two modes.

  • It builds the stream pipeline (slot 86, with an input layout so its key differs) and a device slot-57 pipeline from the same synthetic gfx1013 shaders and root.
  • slot57-draw binds 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-dispatch binds the same pipeline and records one Dispatch call, which is a compute-state refusal. It must write no request.
  • desktop-draw binds 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):

Mutant Failure
The memo is bypassed 3 lookups for 3 calls, expected 1
A request on the compute-state refusal slot57-dispatch: 1 extra requests
A request even with a desktop pipeline desktop-draw: a desktop pipeline was looked up
The request call removed (earlier revision) 0 indirect-only requests, expected 1

Evidence and follow-up

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed (X2W_SHADER_CACHE row in docs/startup-runtime.md: request, polling and the totals counter).
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

NiiRoZz and others added 5 commits November 25, 2026 02:42
…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 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_translation logs "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_requested not incremented). Optional.
  • nit: only the !root / root mismatch / mesh mismatch / non-direct list refusal 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.

@R0Y00
R0Y00 merged commit 4f518fb into R0Y00:main Nov 25, 2026
5 checks passed

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md that req_<key>.a is the ready marker. This matches the code: request_translation (src/startup_stubs/d3d12_draw.inl) counts a pipeline only when it was not in translation_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_pipeline is reset with pass = Pass{} at list reset (line 1951), so repeats within a list skip draw_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/-5
  • python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 404 links
  • python3 tests/bidi_controls_check.py: no bidirectional controls in 1466 files
  • git diff --check origin/main...HEAD: clean
  • python3 -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_pipeline is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants