shader: emit !llvm.ident in direct DXIL modules for AMD PSO creation #2932
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!2932
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2932/head"
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?
@consolelogkyo on GitHub · 2026-11-26 21:50 UTC · original
consolelogkyo:fix/native-dxil-amd-pso-crash→cpp-migration· +370 −17 · 5 files · 1 commits · merged 2026-11-26 21:59 UTCSummary
Fixes the
0xC0000005access violation insideamdxc64.dllduringCreateComputePipelineStateandCreateGraphicsPipelineStateacross all direct-DXIL_hardwaretests on AMD RDNA 4 (AMD Radeon RX 9070 XT, driver32.0.32029.2010).Root cause
Comparing disassembled DXIL modules (
dxc.exe -dumpbin) re-assembled and validated throughIDxcAssembler::AssembleToContainerandIDxcValidator::Validateisolated the crash to missing!llvm.identmodule metadata:ps_6_6output passed (rc = 0,debug_errors=0 debug_warnings=0).DxilModuleoutput as-is crashed (0xC0000005), and bumping!dx.valverto1.8or1.9alone still crashed (0xC0000005).!llvm.ident = !{!<id>}(!{!"x2w"}) alone made the identicalDxilModuleIR pass (rc = 0,debug_errors=0 debug_warnings=0).dxc.exealways emits!llvm.identandIDxcValidatortreats it as optional, whereasamdxc64.dll(8.18.10.0514) queriesllvm::Module::getNamedMetadata("llvm.ident")and dereferences the returnedNamedMDNode*([rcx + 0x40]) without a null check.Changes
src/dxil_module.h: emit!llvm.ident = !{!<id>}(!{!"x2w"}) inDxilModule::finish_compute(coverscs,vs,gs, andps).src/gfx1013_pixel.cpp: emit!llvm.ident = !{!0}(!{!"x2w"}) inx2w::direct_gfx1013_constant_pixel.tests/native_dxil_llvm_ident_check.py,tests/cmake/native_dxil_llvm_ident.cmake: verify!llvm.identacrossgfx1013-container-cs,gfx1013-container-vs,gfx1013-container-ps,gfx1013-container-rect(vs,gs,ps), andgfx1013-direct-constant-pswith stripped-!llvm.identnegative controls, and draw both direct pixel paths paired withgfx1013-container-vson WARP and hardware with mutated-output negative controls.docs/experiments/native-dxil-llvm-ident.md: record the A/B isolation and verification notes.(Leaves the adapter-independent
native_wave_request_hardwareundecodable-word refusal wrapper untouched per coordination on #2915.)Verification
10.0.26100), Release preset (MSVC 19.44.35230), Windows SDK10.0.26100.0DXC, D3D12 debug layer enabled (0errors,0warnings).Microsoft Basic Render Driver(1414:008c, driver10.0.26100.9818) andAMD Radeon RX 9070 XT(1002:7550, driver32.0.32029.2010).ctest --preset release --no-tests=error -R "^native_" -E "^native_wave_request_hardware$"): 28/28 passed (plus 1 expected WARP wave-width skipnative_comparison_pso_warp), including all seven direct-DXIL_hardwaretests (native_scalar_lds_hardware,native_adjacent_srv_hardware,native_mtbuf_hardware,native_indexed_atomic_hardware,native_dpp_mirror_hardware,native_graphics_wqm_hardware,native_graphics_vertex_vcc_join_hardware) plusnative_dxil_llvm_ident_{controls,warp,hardware},docs_links, andbidi_controls.Refs #2915
AI-assisted.
AMD's user-mode DXIL compiler (`amdxc64.dll` `8.18.10.0514`, driver `32.0.32029.2010` on Radeon RX 9070 XT) queries `llvm::Module::getNamedMetadata("llvm.ident")` and dereferences the returned `NamedMDNode*` (`[rcx + 0x40]`) without a null check during `CreateComputePipelineState` and `CreateGraphicsPipelineState`. `dxc.exe` always emits `!llvm.ident`, while `IDxcValidator::Validate` treats it as optional, so direct DXIL containers from `DxilModule` passed validation, WARP, and NVIDIA while crashing all seven direct-DXIL `_hardware` tests with `0xC0000005` on RDNA 4. - `src/dxil_module.h`: emit `!llvm.ident = !{!<id>}` (`!{!"x2w"}`) in `DxilModule::finish_compute`, covering `cs`, `vs`, `gs`, and `ps`. - `src/gfx1013_pixel.cpp`: emit `!llvm.ident = !{!0}` (`!{!"x2w"}`) in `x2w::direct_gfx1013_constant_pixel`. - `tests/native_dxil_llvm_ident_check.py`, `tests/cmake/native_dxil_llvm_ident.cmake`: check `!llvm.ident` across `gfx1013-container-cs`, `gfx1013-container-vs`, `gfx1013-container-ps`, `gfx1013-container-rect` (`vs`, `gs`, `ps`), and `gfx1013-direct-constant-ps` with stripped-`!llvm.ident` negative controls, and draw both direct pixel paths on WARP and hardware with mutated-output negative controls. - `docs/experiments/native-dxil-llvm-ident.md`: record the A/B isolation and RX 9070 XT + WARP verification results. Refs #2915 AI-assisted.@MasterDomino on GitHub · 2026-11-26 21:59 UTC · original · approved these changes
Review of head
22ae168f, on the host where #2915 was first reported.Environment: Windows 11 build 26300.9974, AMD Radeon RX 9070 XT (
1002:7550, driver 32.0.32029.2010) and WARP 10.0.26100.9818, MSVC 19.44.35221,releasepreset, Windows SDK 10.0.26100 DXC, D3D12 debug layer not enabled.Change:
!llvm.ident = !{!"x2w"}is emitted byDxilModule::finish_computeand bydirect_gfx1013_constant_pixel. Those are the only two places undersrc/that write DXIL module metadata (git grep 'dx\.version' -- src), so no direct emitter is left without it.With the PR:
31 tests: 30 passed, 1 skipped (77,
native_comparison_pso_warp). On the RX 9070 XT, every_hardwaretest passes:scalar_lds,adjacent_srv,mtbuf,indexed_atomic,dpp_mirrorandgraphics_wqm;native_pack_b32_f16_hardware(#2917), which ran its GPU readback on AMD for the first time, andnative_graphics_vertex_vcc_join_hardware(#2914);native_dxil_llvm_ident_hardware,native_lds,native_buffered_vertexandnative_sampled_pixel.native_wave_request_hardwareis excluded because this branch predates #2928. After #2928 it passed here with its GPU half included.Negative control: I checked out
src/dxil_module.handsrc/gfx1013_pixel.cppfrom7f951fd3(no!llvm.ident), rebuilt, and ran the eight direct-DXIL_hardwaretests above: 0 of 8 passed. Restoring the two files and rebuilding brings them back. So on this adapter the metadata alone decides it, which agrees with @thepatrickworld's dump (the null read at[rcx+40h]inamdxc64.dll).Other checks:
docs_links_check(32 files, 547 links),bidi_controls_checkandgit diff --checkpass. It merges cleanly on the currentcpp-migration,e4523d97, which includes #2928..github/workflows/windows.ymldoes not run for this base. The runs above and the author's are the evidence.AI-assisted; the commands above were run locally.