Skip to content

Shaders: a DXC compile out of memory runs again with no other compile - #1710

Open
tippythetaidum wants to merge 1 commit into
xcl-dev:mainfrom
tippythetaidum:shaders/dxc-oom-retry-alone
Open

tippythetaidum wants to merge 1 commit into
xcl-dev:mainfrom
tippythetaidum:shaders/dxc-oom-retry-alone

Conversation

@tippythetaidum

@tippythetaidum tippythetaidum commented Nov 24, 2026 •

Copy link
Copy Markdown

A DXC compile that fails with E_OUTOFMEMORY leaves its pipeline without a translation for the rest of the run: pso_async keeps the failed build, and every Dispatch with that pipeline is skipped. Running out of memory is temporary, but nothing ever compiles the program again. It happens during a retail title's world loading. There, wait_for_memory lets up to WANTED_AT_ONCE compiles that the title's threads wait for run at once, however little commit is left. Big programs fail beside them.

With this change the DXC worker gives up its slot. Once no other compile is running (or after a minute, as in wait_for_memory), it compiles the program once more. While that compile runs, wait_for_memory lets no other compile in (again for a minute at most), so the retry has the memory to itself. Only E_OUTOFMEMORY from DXC's Compile call is retried. Compile errors and panics are returned as before.

What is in it

  • crates/xcl/src/gpu/recomp/dxc.rs:
    • alone() and AloneSlot: a slot once no compile holds one. While it is held, ALONE keeps wait_for_memory from admitting another compile.
    • out_of_memory(): DXC's Compile failed with 0x8007000E.
    • again_alone_when_out_of_memory(), used by the DXC workers.
  • Tests:
    • dxc_out_of_memory_is_told_from_other_failures.
    • a_compile_out_of_memory_runs_again_alone_after_its_slot_is_given_up: order of slot release, waiting to be alone and the second compile; one retry only.
    • no_compile_starts_while_one_runs_alone: a compile the title waits for, with plenty of memory, does not start until the alone slot is dropped. It fails with the ALONE check disabled; I checked this.
    • other_compile_results_are_not_compiled_again.

Tested

  • NVIDIA GeForce RTX 5080 16 GB (driver 32.0.16.2114, 32-lane waves), AMD Ryzen 7 9800X3D, 31 GB RAM + 32 GB page file, Windows 11 Home 26200, rustc 1.97.1. Release build for the title runs, debug for the tests.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 89faa8d: 963 passed, 0 failed, 43 ignored.
  • main c4d37be: 958 passed, 1 failed, 43 ignored. The failure is test_title_draws_with_a_root_signature_under_the_debug_layer: its test title made no progress for 10 min and I ended it. That test passed on main 6c89285 on this machine, so it is intermittent here. It did not hang on this PR's head.
  • SKIPPED: 22 lines, the same on main c4d37be:
    • 18 are no wave64: the wave64 variants in gpu::recomp::lower / lower_dxil, plus gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.
    • 3 are per-lane forms refused (… #1426 semantics differ from the console's), in lower_dxil::tests::f16_programs_on_the_gpu / f32_programs_on_the_gpu.
    • 1 is heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Retail title, 240 s, XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=240, XCL_PRESS_A_AT every 4 s from 16 to 120 s. This was measured on edf962e, the first version of this change, which did not yet keep other compiles out during the retry:
    • main c160d86: dxil_cache.compilation_failures 1. The failure was a 1 467 975 B cs_6_6 program: "Compile: Not enough memory resources are available to complete this operation. (0x8007000E)".
    • edf962e: DXC ran out of memory 3 times (1 017 420, 510 466 and 2 629 046 B of HLSL). Each program compiled on its second attempt, and compilation_failures was 0.
    • Both runs still ended in the title's own watchdog write to address 0 at +0x23cf683. This change does not fix that stop.

Regression run
main c4d37be:

xcl-smoke v1
commit: c4d37bec1bb4286eb373aea963404a23f13401fa
gpu: NVIDIA GeForce RTX 5080
title: 8b0daefa
seconds: 60
exit: 0x0
frames shown: 1278 (PresentX 1279)
presents per 2 s (last 3): 28 24 60
device removals: 0
crashes: 0
peak commit: 27825 MB

this PR 89faa8d:

xcl-smoke v1
commit: 89faa8d3fd63ac57782e0d13529f255667243484
gpu: NVIDIA GeForce RTX 5080
title: 8b0daefa
seconds: 60
exit: 0x0
frames shown: 1599 (PresentX 1600)
presents per 2 s (last 3): 56 60 60
device removals: 0
crashes: 0
peak commit: 19200 MB

Run back to back, main first.

Not tested

AI use

  • Claude Code, Claude Opus 5.5: found the failure in the run's report.json, wrote the code, the tests and this description, and ran the builds, tests and title runs listed above. The account owner directed the work.

🤖 Generated with Claude Code

@nnonno91

nnonno91 commented Nov 24, 2026 •

Copy link
Copy Markdown

Retest on 89faa8d3fd63ac57782e0d13529f255667243484

The original worker scenario is fixed. A fresh job dequeued after the retry acquired its slot stayed out of DXC until the retry finished. A narrower admission race still reproduced when a job had already passed the ALONE check.

  • Clean head on the AMD Radeon iGPU, with the same Windows, driver and toolchain as below. cargo build --workspace --locked passed, and cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output reported 963 passed, 0 failed, 43 ignored. Eight explicit skips were counted as passes: four entries from f16_programs_on_the_gpu (per-lane arithmetic and packed modifiers in wave32 and wave64), two from f32_programs_on_the_gpu (per-lane conversion in wave32 and wave64), pso_measurement_compiles_an_exact_synthetic_record (driver-cache disable returned 0x887A002D) and heap_window_out_of_memory_falls_back_to_the_switch_form (heap windows off).
  • With XCL_DXC_THREADS=3 and temporary test hooks, cargo test --locked -p xcl --lib gpu::recomp::dxc::worker_retry_probe -- --test-threads=1 --nocapture reported 2 passed, 0 failed, 0 ignored per adapter, no skips. In the injected-OOM worker test, the new job reached the worker queue while the retry held its slot, stayed blocked during the 350 ms hold, and completed after release. All three shaders matched 64/64 output words on each GPU.
  • In a separate scheduler test, I paused a thread in wait_for_memory immediately after it passed the ALONE check and before it could take a slot. Then I acquired the retry slot with alone() and resumed the thread. In both runs the thread obtained a slot during the hold and observed ALONE=true, WORKING=2. The hook controls the ordering and the test asserts that observed state. The test did not run two DXC calls at once.

The temporary hooks were removed. Real memory exhaustion and the frequency of that ordering under normal scheduling remain unmeasured. OpenAI Codex (GPT-6 family, exact variant unavailable) adapted the probes, ran the tests and checked this update.


Independent Windows test of edf962ebf6e8d7b7f071fec71fdde0d7cbf2bf0f. The retry recovered from an injected E_OUTOFMEMORY through the real worker pool. It started with the only compile slot, and a new job could acquire a second slot while the retry held its slot.

Tested

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62, native wave64) and NVIDIA GeForce RTX 5090 (32.0.16.1742). Rust 1.100.0 MSVC, Windows SDK DXC 1.8.2502.11, debug/test profiles. Adapters selected with XCL_ADAPTER.
  • On the clean head, cargo build --workspace --locked passed. cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output reported 861 passed, 0 failed, 42 ignored on AMD. All three new retry tests passed. One pass logged an explicit skip, heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.
  • With a temporary test hook at the DXC call site and XCL_DXC_THREADS=3, cargo test --locked -p xcl --lib gpu::recomp::dxc::worker_retry_probe::injected_oom_uses_the_worker_retry_path -- --exact --nocapture reported 1 passed, 0 failed, 0 ignored, no skips, on each adapter.
  • In both runs, one job held its slot while a second job's first attempt returned the same formatted HRESULT 0x8007000E as DXC. The second job dropped its slot and waited. When the first job completed, the retry entered with WORKING=1. I paused it immediately before the DXC call and submitted a third job through dxc::compile under normal memory admission. The third job entered with WORKING=2 and finished its DXC call while the retry's slot was still held. The retry then completed on its second attempt. Each compiled shader matched 64/64 output words on its GPU. The temporary instrumentation was removed.

Not tested

Real memory exhaustion, peak memory, simultaneous execution inside DXC, retail titles, or interactions with the other worker PRs.

AI use

OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary test, checked the runs, and wrote this report.

A compile that DXC gives up on with E_OUTOFMEMORY left its pipeline
without a translation for the rest of the run: pso_async stores the
failed build, and every Dispatch with it is skipped. In a 240 s run of
a retail title on main c160d86 (RTX 5080, 31 GB RAM) one 1.47 MB
compute program failed this way during world loading, while the
compiles the title's threads waited for ran beside it
(wait_for_memory lets up to WANTED_AT_ONCE of them in however little
commit is left).

The DXC worker now gives up its slot and, once no other compile is
running (or after a minute, as in wait_for_memory), compiles the
program once more. While that compile runs, wait_for_memory lets no
other compile in (again for a minute at most), so the retry has the
memory to itself. Only E_OUTOFMEMORY from DXC's Compile call is
retried; compile errors and panics are not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tippythetaidum
tippythetaidum force-pushed the shaders/dxc-oom-retry-alone branch from edf962e to 89faa8d Compare November 24, 2026 21:47
@tippythetaidum

Copy link
Copy Markdown
Author

@nnonno91 thank you for the instrumented test. You were right: the retry waited until no compile was running before it started, but nothing kept new compiles out while it ran.

Fixed in 89faa8d (squashed into the one commit and rebased onto c4d37be). While the retry holds its AloneSlot, wait_for_memory admits no other compile, including ones the title waits for. This lasts for a minute at most, the same bound wait_for_memory already uses, so the title can't be held longer than today. The new test no_compile_starts_while_one_runs_alone checks it, and it fails when the check is disabled.

On 89faa8d, RTX 5080, cargo test --workspace --no-fail-fast -- --test-threads=4: 963 passed, 0 failed, 43 ignored. The new back-to-back smoke pair against main c4d37be is in the description.

I have not seen a real out-of-memory retry on this head yet. The description says so under Not tested.

Claude Code, Claude Opus 5.5 wrote this reply and the change; the account owner directed the work.

@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, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

PR #1710 verification

DXC retries a compile once after E_OUTOFMEMORY, releasing its original compile slot before it waits for an exclusive slot.

What is in it

  • OOM recognition, retry and slot coordination with four focused unit tests in crates/xcl/src/gpu/recomp/dxc.rs.

Tested

  • Clean PR checkout at 89faa8d. Fetched origin/main at aaa0936. The non-destructive git merge-tree --write-tree origin/main HEAD check exited 0 and returned tree b66f1e4a6ed734b9fcb0de826c7894c7da989a70.
  • STOR-WINLAB with Intel Arc A770 16 GiB (driver 32.0.101.9175, wave range 8-32, DoublePrecisionFloatShaderOps=0), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build 26200.9974, DXC/DXIL 1.9.2609.5 and rustc 1.100.0 (0ef1bc386 2026-11-09). Unoptimized dev and test profiles with debug info disabled.
  • cargo build --workspace and cargo test --workspace --no-run both succeeded outside the GPU lock.
  • Four focused commands ran outside the GPU lock with 4 passed, 0 failed, 0 ignored and 0 skip lines.
    • cargo test -p xcl --lib gpu::recomp::dxc::cache_tests::dxc_out_of_memory_is_told_from_other_failures -- --exact --show-output
    • cargo test -p xcl --lib gpu::recomp::dxc::cache_tests::a_compile_out_of_memory_runs_again_alone_after_its_slot_is_given_up -- --exact --show-output
    • cargo test -p xcl --lib gpu::recomp::dxc::cache_tests::no_compile_starts_while_one_runs_alone -- --exact --show-output
    • cargo test -p xcl --lib gpu::recomp::dxc::cache_tests::other_compile_results_are_not_compiled_again -- --exact --show-output
  • cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output ran in one pass inside Invoke-ArcTest.ps1. Across 20 test target summaries, libtest reported 944 passed, 19 failed and 43 ignored. Cargo and the lock wrapper exited 101 and 101 respectively.
  • The library target accounted for 18 failures. 14 reported CreateComputePipelineState with 0x80070057. Four others reported assertion mismatches for fused FMA overflow, implicit-LOD sampling, f16 high-half preservation and wave64 pixel reductions.
  • The e2e target accounted for one failure. test_title_runs_and_game_folder_is_untouched reported that the dynamic RSSetDepthBiasX check rendered blue where it expected green.
  • All four new DXC tests also passed within the workspace run.
  • The suite logged 25 SKIPPED lines across 15 test names. Skipped cases are excluded from coverage even when libtest marks the parent test passed.
    • SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
    • SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
    • SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)
    • SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2
    • SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
    • SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
    • SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))
  • Other early exits in the log cite absent retail fixtures, unavailable wave64, audio, the system xgameruntime.dll or heap windows.
  • Full test output and failure names are in pr1710-suite.log. Focused test output is in pr1710-focused.log.

Not tested

  • No retail-title regression smoke runs on main or the PR head. OOM was injected in the focused tests. A real DXC allocation failure under memory pressure and contention during exclusive-slot acquisition remain unverified.
  • The suite ran on the PR head only. Whether the same failures occur on main is unverified. AMD and NVIDIA GPUs and release builds were outside this run.

AI use

  • T3 Code / Codex (gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against pr1710-suite.log and published this report.

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.

4 participants