Skip to content

D3D12.X: retry driver-rejected compute PSOs without DXC GVN (#756) - #1398

Open
KarolKurzyna wants to merge 3 commits into
xcl-dev:mainfrom
KarolKurzyna:d3d12x/retry-compute-pso-no-gvn
Open

KarolKurzyna wants to merge 3 commits into
xcl-dev:mainfrom
KarolKurzyna:d3d12x/retry-compute-pso-no-gvn

Conversation

@KarolKurzyna

@KarolKurzyna KarolKurzyna commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of #1269 (addresses the DXC GVN compute PSO refusal pattern originally reported in #756, following @psuedo-tty's analysis of phi %dx.types.Handle triggers under DXC GVN, @pickles976's review on logging cache keys and driver refusal reasons, and @erickbobd's review and verification).

What is in it

  • Keeps the default GVN-enabled DXC build on the primary path so normal compile speed and code quality do not change.
  • Retries once with DXC -opt-disable gvn when the driver refuses CreateComputePipelineState on a translated console compute shader (crates/xcl/src/hle/d3d12x/real.rs, crates/xcl/src/shaders.rs), bounded to fast refusals (<= 5 s via NO_GVN_RETRY_MAX_REFUSAL) so multi-minute driver OOMs on huge programs do not pay for a second, larger no-GVN compile.
  • Keys DXC's disk cache on extra compiler flags via cache_key_for_toolchain_extra / cache_key_with_extra (crates/xcl/src/gpu/recomp/dxc.rs) so fallback DXIL is cached on disk without overwriting default entries.
  • Exposes console_to_dxil_without_gvn and console_to_dxil_in_without_gvn returning WithoutGvn (crates/xcl/src/gpu/recomp/pso.rs), bypassing ShaderCache and the translated memory cache and short-circuiting shaders over 8 MB HLSL (already compiled at -O0).
  • Reuses driver_cache on the retry DXIL, skips the second driver call if the fallback DXIL is byte-identical, and logs both DXIL disk-cache keys (<gvn_key> -> <no_gvn_key>) plus the first line of the driver rejection message (retained D3D12 debug-layer error on the calling thread or formatted HRESULT) in both translated_compute_pso_once and xcl shaders --pipelines (Pipelines::make).
  • Rebased onto main (b9b6ea6, PR Shaders: speed up translated pipeline compiles and add PSO measurements #1524 driver_compile_identified / huge_pso_bytes + PR gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426/Direct DXIL: memory windows through the descriptor heap (XCL_HEAP_WINDOWS) #1693 Direct DXIL + PR Recompiler: memory windows from the descriptor heap (no per-access switch) #680 heap windows): compile_console_shader preserves Direct DXIL routing while compile_console_shader_with_extra serves the HLSL -opt-disable gvn retry path, translated_compute_pso_once routes both attempts through driver_compile_identified (so NO_GVN_RETRY_MAX_REFUSAL measures driver-only compile time excluding slot wait time), and the no-GVN retry stays guarded by !HEAP_WINDOW_OOM.with(|o| o.get()) so with_switch_fallback runs in_switch_form first on heap-window E_OUTOFMEMORY.

Tested

  • Machine / toolchain: Windows 11 26H2 (26300.9974), Intel Core i5-14600K, NVIDIA GeForce RTX 3070 Ti (8192 MiB, driver 621.24 / 32.0.16.2124, SM 6.6, wave32), rustc 1.100.0 (stable-x86_64-pc-windows-msvc), dxcompiler 1.9.2602.17 (21d28f72) / dxil 1.9.2602.17 (Windows SDK 10.0.26100.0).
  • Full workspace test suite (.\scripts\test.ps1) on commit 834ea6d74f651df876542f034d54ca5b1aafbe97: 898 passed, 0 failed, 42 ignored across 20 workspace/integration test runs (unittests src\lib.rs: 849 passed, 0 failed, 22 ignored; GPU tests skipped on this adapter: 2 (no wave64), 1 (no heap windows), 1 (cannot disable the driver cache (Windows Developer Mode is required): ... 0x887A002D); zero warnings in modified files), including:
    • gpu::recomp::dxc::cache_tests::cache_key_tracks_extra_dxc_flags (passed)
    • gpu::recomp::dxc::cache_tests::dxil_cache_with_extra_flags_round_trip (passed; compiles a GVN-sensitive HLSL shader via live DXC with and without ["-opt-disable", "gvn"], asserts distinct cache entries and default_dxil != nogvn_dxil, and skips with runner::skip_test("no DXC") if absent)
    • hle::d3d12x::real::compute_pso_retry_tests::compute_pso_success_skips_no_gvn_retry (passed)
    • hle::d3d12x::real::compute_pso_retry_tests::compute_pso_refusal_retries_without_gvn (passed)
    • hle::d3d12x::real::compute_pso_retry_tests::compute_pso_slow_refusal_skips_no_gvn_retry (passed; verifies > 5 s refusals skip recompile/retry and <= 5 s still retries)
    • hle::d3d12x::real::compute_pso_retry_tests::compute_pso_refusal_skips_second_driver_call_when_dxil_unchanged (passed)
    • hle::d3d12x::real::compute_pso_retry_tests::compute_pso_refusal_propagates_failure_when_retry_fails (passed)
    • hle::d3d12x::real::compute_pso_retry_tests::first_error_line_picks_first_non_empty_trimmed_line (passed)
    • hle::d3d12x::real::compute_pso_retry_tests::format_driver_rejection_prefers_retained_first_line_and_falls_back_to_hresult (passed)
    • hle::d3d12x::real::big_compile_tests::* (8 passed, 0 failed)
  • Heap-window switch fallback interop ($env:XCL_HEAP_WINDOWS = "1"; cargo test -p xcl --test gpu_compute_e2e -- --nocapture) on 834ea6d74f651df876542f034d54ca5b1aafbe97: 4 passed, 0 failed, 0 ignored, including heap_window_out_of_memory_falls_back_to_the_switch_form (D3D12.X: the driver ran out of memory on a pipeline with heap windows – building it in the switch form (1 so far)).
  • Release build (cargo build --release -p xcl) succeeded cleanly after commit 834ea6d74f651df876542f034d54ca5b1aafbe97 with zero warnings in modified files.

Regression run

Baseline (main, warm DXIL/driver cache):

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 3070 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1630 (PresentX 1630)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14606 MB

This branch (834ea6d74f651df876542f034d54ca5b1aafbe97, warm DXIL/driver cache):

xcl-smoke v1
commit: 834ea6d74f651df876542f034d54ca5b1aafbe97
gpu: NVIDIA GeForce RTX 3070 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14541 MB

Not tested

  • AMD or Intel GPUs locally (wave64 hardware paths gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask and gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware skipped on this adapter: no wave64), shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (skipped: Windows Developer Mode not enabled to toggle driver cache), and XCL_SAMPLE_* sample-asset tests (not set locally).
  • A live driver refusal hitting the -opt-disable gvn fallback on this machine (RTX 3070 Ti, driver 621.24 builds the title's compute PSOs cleanly; see @erickbobd's --pipelines verification on RTX 5070 Ti 617.14 and @LocranKing / @DavidM1911 / @mastrr9 / @RodrigoTorreao reports below).

AI use

Implemented, tested, and drafted with Google Antigravity (Gemini 4 Neon); all unit tests, workspace tests, release build, and xcl-smoke runs were executed locally on the hardware listed above.

@pickles976

Copy link
Copy Markdown

Review from the DXC-memory lane: the design is right — default GVN path untouched, one retry with -opt-disable gvn scoped to driver rejection (not DXC failure), and crucially the successful variant caches under a key that includes the extra flags (cache_key_for_toolchain_extra, with both the key-distinctness and round-trip tests), so a warm cache pays one compile per shader forever after — the double-compile cost is cold-cache-only. Two small asks: ① log the retry with both cache keys (the rejected GVN build's and the accepted no-GVN one) so field reports can tell "slow first boot" from "GVN retry storm"; ② if the driver rejection message is retained, include its first line in the log — #756 evidence showed NVIDIA and AMD refuse with different text, and after #534-style OOM noise the distinction between "driver refused" and "compile died" is load-bearing for cohort triage. From psuedo-tty's phi-Handle analysis this should stay compute-scoped as written — no scope creep requested.

@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 732d3a5 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 757 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: cache_key_tracks_extra_dxc_flags, dxil_cache_with_extra_flags_round_trip, compute_pso_success_skips_no_gvn_retry, compute_pso_refusal_retries_without_gvn, compute_pso_refusal_skips_second_driver_call_when_dxil_unchanged, compute_pso_refusal_propagates_failure_when_retry_fails.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 757 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@KarolKurzyna
KarolKurzyna force-pushed the d3d12x/retry-compute-pso-no-gvn branch from 732d3a5 to 2b73d16 Compare November 24, 2026 16:03
KarolKurzyna added a commit to KarolKurzyna/xcl that referenced this pull request Nov 24, 2026
Addresses review feedback from @pickles976 on xcl-dev#1398:

- Return both DXIL disk-cache keys (default GVN build -> `-opt-disable gvn`
  build) via `WithoutGvn` and log them whenever a compute PSO is retried or
  refused.
- Capture the first non-empty line of any D3D12 debug-layer error emitted on
  the calling thread (or fall back to Windows' formatted HRESULT) and include it
  in `translated_compute_pso` and `Pipelines::make` retry/failure logs.

Assisted-by: Google Antigravity (Gemini 4 Neon)
@KarolKurzyna

Copy link
Copy Markdown
Author

@pickles976 Thanks for the review — addressed both asks in 2b73d16 (and rebased onto 345661b so the real.rs test-module conflict is cleared):

  1. Both DXIL disk-cache keys (rejected_key for the default GVN build -> retry_key for -opt-disable gvn) are now returned via WithoutGvn and logged in both runtime and xcl shaders --pipelines:
    • runtime success: D3D12.X: compute PSO with the translated console CS (... ms, retried without GVN (dxil cache <gvn> -> <no-gvn>; driver refused: <first line>))
    • runtime refusal on retry too: ... (<first_reason>; retry without GVN <gvn> -> <no-gvn> refused: <retry_reason>)
    • offline --pipelines: <name>: driver refused compute pipeline (<first line>); built without GVN (dxil cache <gvn> -> <no-gvn>, ... B DXIL)
  2. Driver rejection messages keep the first non-empty line of any retained error-severity D3D12 debug-layer callback on the calling thread (<hr>: <first line>), falling back to the first line of windows::core::Error::from_hresult(...).

Re-verified on 2b73d16 (RTX 3070 Ti): .\scripts\test.ps1 passed 774 passed, 0 failed, 41 ignored (2 wave64 tests skipped on this adapter; 0 warnings in modified files), release build succeeded, and 60 s xcl-smoke ran cleanly (1640 frames shown, 0 device removals / crashes, 14611 MB peak commit).

@futurepro62 Thank you for running and posting the RTX 5070 Ti verification report as well!

@erickbobd

Copy link
Copy Markdown

Test report for 2b73d16 (and 732d3a5 before it) on a card where the refusal does happen. I had started the same change after my plan in #1269; this PR covers it, so I am testing it here instead of opening a second one.

Tested

  • RTX 5070 Ti 16 GB (NVIDIA 617.14, 32-lane waves), Ryzen 5 5600X, 32 GB RAM, Windows 11 25H2 (26200), Rust 1.100.0, DXC 1.8.2502.11 (Windows SDK 10.0.26100), release build.
  • The five compute programs @psuedo-tty named in [OFFICIAL] Looking for PRs with shaders optimization #1269 (part 3), taken from a retail 1.0.2.1 pack: xcl shaders <folder> --precompile --only cs --pipelines --windows N, fresh XCL_DXIL_CACHE, XCL_PSO_DISK_CACHE=0, each program alone and the five together:
1 memory window 4 memory windows
main 930e8b4 made 4, refused 1 made 4, refused 1
this PR 732d3a5 made 5, refused 0 made 5, refused 0
this PR 2b73d16 made 5, refused 0 made 5, refused 0
  • The refused one on main is f377ca6830935314 (355 instructions), in the switch form. With this PR the driver refuses it with 0x8007000E (your new log line), it is compiled without GVN (60 388 B of DXIL with 1 window, 73 616 B with 4) and built. The other four build on main too: @psuedo-tty saw them refused only in Recompiler: memory windows from the descriptor heap (no per-access switch) #680's heap-window form, which is not on main.
  • So the end-to-end path your Not tested lists does work here, in the --pipelines pass. I have not seen a title run reach this program: 180 s smoke runs from a first boot built one compute pipeline.

Two points from the review, both checked here

  • The retry runs after every refusal. The refusals of NVIDIA 621.24 refuses heap-window compute programs with many memory reads (E_OUTOFMEMORY, #680) #756 come in under a second; the other kind is the driver running out of memory after a long compile of a huge program (27 – 284 s on @psuedo-tty's RTX 5090), and for those a second build without GVN is another long compile of larger DXIL (985 → 1 502 KB on a 21 615-instruction program in their table). The 8 MB HLSL check leaves out only the -O0 ones. A bound on how fast the refusal came (I used 5 s) would keep the retry to the case it is for.
  • dxil_cache_with_extra_flags_round_trip shows the flags get their own cache entry, but not that they change the DXIL. DXC 1.8.2502.11 takes any name after -opt-disable without an error: with gnv instead of gvn it compiled the same DXIL as the default build, byte for byte. A test that compiles a program GVN does change, with and without the flags, and asserts the two differ would catch a typo or a DXC that drops the option. This one passes here:
    RWByteAddressBuffer o : register(u0);
    [numthreads(64, 1, 1)] void main(uint3 t : SV_DispatchThreadID) {
        uint a = o.Load(t.x * 4);
        uint b = (a & 1) ? o.Load(t.x * 4 + 256) : o.Load(t.x * 4 + 256) + 1;
        o.Store(t.x * 4, b);
    }
    It returns without a word when DXC is missing; CONTRIBUTING asks for runner::skip_test("no DXC") there.

Not tested

  • This PR's whole suite and smoke run on this card (I ran both for my own version of the change, not for this PR's commits).
  • A title run that reaches a refused program; AMD and Intel; Linux / Wine; DXC 1.9.x.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and measurements and drafted this report.

@mastrr9

mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

Verified head 2b73d163719679c05e07d11276c46256fdf5c0f5 on Windows 11 / NVIDIA RTX 5080 (Blackwell):

  • cargo build --workspace: OK (0 new warnings)
  • cargo test --workspace -- --test-threads=4: 774 passed, 0 failed, 41 ignored

Clean build and full test suite pass on RTX 5080.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…in-place vtables

Integrates 16 upstream PRs (ivall#1380, ivall#1383, ivall#1384, ivall#1395, ivall#1398, ivall#1400,
ivall#1404, ivall#1405, ivall#1419, ivall#1420, ivall#1421, ivall#1423, ivall#1424, ivall#1427, ivall#1428, ivall#1429)
on top of the Linux/Proton fork, plus three Proton/vkd3d-proton fixes
caught during verification:
- Recompiler (ivall#1428): flatten IO_GROUP_LIMIT early-return in compute
  shaders so vkd3d-proton v3.1 dxil-spirv accepts the emitted CFG.
- D3D12.X (ivall#1395 + ivall#867): skip UnadoptGuard on in-place-patched vtables
  and restore native vtables in runner::submit_list when a prior test
  adopted the singleton ID3D12Device.
- Tests: match Wine centered default in window_position_modes.

Verified under GE-Proton11-14 (RX 9060 XT / RADV):
- gpu_sparse_vram_descriptors_buffers_and_xmem + gpu_valu_float_and_int
  + window_position_modes: 3 passed, 0 failed
- Broad sweep (present, real, sparse, clamp, dstorage, gpu_valu,
  gpu_typed_buffer): 82 passed, 0 failed, 1 ignored, 0 skipped
- 2.5 min retail title run (XCL_MEM_LIMIT=12G): 3,000+ frames at 30.0
  fps, 6.0-6.1 GB flat committed RAM, 6.4 GB local VRAM, 0 DS failures.
KarolKurzyna added a commit to KarolKurzyna/xcl that referenced this pull request Nov 24, 2026
Addresses two review points from @erickbobd on xcl-dev#1398:

- Guard `-opt-disable gvn` retries on `first_elapsed <= 5 s`
  (`NO_GVN_RETRY_MAX_REFUSAL`) in both `translated_compute_pso` and
  `Pipelines::make`, resetting `started` around uncached fallback driver
  compiles so slow multi-minute driver OOMs on huge programs do not pay for
  a second, larger no-GVN compile.
- Strengthen `dxil_cache_with_extra_flags_round_trip` with a GVN-sensitive
  HLSL compute shader and `assert_ne!(default_dxil, nogvn_dxil)`, plus
  `runner::skip_test("no DXC")` when DXC is absent.

Assisted-by: Google Antigravity (Gemini 4 Neon)
@KarolKurzyna

Copy link
Copy Markdown
Author

@erickbobd Thank you for running the end-to-end verification on f377ca6830935314 (made 5, refused 0) and for the review points — both are in 58bfd73:

  1. Bounded the -opt-disable gvn retry to fast driver refusals (first_elapsed <= 5 s via NO_GVN_RETRY_MAX_REFUSAL in translated_compute_pso and Pipelines::make, resetting the timer before uncached fallback compiles in try_create) with unit coverage in compute_pso_slow_refusal_skips_no_gvn_retry.
  2. Updated dxil_cache_with_extra_flags_round_trip to compile your GVN-sensitive HLSL shader, assert default_dxil != nogvn_dxil, and call runner::skip_test("no DXC") if DXC is absent.

Re-verified on RTX 3070 Ti (58bfd73): .\scripts\test.ps1 passed 775 passed, 0 failed, 41 ignored (2 wave64 tests skipped; 0 new warnings), release build ok, and 60 s xcl-smoke ok (1635 frames shown, 0 device removals / crashes, 14592 MB peak commit).

@mastrr9 Thanks as well for verifying 2b73d16 on RTX 5080!

@LocranKing

Copy link
Copy Markdown

Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32) test report on latest head 58bfd732328c7e294f535747d8bc68ab5af9336f.

Tested

  • Commit: 58bfd732328c7e294f535747d8bc68ab5af9336f (clean tree, merge-base 345661b)
  • Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.2101), rustc 1.100.0 (x86_64-pc-windows-msvc, MSVC 14.44.35207), DXC 1.9.2602.17 (SDK 10.0.26100.0), --release
  • cargo build --release --workspace: ok (exit 0)
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4: 775 passed, 0 failed, 41 ignored, exit 0
    • New/updated tests passed: gpu::recomp::dxc::cache_tests::dxil_cache_with_extra_flags_round_trip, hle::d3d12x::real::compute_pso_retry_tests::compute_pso_slow_refusal_skips_no_gvn_retry
    • SKIPPED (no wave64): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware

Regression run
main baseline (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1508 (PresentX 1508)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14730 MB

PR head (58bfd732328c7e294f535747d8bc68ab5af9336f):

xcl-smoke v1
commit: 58bfd732328c7e294f535747d8bc68ab5af9336f
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1603 (PresentX 1603)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14713 MB

Not tested: debug build, XCL_SAMPLE_* tests / xcl shaders --pipelines on this branch, AMD / native wave64 hardware, extended gameplay past 60 s.

AI use: Antigravity (Gemini 4 Hydrogen) ran the build, tests, and smoke runs and drafted this report from the command outputs.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.

Thanks!

@RodrigoTorreao

RodrigoTorreao commented Nov 24, 2026 •

Copy link
Copy Markdown

Update: re-tested on the rebased head a0f2cc6 (on main 9e3831e, with #680), unmodified. Same hardware as below.

  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug, XCL_SAMPLE_* set): 782 passed, 3 failed, 41 ignored.
    • The three failures are the same known RDNA2 packed-mip ones as below.
    • One test was SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form ("no heap windows"), because the suite ran without XCL_HEAP_WINDOWS.
  • XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 4 passed, 0 failed, including heap_window_out_of_memory_falls_back_to_the_switch_form. So the heap-window OOM fallback runs and passes on AMD native wave64.
  • The two ParaboloidShadows programs, alone and cold as below, one run each, on main 9e3831e and on a0f2cc6:
form DXIL result (main and this PR) xcl total time
switch (default) 363 460 B made 1, refused 0, in all 4 runs 20.7 – 27.0 s
heap windows (XCL_HEAP_WINDOWS=1) 301 872 B made 1, refused 0, in all 4 runs 16.0 – 17.1 s
  • The no-GVN retry and the heap-window fallback were not reached, since nothing was refused. With heap windows the DXIL is 17 % smaller and the run (DXC plus the driver) about 25 % shorter on this card. That is one run per cell, so the time is indicative only.

Test report on AMD (RDNA2, Windows driver) for 58bfd73, this PR's head, unmodified. As far as I can see in the thread, it is the first AMD run of it.

Short version: the suite passes apart from three known RDNA2 failures that are not from this PR. The two programs the AMD driver refused in my earlier whole-pack --pipelines pass build on this PR's base when compiled alone, so the retry never fires for them. That earlier refusal looks like load, not GVN, and on AMD one such refusal came in under the 5 s bound.

Tested

  • Hardware and software:
    • AMD Radeon RX 6750 XT 12 GB (RDNA2, native wave64), driver 32.0.21045.29003
    • Intel i5-14600KF, 16 GB RAM
    • Windows 11 25H2 build 26200.9974
    • Rust 1.100.0 (stable-x86_64-pc-windows-msvc)
    • DXC 1.9.2609.5 via XCL_DXC_DIR
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug, XCL_SAMPLE_RPF/DLLS/TTPF/BVH4 set to a retail title's files): 772 passed, 3 failed, 41 ignored, 0 SKIPPED.
  • The programs the AMD driver refused. In an earlier whole-pack xcl shaders <pack> --precompile --only cs --pipelines pass, the AMD driver refused meshlet_culling:CS_BatchCullMeshlets_ParaboloidShadows_445ed429 and its _Prev twin.
    • That pass ran on main 47efa2e, with 4 driver compiles and 19 DXC threads at once, under a 20 GB job memory cap.
    • Both programs translate to the same 372 212 B of DXIL. The refusals came after 10.4 s and 3.2 s. That build did not log the reason.
  • I re-ran each program alone and cold: its own folder, fresh XCL_DXIL_CACHE, XCL_PSO_DISK_CACHE=0, XCL_TRANSLATED_CACHE=0, XCL_PIPELINE_THREADS=1, and a renamed copy of xcl.exe per run so the AMD driver cache is cold. There were two interleaved rounds.
build DXIL result alone, cold
47efa2e (the build of the refused pass) 372 212 B made 1, refused 0 (23.3 s in the driver)
this PR's base 345661b 363 460 B made 1, refused 0 in all 4 runs
this PR 58bfd73 363 460 B made 1, refused 0 in all 4 runs; the no-GVN retry is never reached

Not tested

  • A GVN-pattern refusal on AMD. I have no program that the AMD driver refuses alone, so the retry path itself has not run on AMD.
  • CS_ScreenProbes_ActivateRays: 14.1 MB of DXIL, refused by the AMD driver in 24 s in the same pass. It is over the 8 MB HLSL check and the 5 s bound, so this PR leaves it alone.
  • A title run, or the suite on this PR's base 345661b on this card (the comparison above is against 47efa2e).
  • Other AMD generations and drivers.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests on my machine and wrote this report. The counts, times and sizes were copied from the test output and the xcl logs.

@KarolKurzyna
KarolKurzyna force-pushed the d3d12x/retry-compute-pso-no-gvn branch from 58bfd73 to a0f2cc6 Compare November 24, 2026 17:18
KarolKurzyna added a commit to KarolKurzyna/xcl that referenced this pull request Nov 24, 2026
Addresses review feedback from @pickles976 on xcl-dev#1398:

- Return both DXIL disk-cache keys (default GVN build -> `-opt-disable gvn`
  build) via `WithoutGvn` and log them whenever a compute PSO is retried or
  refused.
- Capture the first non-empty line of any D3D12 debug-layer error emitted on
  the calling thread (or fall back to Windows' formatted HRESULT) and include it
  in `translated_compute_pso` and `Pipelines::make` retry/failure logs.

Assisted-by: Google Antigravity (Gemini 4 Neon)
KarolKurzyna added a commit to KarolKurzyna/xcl that referenced this pull request Nov 24, 2026
Addresses two review points from @erickbobd on xcl-dev#1398:

- Guard `-opt-disable gvn` retries on `first_elapsed <= 5 s`
  (`NO_GVN_RETRY_MAX_REFUSAL`) in both `translated_compute_pso` and
  `Pipelines::make`, resetting `started` around uncached fallback driver
  compiles so slow multi-minute driver OOMs on huge programs do not pay for
  a second, larger no-GVN compile.
- Strengthen `dxil_cache_with_extra_flags_round_trip` with a GVN-sensitive
  HLSL compute shader and `assert_ne!(default_dxil, nogvn_dxil)`, plus
  `runner::skip_test("no DXC")` when DXC is absent.

Assisted-by: Google Antigravity (Gemini 4 Neon)
@KarolKurzyna

Copy link
Copy Markdown
Author

Rebased onto main (9e3831e, PR #680 heap windows) — new head is a0f2cc6.

@LocranKing @DavidM1911 @RodrigoTorreao thank you for the independent verifications on RTX 3060 Ti and RX 6750 XT! On @RodrigoTorreao's AMD load-refusal point: if a load refusal triggers the retry cleanly, logging the first-line driver reason alongside both DXIL keys should help surface why the driver refused it, and identical fallback DXIL still skips the second build.

#680 interop on a0f2cc6

  • Resolved the translated_compute_pso conflict by keeping Recompiler: memory windows from the descriptor heap (no per-access switch) #680's with_switch_fallback(|| translated_compute_pso_once(...)) wrapper.
  • Guarded the -opt-disable gvn retry inside translated_compute_pso_once with if hr < 0 && !HEAP_WINDOW_OOM.with(|o| o.get()) so heap-window E_OUTOFMEMORY reaches with_switch_fallback (in_switch_form) first rather than retrying with -opt-disable gvn early; if the switch-form pipeline still refuses quickly (<= 5 s), -opt-disable gvn retries cleanly inside that pass.

Re-verified on a0f2cc6 (RTX 3070 Ti, DXC 1.9.2602.17)

  • .\scripts\test.ps1: 785 passed, 0 failed, 41 ignored across 20 runs (unittests src\lib.rs: 736 passed, 0 failed, 21 ignored; GPU tests skipped on this adapter: 2 (no wave64), 1 (no heap windows)).
  • $env:XCL_HEAP_WINDOWS = "1"; cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 4 passed, 0 failed, 0 ignored, including heap_window_out_of_memory_falls_back_to_the_switch_form.
  • Release build (cargo build --release -p xcl) + 60 s scripts/smoke.ps1: exit: 0x0, 1639 frames (PresentX 1639), 60 60 60, 0 device removals/crashes, 14594 MB peak commit.

@RodrigoTorreao

Copy link
Copy Markdown

@KarolKurzyna I re-tested the rebased head a0f2cc6 on the RX 6750 XT (RDNA2, native wave64) and updated my report above: #1398 (comment)

  • heap_window_out_of_memory_falls_back_to_the_switch_form, which was skipped on your 3070 Ti, runs and passes here with XCL_HEAP_WINDOWS=1. It was 4/4 in gpu_compute_e2e.
  • The full suite gives 782 passed, 3 failed (the known RDNA2 packed-mip ones), 41 ignored.
  • The two ParaboloidShadows programs build cold in both forms (switch 363 460 B, heap windows 301 872 B), so neither the retry nor the fallback was reached by a real program.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…direct DXIL)

Brings in upstream xcl-dev#680 (descriptor-heap memory windows without per-access
switches, with switch fallback) and xcl-dev#1426 (direct RDNA2 -> DXIL backend
behind XCL_DIRECT_DXIL=1 / XCL_DIRECT_DXIL=all, bypassing HLSL and DXC).
Retains xcl-dev#1398 no-GVN retry, xcl-dev#1410 wave64 logging, and xcl-dev#1428 folded X
dispatch group limit alongside xcl-dev#680 and xcl-dev#1426.
KarolKurzyna added a commit to KarolKurzyna/xcl that referenced this pull request Nov 24, 2026
Addresses review feedback from @pickles976 on xcl-dev#1398:

- Return both DXIL disk-cache keys (default GVN build -> `-opt-disable gvn`
  build) via `WithoutGvn` and log them whenever a compute PSO is retried or
  refused.
- Capture the first non-empty line of any D3D12 debug-layer error emitted on
  the calling thread (or fall back to Windows' formatted HRESULT) and include it
  in `translated_compute_pso` and `Pipelines::make` retry/failure logs.

Assisted-by: Google Antigravity (Gemini 4 Neon)
KarolKurzyna added a commit to KarolKurzyna/xcl that referenced this pull request Nov 24, 2026
Addresses two review points from @erickbobd on xcl-dev#1398:

- Guard `-opt-disable gvn` retries on `first_elapsed <= 5 s`
  (`NO_GVN_RETRY_MAX_REFUSAL`) in both `translated_compute_pso` and
  `Pipelines::make`, resetting `started` around uncached fallback driver
  compiles so slow multi-minute driver OOMs on huge programs do not pay for
  a second, larger no-GVN compile.
- Strengthen `dxil_cache_with_extra_flags_round_trip` with a GVN-sensitive
  HLSL compute shader and `assert_ne!(default_dxil, nogvn_dxil)`, plus
  `runner::skip_test("no DXC")` when DXC is absent.

Assisted-by: Google Antigravity (Gemini 4 Neon)
@KarolKurzyna
KarolKurzyna force-pushed the d3d12x/retry-compute-pso-no-gvn branch from a0f2cc6 to 85ca7be Compare November 24, 2026 19:56
@KarolKurzyna

Copy link
Copy Markdown
Author

@RodrigoTorreao Thanks for re-testing a0f2cc6 on RX 6750 XT (4/4 in XCL_HEAP_WINDOWS=1 gpu_compute_e2e)!

Rebased onto main (6c89285, PR #1426 Direct DXIL + PR #1693 + PR #1195/#1288) — new head is 85ca7be.

Main 6c89285 interop

  • compile_console_shader (crates/xcl/src/gpu/recomp/pso.rs) preserves gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426's Direct DXIL routing (direct_compute / direct_graphics), while compile_console_shader_with_extra serves the HLSL -opt-disable gvn retry path.
  • Preserved !HEAP_WINDOW_OOM.with(|o| o.get()) around the no-GVN retry inside translated_compute_pso_once (crates/xcl/src/hle/d3d12x/real.rs).

Re-verified on 85ca7be (RTX 3070 Ti, DXC 1.9.2602.17)

  • .\scripts\test.ps1: 872 passed, 0 failed, 42 ignored across 20 runs (unittests src\lib.rs: 823 passed, 0 failed, 22 ignored; GPU tests skipped on this adapter: 2 (no wave64), 1 (no heap windows)).
  • $env:XCL_HEAP_WINDOWS = "1"; cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 4 passed, 0 failed, 0 ignored, including heap_window_out_of_memory_falls_back_to_the_switch_form.
  • Release build (cargo build --release -p xcl) + 60 s scripts/smoke.ps1: exit: 0x0, 1632 frames (PresentX 1632), 60 60 60, 0 device removals/crashes, 14540 MB peak commit.

)

NVIDIA D3D12 drivers can fail CreateComputePipelineState with
E_OUTOFMEMORY (0x8007000E) when DXC's GVN pass merges descriptor heap
handles into `phi %dx.types.Handle`, as diagnosed by @psuedo-tty in

Keep the fast GVN-optimized DXIL build on the primary path and retry
once with `-opt-disable gvn` only when the driver rejects the PSO:

- Key DXC's disk cache on extra compiler flags (`cache_key_for_toolchain_extra`)
  so fallback DXIL is cached on disk without overwriting default entries.
- Add `console_to_dxil_without_gvn` / `console_to_dxil_in_without_gvn`
  bypassing `ShaderCache` and the `translated` memory cache, and skip
  recompiling >8 MB HLSL already compiled at `-O0`.
- Retry once on driver failure in `translated_compute_pso` (reusing the
  driver blob cache path) and in `xcl shaders --pipelines` (`Pipelines::make`).

Fixes xcl-dev#756. Part of xcl-dev#1269.

Assisted-by: Google Antigravity (Gemini 4 Neon)
Addresses review feedback from @pickles976 on xcl-dev#1398:

- Return both DXIL disk-cache keys (default GVN build -> `-opt-disable gvn`
  build) via `WithoutGvn` and log them whenever a compute PSO is retried or
  refused.
- Capture the first non-empty line of any D3D12 debug-layer error emitted on
  the calling thread (or fall back to Windows' formatted HRESULT) and include it
  in `translated_compute_pso` and `Pipelines::make` retry/failure logs.

Assisted-by: Google Antigravity (Gemini 4 Neon)
Addresses two review points from @erickbobd on xcl-dev#1398:

- Guard `-opt-disable gvn` retries on `first_elapsed <= 5 s`
  (`NO_GVN_RETRY_MAX_REFUSAL`) in both `translated_compute_pso` and
  `Pipelines::make`, resetting `started` around uncached fallback driver
  compiles so slow multi-minute driver OOMs on huge programs do not pay for
  a second, larger no-GVN compile.
- Strengthen `dxil_cache_with_extra_flags_round_trip` with a GVN-sensitive
  HLSL compute shader and `assert_ne!(default_dxil, nogvn_dxil)`, plus
  `runner::skip_test("no DXC")` when DXC is absent.

Assisted-by: Google Antigravity (Gemini 4 Neon)
@KarolKurzyna
KarolKurzyna force-pushed the d3d12x/retry-compute-pso-no-gvn branch from 85ca7be to 834ea6d Compare November 24, 2026 20:11
@KarolKurzyna

Copy link
Copy Markdown
Author

Rebased onto main (b9b6ea6, including PR #1524 driver_compile_identified / huge_pso_bytes, PR #1689, and PR #819) — new head is 834ea6d, and updated the PR description to frame #1269 as the active tracking issue with closed #756 as background.

#1524 interop on 834ea6d

  • translated_compute_pso_once (crates/xcl/src/hle/d3d12x/real.rs) routes both the default GVN compile and the -opt-disable gvn retry through driver_compile_identified and gate_compute_driver_compile.
  • NO_GVN_RETRY_MAX_REFUSAL (<= 5 s) now checks the driver-only duration returned by driver_compile_identified (excluding huge-pipeline slot wait time).

Re-verified on 834ea6d (RTX 3070 Ti, DXC 1.9.2602.17)

  • .\scripts\test.ps1: 898 passed, 0 failed, 42 ignored across 20 runs (unittests src\lib.rs: 849 passed, 0 failed, 22 ignored, including big_compile_tests 8/8 and compute_pso_retry_tests 7/7; GPU tests skipped on this adapter: 2 (no wave64), 1 (no heap windows), 1 (cannot disable the driver cache (Windows Developer Mode is required): ... 0x887A002D)).
  • $env:XCL_HEAP_WINDOWS = "1"; cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 4 passed, 0 failed, 0 ignored, including heap_window_out_of_memory_falls_back_to_the_switch_form.
  • Release build (cargo build --release -p xcl) + 60 s scripts/smoke.ps1: exit: 0x0, 1631 frames (PresentX 1631), 60 60 60, 0 device removals/crashes, 14541 MB peak commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants