shader: gate modules that call xbox.* intrinsics — the AMD compiler faults at a fixed offset #584
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#584
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@MoonYueya on GitHub · 2026-11-22 14:14 UTC · original
Question
should
dxil_retarget.pyrefuse modules that still callxbox.*intrinsics on AMD adapters, and is the intrinsic lowering in #250's follow-up the intended route for them?Evidence so far
Windows 11 build 26300; AMD Radeon integrated (1002:164e), driver 32.0.11024.2, amdxc64.dll 8.18.10.0489; RTX 3080 32.0.16.1742; WARP. Attribution: vectored exception handler, no
d3d12sdklayers.dll.Whole DXBC containers as compute PSOs, one process each, 52 from a packaged DLL: on AMD the 43 whose DXIL declares
xbox.*external functions terminate with0xC0000005atamdxc64+0x2034D4(43/43, one offset); the 9 without them return S_OK. Replacing only the DXIL chunk swaps the outcome, 4/4. Re-serializing the RTS0 chunk, or dropping it for an explicit root signature, still faults at the same offset; NVIDIA takes the same bytes 51/52 (one unrelated 1024-thread container faults inside nvwgf2umx) and WARP passes all. Clearing0x03000000is a precondition: with flags intact, desktop returns E_FAIL before compiling, so the bits cannot be told apart behaviourally.Completion condition
S1: report the intrinsic set from
dxil_retarget.py, no behaviour change; green onctest --preset dev --no-tests=error -R 'dxil_retarget|shader_metadata|dxcontainer_part_offsets' -Vwith the new case. S2: on an AMD adapter, refuse to submit such a module and record why; the fixture reports the refusal instead of faulting the runner. S3, once lowering exists: route these modules there and drop the gate. We can supply the per-container table as a fixture and review patches.Required environment
Windows x64, a physical AMD GPU for S2, no game files.
Checklist
Not ticked: S1 and S2 can be checked with a synthetic module, but the fault itself was observed on console-compiled modules. Desktop dxc cannot emit
xbox.*declarations, so a public repro would need a hand-built bitcode module. We can help build one.Drafted with AI assistance; numbers independently re-checked.
@R0Y00 on GitHub · 2026-11-22 14:34 UTC · original
The Windows submission rule will apply across adapters. Check the final module and reject unresolved Xbox intrinsic calls before PSO submission, reporting the intrinsic names. A module whose calls have been removed or lowered under a defined contract can proceed after validation.
A read-only inventory can land first. Please distinguish declarations, actual calls, and names found only in metadata. For the gate, use source-built synthetic inputs with a recording submission stub: unresolved calls should result in zero submissions, while ordinary or validated lowered modules should submit. An unused declaration or a metadata name alone should not trigger refusal.
@MoonYueya on GitHub · 2026-11-22 14:56 UTC · original
Thanks, that's clear. We'll take the read-only inventory first. The plan:
xbox.*names in three groups: declared, actually called, and seen only in metadata.We'll open a PR here. The gate with a recording submission stub can follow in a separate PR once the inventory lands, unless someone else wants that part.
Drafted with AI assistance.
@MoonYueya on GitHub · 2026-11-22 15:19 UTC · original
Progress: the inventory is on MoonYueya:shader-xbox-intrinsic-inventory. It sorts names into declarations, actual calls and metadata string values; named-metadata keys such as
!xbox.compiler.optionsare left out. Before opening the PR we're doing two things: running it over the 52 console-compiled BVH modules we measured earlier, to check that it finds the same split of 43 with calls and 9 without; and running thectest -R 'dxil_retarget|shader_metadata|dxcontainer_part_offsets'set from a full build. The PR follows once both pass.Drafted with AI assistance.
@MoonYueya on GitHub · 2026-11-22 15:36 UTC · original
S1 is up as #608: a read-only inventory, no behaviour change. The dev-preset ctest set (
dxil_retarget|shader_metadata|dxcontainer_part_offsets) passes 6/6 from a full build. We also cross-checked it against the 52 modules indocs/experiments.md; it reproduces the 43/9 split there.Drafted with AI assistance.
@MoonYueya on GitHub · 2026-11-22 20:30 UTC · original
S2 is up as #690. It checks the module
dxil_retarget.pywould submit with--pso-probeand refuses it while it still calls anxbox.*symbol that nothing has reported as lowered. A refused module names the calls and is never submitted. Declarations and metadata-only names pass, and @descent81's!0 = !{!"call void @xbox.text()"}line from #608 is a negative control. Without--probethere is no disassembly, so the result is recorded asNOT_CHECKEDand nothing is submitted. S3, routing these modules to a lowering, remains open here.Drafted with AI assistance.
@R0Y00 on GitHub · 2026-11-22 21:58 UTC · original
S2 merged in #690 at
efc986b. The retargeter now blocks executablexbox.*calls before starting the Windows compute-PSO probe on every adapter, reports the names, and fails closed when the final module has not been disassembled. The regression confirms zero submissions for live calls or missing inventory and one submission after the call is gone. S3 stays open for a verified lowering and revalidation of the transformed module.@MoonYueya on GitHub · 2026-11-23 17:25 UTC · original
For the record: S2 is on main as you noted (
efc986b, #690), and the gap reported in #733 — the gate still admitted aliases, stores and bitcast-spelled calls — is closed by #734, which blocks every form that reaches anxbox.*builtin rather than only a direct call, and merged on 2026-11-23T03:00Z as81cf1e3. With that, the gate fails closed for live calls and for a missing inventory, and submits exactly once after the call is gone — the regression you described.We are not following S3 (a verified lowering plus revalidation of the transformed module). Doing it honestly needs a working lowering for these intrinsics, which we do not have, so that stage is better served on your side.
AI-assisted.
@triggered02 on GitHub · 2026-11-26 04:38 UTC · original
This thread has been waiting on a maintainer decision since @MoonYueya said their side is not following S3 (the occupied-slot work is elsewhere; this is the AMD xbox.* compiler-fault question). Recording the state precisely so it can be decided rather than drifting.
What main does today (S2, from #690 and #734): ools/dxil_retarget.py refuses a module that still executes an xbox.* call or whose final-module inventory is missing � it blocks the executable form before the Windows compute-PSO probe, reports the symbol names, and fails closed when the module could not be disassembled (dxil_retarget.py:630, :977, with DEFAULT_DROP_METADATA = ('xbox.compiler.options',)). Your evidence stands: on AMD the 43/52 modules that declare xbox.* terminate at mdxc64+0x2034D4 while the 9 without them return S_OK. The gate turns a driver crash into a refusal, but it does not make those modules usable.
S3 (verified lowering + revalidation) is the only way those 43 become dispatchable, and nobody has taken it.
Decision needed from @R0Y00 � one of:
My read: the 43/52 ratio makes this real work, not a hypothetical, but it is not blocking any current PR, and the gate already prevents the crash. If the answer is (1), I can scope the lowering list from the module names the gate prints and land it as a separate instrumented probe first.
@R0Y00 on GitHub · 2026-11-26 04:58 UTC · original
Defer S3 until a concrete required call is identified, and keep the existing final-module gate on all desktop adapters. S1 and S2 landed through #690 and #734. The 43/52 result is one published hardware comparison, so it does not establish which calls the current startup path needs. If a relevant call is found, scope a first patch to that named intrinsic, compare against independently established semantics in a source-built dispatch, and check every output word on WARP and the affected AMD adapter. The gate should still refuse unresolved calls or missing inventory before PSO creation. A lowered and revalidated module may proceed through the existing gate. No need to remove it or plan a bulk intrinsic rewrite.