Skip to content

Recompiler: identify direct DXIL shaders for AMD drivers - #1

Closed
philip-roy-jones wants to merge 1 commit into
bmjask:shaders/direct-dxil-mainfrom
philip-roy-jones:dxil-ident-rx580
Closed

philip-roy-jones wants to merge 1 commit into
bmjask:shaders/direct-dxil-mainfrom
philip-roy-jones:dxil-ident-rx580

Conversation

@philip-roy-jones

@philip-roy-jones philip-roy-jones commented Nov 24, 2026 •

Copy link
Copy Markdown

The upstream review is in ivall/xcl#1471. It contains the same fix commit, 2146140, stacked on xcl-dev#1426.

Part of xcl-dev#1269. This is a one-commit fix for the direct-DXIL branch in xcl-dev#1426.

On the Radeon RX 580, Microsoft's validator accepted the direct compute kernel, but creating its pipeline terminated the test process in amdxc64.dll (0xc0000005). The HLSL reference ran on the same card. Adding the LLVM producer metadata lets the direct kernel run and return the expected values. @Sr-0w reported the same metadata requirement for the assembly path on RDNA3. Original finding

What is in it

  • gpu/dxil/shader.rs emits !llvm.ident with producer XCL in the shared shader constructor. The regression in graphics_tests.rs checks the referenced metadata node in compute, vertex, pixel and mesh disassembly. The README documents the opt-in switches.

Tested

  • Commit 2146140bbc7c8cd022714c3c40d023875b74ee36, Radeon RX 580 (driver 31.0.21925.1001, native wave64), Ryzen 7 7700X, Windows 11 Pro 26200.9974, Rust 1.100.0 MSVC, DXC 1.9.2609.5. Debug tests and release smoke builds.
  • cargo test -p xcl --lib gpu::dxil:: -- --test-threads=4 --nocapture reported 66 passed, 0 failed, 2 ignored. 17 of the passes were hardware skips (15 wave32, 2 mesh). The direct compute kernel returned the expected buffer, and direct VS/PS drew the reference triangle. The new metadata check failed on the parent and passed here.
  • With XCL_DIRECT_DXIL=1, cargo test -p xcl --lib -- gpu::recomp::tests::gpu_divergence_through_exec gpu::recomp::tests::gpu_scalar_loop_and_scc --exact --test-threads=1 --nocapture reported 2 passed, 0 failed, 0 ignored.
  • cargo build --workspace succeeded. cargo test --workspace --no-fail-fast -- --test-threads=4 lost its library test process. Running the 514 unreported library cases separately completed the inventory. Across the workspace, 795 reported passing, 21 failed, 1 crashed and 43 were ignored. 19 of the passes printed hardware skips (15 wave32, 4 mesh). All 22 unsuccessful tests also failed individually on the clean parent 065aef3, including the process exit in gpu_wave64_ps_whole_wave_reductions.
  • The Windows CI command .\scripts\test.ps1 --skip test_title_runs_and_game_folder_is_untouched passed locally with DXC 1.9 and hardware adapter selection disabled. It reported 816 passed, 0 failed, 43 ignored and 1 filtered. 231 passes were explicit skips. A timer assertion failed during a concurrent run and passed on the isolated rerun. With the installed Windows SDK DXC 1.8.2502.11, the library test process exited in dxil.dll on both the parent and this head.
  • On four small retail compute shaders, direct translation produced signed DXIL in 24.9 and 25.7 ms total across two passes. HLSL + DXC took 273.9 and 274.4 ms. The RX 580 created every pipeline in both forms. Direct DXIL totalled 361,960 bytes, HLSL-compiled DXIL 62,208 bytes. A release harness timed pso::console_to_dxil_in with four memory windows and fresh XCL caches, in HLSL/direct/direct/HLSL order. It selected the first four distinct native-wave64 CS records with 64–4096 input bytes (156–2916 bytes observed). Validation and pipeline creation were outside the timer.

Regression run

scripts/smoke.ps1 -Game <retail folder> -Xcl <release exe> -Seconds 60 with the same RX 580, XCL_DIRECT_DXIL=1 and separate empty XCL caches. Both processes exited early with 0xc0000409. The smoke helper recorded no final frame total. Repeating both runs with Windows SDK DXC 1.8 and XCL_DIRECT_DXIL=all produced the same exit on both revisions. The WARP software renderer reported device removal on both.

Upstream main

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: Radeon RX 580 Series
title: Retail
seconds: 60
exit: 0xc0000409
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0 34 48
device removals: 0
crashes: 0
peak commit: 9946 MB

PR head

xcl-smoke v1
commit: 2146140bbc7c8cd022714c3c40d023875b74ee36
gpu: Radeon RX 580 Series
title: Retail
seconds: 60
exit: 0xc0000409
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0 33 47
device removals: 0
crashes: 0
peak commit: 9904 MB

Not tested

  • Large compute programs, driver compile time and gameplay. This card cannot execute the wave32 and mesh-shader cases. The fuzz cases performed validator checks only. Optional sample variables were unset for the workspace suite. A full 60-second retail run on a mesh-capable GPU is still needed.
  • Hosted Windows CI has started no jobs. A maintainer with write access to this fork can approve the run. GitHub Actions

AI use

  • Codex (GPT-6) diagnosed the failure, wrote the fix and regression test, ran the comparisons, and prepared this PR.

The Radeon RX 580 driver exited while creating a pipeline from a validated direct compute shader. Emit the XCL producer in llvm.ident for each shader stage. The kernel now runs with the expected output and the direct vertex and pixel shaders draw the reference triangle.

Assisted-by: Codex (GPT-6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant