startup: publish translation requests for device slot 67 compute pipelines #2187
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2195"
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-25T04:00:19Z.
Change
Device slot 67 creates pipelines from console gfx1013 compute programs. Today the stand-in returns a
placeholder and writes nothing, so no offline tool can see these programs. This PR adds the producer side:
the stand-in writes a translation request through the existing shader request/cache protocol. It uses the same
cache directory, the same
publish_shader_requestwriter, the same write-once-per-key rule and the same--pending/--watchscan. The producer comes first because no translator can be built or measured againstreal compute programs until they reach the cache. The consumer (translation with the compute stage of #2182)
is the next PR and already works locally against these requests. Nothing drawn or dispatched changes:
every slot 67 pipeline stays a placeholder.
Format. In render mode (
X2W_D3D12_RENDER=1) withX2W_SHADER_CACHEset, a slot 67 creation writes:req_<key>.desc: the 12 description words. The seven pointer words (0, 1, 3, 5, 7, 9 and 10) are alwayszero, so no process address reaches a file or the key.
req_<key>.sa,.sb: the two state blocks (words 1-2 and 3-4), at most 4 KiB each. A size of 0 means theblock is absent.
req_<key>.data: the words 7-8 blob, at most 1 MiB, required.req_<key>.root: the serialized root signature.req_<key>.c67: the code (words 5-6), at most 1 MiB, written last as the ready marker.Reading rules.
written, so a later write by the title cannot leave a file that does not match its key.
That covers a size of 0 or over its limit, a part unreadable to its declared end, an unreadable description,
and a root signature without a recorded blob.
Key. A length-framed FNV-1a chain over
x2w-startup-shader-8cs(the graphics revision followed bycs).Each part is preceded by its u64 length, so moving bytes between parts changes the key. A compute key and a
graphics key share one hash, so they can still coincide through a 64-bit collision, or through a graphics
program crafted to start with the compute framing.
Pointer rules.
.descor the key.those targets are decoded later, every key changes and each request is published once more.
.data,.saand.sbthat name committed memory are counted, not refused: oneVirtualQueryper candidate, so no fault is taken. Hash-like values can name memory by chance. The code isnot scanned.
Dedupe and cost.
.c67yet) are kept, and the next creation completes the request.draw_lock.x2w-render totalsline ends withcompute requests published N (already present N, failed N, pointer-like blob qwords N).This comes after the existing
pipelines first looked up by ExecuteIndirect N.Offline handling.
gfx2hlsl.py --pending/--watchtake.c67as a ready marker and recordcompute stage not supportedin<key>.fail. The request waits in the cache, and a later--pendingretries it.
--refusalsreports compute requests in their own section, so the graphics statistics do notmove.
triage_run.pycounts their.failreasons under acompute:class.Relation to the ExecuteIndirect requests (#2186). That path writes graphics requests at the point of use:
when slot 61 refuses a console pipeline, it calls the direct-draw request writer
translation_for. Computepipelines are requested at creation instead, as slot 86 streams are, because slot 67 creation already has
every part the request needs and no translated compute pipeline is looked up yet. Both paths share the cache
directory, the writer and the totals line, and use different ready markers (
.aand.c67).Overlap:
req_<key>.cs(slot 62 desktop DXIL) with<key>.cs.srcas its ready marker. That is why thisPR uses
.c67, so the two coexist.<key>.cs.cso.d3d12_xs_device.cpp.gfx2hlsl.py.Refs #1412.
Verification
Head
607a96a7onorigin/maina116c379. Windows 11 build 26300, MSVC x64, WARP (Microsoft Basic RenderDriver 10.0.26100.10068).
Result: 11 of 11 passed, with no skips.
startup_compute_request_disabled_controlprintedFAIL: no compute request. Also passed:docs_links_check.py,bidi_controls_check.py,startup_triage_run_check.pyandstartup_gfx2hlsl_export_mask_check.py.Evidence and follow-up
The fixture (
tests/startup_compute_request_check.py) is source-built and synthetic. None of its qwords is anaddress: each is below 0x10000 or at or above 2^47. It checks that:
and 10 pointing into the consumer;
gfx2hlsl.compute_key, and thatmoving bytes between parts changes it;
PAGE_NOACCESSpage;--pendingand--refusalsrecordcompute stage not supported.The negative control turns render mode off.
Local observation (a local build of this change ported to an older base; one title, local files only; counts
only):
98.8 MB of it
.c67. It counted 729 pointer-like blob qwords.changed no modification times.
and 8. State block A is 28 bytes and state block B 20 bytes.
Limits.
at least 4 KiB.
Follow-up: translation with the compute stage of #2182 (next PR), then runtime loading and binding.
Checklist
AI-assisted (Claude Code); the commands above were run locally.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:04:19Z.
Review: COMMENTED
Review of head
607a96a78f9b76cf24d14188f57ed5941589bef6(comment only).State: MERGEABLE. CI on this head: Linux Python checks pass, gfx1013 fixtures pass, Windows build and test pass (the /O2 job and the chart job were skipped). Title is neutral. No clean-room concern seen in the diff.
Commands executed locally (Linux):
git diff --stat origin/main...HEAD: 9 files, +591/-10.python3 tests/startup_triage_run_check.py->0 failedpython3 tests/docs_links_check.py-> pass (18 files, 406 links)python3 tests/bidi_controls_check.py-> passgit diff --check origin/main...HEAD-> cleantests/startup_compute_request_check.pyneeds the Windows consumer binary, so it was not run locally. I relied on the Windows CI job. I did not queue a Windows VM run.Read-through (d3d12_draw.inl
publish_compute_request, gfx2hlsl.pycompute_key):compute_keyin order and framing..descor the key. The.c67marker is written last. This looks correct.Mutations tried (each reverted with
git checkout -- .):request_keysfrom.c67to.c68.startup_triage_run_check.pystill passed (survived on Linux).cs_codeanddataincompute_key. No Linux test failed (survived on Linux). Only the Windows WARP check compares it with the C++ key.Findings:
tests/startup_triage_run_check.py,tools/startup/gfx2hlsl.py:2709and:2953): the Linux-side compute logic (compute_key,request_keys(compute=True),compute_refusals_report, the.c67pattern inpending_keys) has no Linux test, as the two mutations show. A small fixture check (a literal key vector forcompute_key, plus a cache dir with areq_*.c67file run through--refusalsand--pending) would let the Linux job catch drift.d3d12_draw.inl,pointer_like_qwords): the author already notes the hash-like false positive as a shortcut. It is only a counter, so there is no correctness impact.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:32:42Z.
Review: COMMENTED
Re-review of head
bd07e41f801537bac743a4ff6a45b724a9dc8054(comment only). Previous review was on607a96a7.State: MERGEABLE. CI on this head: Linux Python checks pass, gfx1013 fixtures pass, Windows build and test pass (the /O2 job and the chart job were skipped). Title is neutral. No clean-room concern seen.
What changed since
607a96a7: one commit, 4 files, +72. It addstests/startup_compute_request_offline_check.pyand registers it inCMakeLists.txt,.github/workflows/windows.ymlandAGENTS.md. No production code changed. This answers my earlier nit about missing Linux coverage.Commands executed locally (Linux):
git diff --stat 607a96a7 HEAD-> 4 files, +72python3 -B tests/startup_compute_request_offline_check.py-> passpython3 -B tests/startup_triage_run_check.py->0 failedpython3 tests/docs_links_check.py-> pass (18 files, 406 links)python3 tests/bidi_controls_check.py-> passgit diff --check origin/main...HEAD-> cleanMutations tried (each reverted with
git checkout -- .):.c67->.c68intools/startup/gfx2hlsl.py: the new test fails (AssertionError). Killed. Before this commit it survived.cs_codeanddatain thecompute_keyloop (gfx2hlsl.py:2715): the new test fails (1d1c50f3243e8088 != 29c6e5148934abc8). Killed. Before this commit it survived.Read-through of the new test: it checks the key against an independent framing implementation and against a literal vector, then runs a synthetic cache directory through
request_keys,pending_keys,--pendingand--refusals --json. It asserts caller-visible output (the.failfile, the report, no manifest). It is registered in all three places the sibling checks use. The C++ side is still checked by the Windows job only, which passed in CI. I did not queue a Windows VM run, since this commit touches no C++ or shader code.Findings:
KEYis produced by the same Python function it checks. That is fine as a drift guard, and the independentframed_key()covers the framing rule. Nothing to change.pointer_like_qwordscan count a hash-like value as a pointer. It is only a counter.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T04:27:28Z.
Thanks. Added
bd07e41f: a pure-Pythontests/startup_compute_request_offline_check.py(in the Linux list, AGENTS.md and cteststartup_compute_request_offline). It pinscompute_keyto a literal vector, also recomputed in the test from the framing rule, and runs one syntheticreq_<key>.c67request throughrequest_keys,pending_keys,--pendingand--refusals --json.Both mutations now fail it locally:
.c67→.c68inrequest_keys, and swapped code and data incompute_key(1d1c50f3243e8088 != 29c6e5148934abc8).ctest --preset dev --no-tests=error -R "^(startup_compute_request_(offline|warp|disabled_control)|startup_gfx2hlsl_refusals|startup_triage_run|startup_tools_lint)$": 6/6 passed on Windows. The new check needs no Windows or D3D12.AI-assisted (Claude Code).