tooling: print the normalized first-refusal shape of each refused key #3946
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3946
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3944"
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?
@triggered02 on GitHub · 2026-12-03 15:59 UTC · original
triggered02:feat/refusal-shapes→main· +546 −6 · 3 files · 3 commits · merged 2026-12-03 16:40 UTCRefs #3705, #3816.
tools/startup/refusal_census.pyranks refused keys by the draws and dispatches they block, but it only shows the normalized refusal text — never the instruction window. That is why the #3705 rows (H1/H2/U1) are on hold for "normalized first-refusal shapes" and why the #3816 pixel bands cannot become fixtures: as the issue says, a fixture without the shape "would only be guessing".What this adds.
--shapesdecodes each refused key's cached request program around the instruction offset its first refusal names, using the translator's own printer (tools/disasm_rdna2.pythroughgfx2hlsl.strip_header/decode_instruction— the same one that produced the refusal text, so the decoding cannot disagree with it), and aggregates the normalized window:Registers become
sN/vN/ttmpNwith the range width kept, immediates0xK/K, offsetsoffset:K; the refusing instruction is bold; keys sharing a window collapse into one row with their count and summed blocked weight. In the synthetic capture, two keys that differ in every register, every immediate and the capture layout (one carrying a 36-byte native header with a capture-relative PC) collapse to a single shape.Safe to paste into an issue. The section prints counts and normalized instruction text only — no program bytes, request keys, module names or title data — and the docstring,
--helpand the docs entry all say so. Without the repository disassembler it exits with a capability message instead of a traceback.Tests: six new cases in
tests/startup_refusal_census_check.py(so the existing cteststartup_refusal_censuspicks them up) covering the collapse, the stripped-relative offset convention, the mnemonic fallback with its.rtvbase-request variant, the key-free unshaped report (asserting the raw words and keys never appear), the capability error and--shape-windowvalidation.python3 -B tests/startup_refusal_census_check.py→ 17 tests, OK;docs_links_checkandbidi_controls_checkpass.What it cannot do — and the useful part of that. It needs a real capture to be useful; the tests prove the mechanism, not any translateable shader. And a refusal line carrying neither
+0xnor a mnemonic has no site, so it is counted under a fixed reason rather than guessed. Many slot-86.m86/.ps86refusals are DXC diagnostics with no instruction offset, so for the #3816 bands this will mostly report "the refusal text names no site" — which is itself actionable: it says a PC-bearing refusal line is needed before those bands can become fixtures. It proves the first-refusal site and its operand shape, not the lowering.@chatgpt-codex-connector[bot] on GitHub · 2026-12-03 15:59 UTC · original · edited 2026-12-03 16:03 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
10bbaf1ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@chatgpt-codex-connector[bot] on GitHub · 2026-12-03 16:03 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
10bbaf184bℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@ -273,0 +335,4 @@line = SHAPE_REGISTER.sub(r"\1N", line)line = SHAPE_HEX.sub("0xK", line)line = SHAPE_FLOAT.sub("F", line)line = SHAPE_NUMBER.sub("K", line)@chatgpt-codex-connector[bot] on GitHub · 2026-12-03 16:03 UTC · original
When instruction mnemonics contain digits, such as
buffer_load_dwordx2versusbuffer_load_dwordx4, this replacement normalizes opcode characters as well as operand values, so distinct operations collapse into the same shape row. The census can therefore report different refusal causes as one shared shape; restrict number normalization to operands and offsets.Useful? React with 👍 / 👎.
@ -273,0 +410,4 @@"""if offset is None:return Nonefor at in dict.fromkeys((offset, offset - header)):@chatgpt-codex-connector[bot] on GitHub · 2026-12-03 16:03 UTC · original
For a native refusal against a capture with a stripped header, if both
offsetandoffset-headerare valid instruction boundaries containing the same mnemonic, this loop picksoffsetfirst. Native failures report capture-relative PCs, so the actual instruction is atoffset-header; the emitted window then describes another occurrence and contaminates shape aggregation. Select the offset convention from the refusal source or prefer the shifted candidate for native lines.Useful? React with 👍 / 👎.
@R0Y00 on GitHub · 2026-12-03 16:13 UTC · original · requested changes
Independent check on
10bbaf18: the census suite passed 17/17 and the docs check passed 1,010 links. A source-built case shows the wrong instruction can still be marked as the first refusal.I appended harmless v_mov instructions before s_endpgm in the existing 0x24-byte-header fixture, so the native capture-relative +0x38 is also a valid stripped-program boundary. The actual ds_swizzle_b32 is at stripped +0x14. With a native diagnostic that gives only the PC, shape_of returns a bold v_mov_b32_e32 at stripped +0x38. Giving the diagnostic an explicit ds_swizzle_b32 mnemonic produces the correct +0x14 shape. The first case silently counts the shape against the wrong opcode.
Please resolve the offset in the coordinate system of the diagnostic producer (or report the site as ambiguous if that origin cannot be established). Add a fixture where both offsets are valid boundaries and the native diagnostic has no mnemonic, plus the stripped-program counterpart so neither producer regresses.
@triggered02 on GitHub · 2026-12-03 16:23 UTC · original
@R0Y00 Fixed in
47959c62, and your reproduction is now a test rather than an anecdote.The coordinate system. The producer is now established from the diagnostic text: a
native compute +0x…:line (src/gfx1013_compute_native.cpp) decodes from the captured entry, so its PC is capture-relative and the stripped header is applied before matching; every other line is gfx2hlsl's, which decodesstrip_header(code), so it is already stripped-relative.The both-boundaries case. If the producer's own convention lands on no instruction boundary but the other one does, the key is listed under a fixed reason — "the refusal offset is an instruction boundary only in the other producer's coordinate system" — instead of silently taking the other reading. The exception, which is what keeps translator offsets working: a mnemonic the same line names that matches the other boundary still establishes the site, because then the bold opcode is exactly the one the diagnostic named.
Against your fixture (0x24 header,
v_movs appended so stripped+0x38is also a boundary, native PC-only diagnostic):and the ambiguity control (a translator
+0x38that only the capture shift places) now reports the fixed reason with 0 shaped keys instead of guessingds_swizzle.Codex's two P2s:
buffer_load_dwordx2andbuffer_load_dwordx4produce two rows instead of collapsing into one class row (the digit-eater was in the class text normalization, not in the shape line);Fixture and tests (both in
tests/startup_refusal_census_check.py, still cteststartup_refusal_census): your both-boundary native case, a translator stripped-PC case, the fixed ambiguity row, and the x2/x4 split — 21 tests, OK;docs_links_check(285 files, 1010 links) andbidi_controls_check(3090 files) pass.What is still uncertain, stated plainly: the producer is inferred from the diagnostic text, not from metadata. Only the
native compute +0x…:prefix is recognised as capture-relative — it is the sole native refusal shape today, since onerefuse()is shared by the compute/graphics/mesh paths andcompile_dxilwriteserror.what()verbatim. Any other producer with capture-relative offsets would be read as stripped, and would only be caught when the stripped reading fails. A mesh/graphics capture whosestrip_headerlength disagrees with the native entry offset also degrades to the ambiguity row rather than to a wrong opcode. In a real census, that row means "the tool could not establish the origin", not "this key has no shape".@R0Y00 on GitHub · 2026-12-03 16:40 UTC · original · approved these changes
Re-reviewed
47959c62. The census suite passed 21/21 and the docs check passed 1,010 links. I reran the two-valid-boundaries collision independently: with a 0x24-byte header and +0x38 in the diagnostic, a native PC-only message now marks ds_swizzle_b32 at stripped +0x14, while a translator message marks the actual v_mov_b32_e32 at stripped +0x38. The offset-only ambiguity control remains unshaped without an established boundary. The x2 and x4 opcode suffixes stay distinct with operand redaction preserved. Both previous findings are addressed. The required Windows job passed and the main trial merge is clean.