Repository navigation
startup: translate device slot 67 compute requests with the gfx2hlsl compute stage - #2223
Conversation
…compute stage gfx2hlsl.py --pending and --watch translate a req_<key>.c67 request with ComputePipeline: COMPUTE_PGM_RSRC2 and the group size come from state block A (dword 3 = X | Y << 16, dword 4 = Z, dword 6 = RSRC2), a hypothesis from a local observation. The request is refused into <key>.fail first when a part is missing, a length disagrees with its size word in .desc, the files do not hash to the key in their name, or the code is empty, not whole dwords or has no s_endpgm; no cache path reaches the .fail text. Output: <key>.cs.hlsl, <key>.cs.cso (DXC cs_6_0), then the stage cs manifest <key>.txt; pending_keys treats .txt plus .cs.cso as done. startup_compute_translate_requests checks the refusals and the case A manifest (pure Python, added to the CI list). startup_compute_translate_e2e publishes case A through the stand-in, translates and compiles it and dispatches all 320 words; its wrong-group control must mismatch. This proves the plumbing, not the state-block reading. The offline request check now expects the stage's refusal of its 24-byte state block A. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tedin7
left a comment
There was a problem hiding this comment.
Review of head ae0bcb9a1f81ecf513e41a11b51172d58ba4ab20 (comment only).
Scope read: tools/startup/gfx2hlsl.py (compute_entry, load_compute_request, compute_refusals, translate_compute, pending_keys), the three tests, docs, CMake and workflow wiring. Mergeable. Title is neutral. No clean-room concerns seen.
Commands run locally (Linux):
python3 tests/startup_compute_translate_check.py-> pass (case A manifest, 5 malformed requests refused, renamed and incomplete refused)python3 tests/startup_compute_request_check.py-> ran (usage text only; the negative control needs the Windows render path)python3 tests/startup_compute_request_offline_check.py-> passpython3 tests/docs_links_check.py-> pass (18 files, 410 links)python3 tests/bidi_controls_check.py-> passgit diff --check origin/main...HEAD-> clean
Mutations (both reverted with git checkout -- .):
- Swapped X and Y in
compute_entry(dword 3 halves): the translate check fails (group 2 3 4expected). Killed. - Disabled the per-part size check in
load_compute_request: the translate check fails (data size wordreturnedok). Killed.
Findings
- P1: none.
- P2: none.
- nit
tools/startup/gfx2hlsl.pytranslate_compute: if DXC fails after an older<key>.txtexists, that manifest stays in place next to the new.fail.pending_keysstill treats it as done only when.cs.csois valid, so this is harmless today, but removing the stale.txton the failure paths would match the success path. - nit: the group-size and RSRC2 layout is documented as a hypothesis. That is honest and fine; keep the follow-up PR from relying on it without a second source.
- Windows proof: not run here. CI "Build and test on Windows" and the gfx1013 fixtures job were still pending at review time. The change adds a DXC
cs_6_0compile, so a Win2025 pass is worth waiting for before Ready.
AI-assisted; commands listed were executed locally.
translate_compute removes <key>.txt on a failed compile, as the success path does before publishing new bytecode, so no manifest is left next to <key>.fail. startup_compute_translate_check: a pre-existing manifest and a forced compile failure leave only the .fail, and pending_keys retries the request. The docs census matches the PR body (541 s_cbranch_execz first refusals, 11 s). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thanks. Fixed in The same commit brings the docs census in line with the PR body (541, 11 s). 26/26 of the ctest selection and the pure-Python checks pass. On the second nit: agreed, the state-block layout stays a hypothesis here; the runtime loading step will not rely on it without a second source. AI-assisted (Claude Code). |
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 04894d4adf4c80b1dfc0200c6e5f584c91570437 (delta since ae0bcb9: withdraw a stale manifest when DXC fails).
Result: no P1. The new fix is correct and tested. Two P2 items, one nit.
Commands run locally on the PR worktree:
python3 tests/startup_compute_translate_check.py-> pass (includes the new "failed compile withdraws the manifest" case)python3 tests/startup_compute_request_check.py-> pass (usage text only, no FAIL)python3 tests/startup_compute_request_offline_check.py-> passpython3 tests/docs_links_check.py-> 410 links OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> clean- CI: Linux checks, gfx1013 fixtures and Windows build/test all pass. PR is mergeable. Title is neutral.
Mutations:
- Replace the
os.remove(name + '.txt')in the DXC-failure path (tools/startup/gfx2hlsl.py:3205) withpass. The new test fails with "a manifest was left next to the failure". Killed. - In
pending_keys, change the compute stage list from('.cs.cso',)to('.vs.cso',). The test still passes. Survived.
Findings:
- P2
tools/startup/gfx2hlsl.py(pending_keys, thestages = ...line): no test covers the non-manifest-only branch for c67. A request with a.txtbut no.cs.csoshould stay pending whenX2W_FXCis not empty. Mutation 2 shows nothing guards it. Add one assertion withX2W_FXCunset: a.txtalone is pending, and.txtplus a real.cs.csois done. - P2
translate_compute: the stale-manifest withdraw runs only when DXC runs and fails. The "dxc not found" path (around line 3190) writes.failbut leaves an older.txtin place. TheUnsupportedpath fromload_compute_requestdoes the same. The key is a content hash, so this needs a manual cache edit or a toolchain change to hit. Still, the invariant "no manifest next to a.fail" is only partly kept. Remove.txtonce in a shared spot before any.failwrite. - nit: the
.cs.hlslfile is always rewritten, even when DXC is missing. That is harmless, but it is another file that can go stale next to a.fail.
No Windows run was needed for this delta. It is Python cache handling only and has no shader or C++ change. CI already ran the Windows job.
AI-assisted; commands listed were executed locally.
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 9c8457c0fe20b85935d8de9322a0e599cb0ed03d (delta since 04894d4: one commit, "Withdraw compute manifests before retrying slot 67 requests"; comment only).
Result: no P1. Previous P2 #2 is resolved. Previous P2 #1 is still open.
Previous findings
- P2 #2 (stale
.txtnext to a.failon the "dxc not found" andUnsupportedpaths): RESOLVED.translate_computenow removes<key>.txtonce at the top (tools/startup/gfx2hlsl.py:3181-3182), before any.failwrite, and the duplicate removals were dropped. The new test deletesreq_<key>.rootafter a published run and checks the refusal and that no manifest remains. - P2 #1 (no test for the non-manifest-only branch of
pending_keysfor c67): STILL OPEN. The commit touches only the test lines above; no assertion was added withX2W_FXCunset.
Commands run locally (Linux, PR worktree at 9c8457c):
python3 tests/startup_compute_translate_check.py-> pass (includes the new "refused request withdraws the manifest" case)python3 tests/startup_compute_request_offline_check.py-> passpython3 tests/startup_compute_request_check.py-> usage text only (needs the Windows render path), no FAILpython3 tests/docs_links_check.py-> 410 links OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> clean- CI at this head: Linux checks, gfx1013 fixtures and Windows build/test pass; /O2 and chart jobs skipped. PR is mergeable, not draft, title neutral.
Mutations (each reverted with git checkout -- .):
- Replace the new
os.remove(name + '.txt')at line 3182 withpass: translate check fails with "a manifest was left next to a refused request". Killed. - In
pending_keys(line 3719) change the c67 stage tuple('.cs.cso',)to('.vs.cso',): translate check and offline check both still pass. SURVIVED (same as last round).
Findings
- P2
tests/startup_compute_translate_check.py/tools/startup/gfx2hlsl.py:3719: the c67.cs.csostage rule inpending_keysis unguarded. The existing "done" assertion runs withX2W_FXC=""(manifest-only), where the stage list is not consulted. Add, withX2W_FXCunset: a.txtalone keeps the key pending;.txtplus a non-empty.cs.csomakes it done. That kills mutation 2. - No new P1 or other P2.
Windows proof: not run here. The delta is Python-only manifest handling, and CI Windows build/test passes at this head.
AI-assisted; commands listed were executed locally.
Change
Based on
main. Both pieces it connects are merged: the gfx2hlsl compute stage (#2182) and slot 67 requestpublishing (#2195). This PR is the consumer between them, in one commit.
gfx2hlsl.py --pendingand--watchnow translate areq_<key>.c67request instead of recordingcompute stage not supported. The stand-in is unchanged and still creates a placeholder. Loading andbinding the result at run time is the next PR.
Request checks. A request is refused into
<key>.fail, with no manifest, when:.descis not 96 bytes;.desc(code word 6, data word 8, state blocks words 2and 4);
s_endpgm.No cache path reaches the
.failtext: file errors becomeunreadable shader request, and DXC's file prefixis stripped.
Translation.
ComputePipeline(code, .root, rsrc2, group):rsrc2is state block A dword 6;groupis (dword 3 bits 15:0, dword 3 bits 31:16, dword 4 bits 15:0);This mapping is a hypothesis supported only by a local observation (below). The stand-in does not decode
these values.
Outputs.
<key>.cs.hlsl, then<key>.cs.cso(DXCcs_6_0 -Gis), then thestage csmanifest<key>.txtlast.A stage refusal goes to
<key>.failwith the stage's own reason.pending_keystreats a compute request as done once<key>.txtand<key>.cs.csoexist.X2W_FXC=(empty) publishes the manifest alone, as for graphics.<key>.cs.csohas the same form as the slot 62 results of startup-d3d12: run compute pipelines that are already desktop DXIL #1441 in the same directory. The keys come fromdifferent hashes, so the names clash only on a 64-bit collision.
Refs #1412. Overlap:
<key>.cs.cso);req_<key>.csfor slot 62);gfx2hlsl.py).Verification
Head
ae0bcb9a, one commit onorigin/main2e4f44cb(which includes #2182, #2195, the compute D16 load guard and#2139). Windows 11 build 26300, MSVC x64, DXC from Windows SDK 10.0.26100.0. Adapters, as printed by
offscreen_check:Microsoft Basic Render Driver vendor=1414 device=008c;NVIDIA GeForce RTX 5090 vendor=10de device=2b85, driver 32.0.16.2135.Debug layer on, with
debug_errors=0 debug_warnings=0.Result: 26 of 26 passed, with no skips. The selection includes all of #2182's controls on both adapters.
startup_compute_translate_e2e_warpand_hardware: all 320 words match.startup_compute_translate_e2e_wrong_group_warpand_hardware: bothrejected at word=5 expected=f5c0f122 actual=c5c5c5c5.Also passed:
python -B tests/startup_compute_translate_check.py, pure Python, added to the CI list and AGENTS.md;startup_compute_request_offline_check.py, which now expects the stage's refusal of its synthetic 24-bytestate block A;
startup_gfx2hlsl_compute_check.py,startup_triage_run_check.py,docs_links_check.pyandbidi_controls_check.py.Evidence and follow-up
startup_compute_translate_requests(pure Python) writes requests withgfx2hlsl.compute_key:stage csmanifest withnumthreads(2, 3, 4);s_endpgm, a data size word that disagrees, a 24-byte state block, files renamed to another key, and amissing
.root(whose.failhas no path);startup_compute_translate_e2e_<adapter>goes end to end:--pendingtranslates it and DXC compiles it;offscreen_checkdispatches the published<key>.cs.csoand compares all 320 words with startup: add a compute stage to gfx2hlsl with the offen buffer store #2182'sexpectation.
The control swaps the group size in the state block and must mismatch.
What the e2e test proves: the request files, translation, compiled bytecode and dispatch fit together. It
does not prove the state-block mapping, because the fixture builds the block at the offsets the translator
reads.
Local observation (one title, local files only, counts only):
dwords 3 and 4 are within
numthreadslimits in all 2,689, with 43 distinct sizes.it covers Y > 1 in 2,671 of 2,689.
TG_SIZE_ENis set in 91, which the stage refuses.offline with this branch's
compute_key, which leaves the files unchanged and renames them. This PR'sgfx2hlsl.py --pending(head
ae0bcb9a, on currentmain) then translated and compiled 8 of 2,689 in 11 s, with no translator error.No request was refused by the request checks, and DXC rejected none of the 8.
.failfiles):buffer_load_format_* requires descriptor FORMAT and DST_SEL: 1,280 (1,266 of them_x);... inside a block s_cbranch_execz skips per lane, for any instruction: 541;s_loadwith a register offset through the resource heap: 158;image_store: 110;TG_SIZE_EN: 91.Limits:
main's compute stage at2e4f44cb. An earlier run with startup: add a compute stage to gfx2hlsl with the offen buffer store #2182's5633dcd0gave the same counts.Follow-up:
buffer_load_formatfrom the descriptor format and scalar writes unders_cbranch_execz;<key>.txtand<key>.cs.csoat slot 67 and bind the compute root (after feat: record compute root signature and descriptor tables (list slots 33 and 35) #1803).Checklist
AI-assisted (Claude Code); the commands above were run locally.
🤖 Generated with Claude Code