DXC: keep LINK_GATE open on OOM and forward opt/extra args to IDxcLinker::Link #2575
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2585"
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?
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T00:23:28Z.
Part of #174
Part of #1566
Part of #1269
Part of #1833
What is in it
Fixes two linked-compilation bugs in
crates/xcl/src/gpu/recomp/dxc.rsintroduced alongside accessor-library linking (#174; touches onlycompile_here,LinkGatehelpers,compile_linked, andaccessor_library_tests):LINK_GATEopen and avoid monolithic fallback on transientE_OUTOFMEMORY: Previously,compile_heretreated everycompile_linkederror as a permanent toolchain failure — closingLINK_GATEfor the entire process and immediately falling back to the heavier monolithiccompile_wholepath even on transientE_OUTOFMEMORY(0x8007000E). Addedis_oom_error(case-insensitive check for0x8007000e/e_outofmemory) andcompile_linked_or_fallback(gate, linked, whole): transient OOM propagatesErr(e)directly without closinggateor invokingwhole(preserving non-"dxc: "prefixes socompile_cached_in_observednever negatively caches OOM), while deterministic non-OOM failures still closeLINK_GATEonce and fall back tocompile_whole.extraarguments toIDxcLinker::Linkand guardCreateBloblength: Previously,compile_linkedalways passedNonetoIDxcLinker::Link, discarding the shader's auto-selected optimization tier (-O1above1 MiB,-O0 -opt-disable debug-nopsaboveUNOPTIMISED_ABOVE) and callerextraflags (such as-Gis) at link time, and truncateddxil.len() as u32inCreateBlob. Addedlink_opt_args(src_len, extra)(using the HLSLprogram.len()captured before library compilation, suppressed whenextraalready passes-O*/-Od), guardedCreateBlobwithu32::try_from(dxil.len()), and passed the wide-string argument slice toIDxcLinker::Link.gpu::recomp::dxc::accessor_library_tests):compile_linked_or_fallback_keeps_gate_open_on_oom(pure CPU,0skips): verifies0x8007000E/E_OUTOFMEMORYkeepLinkGateopen and skipwhole, while deterministic failures closeLinkGateand fall back towhole.link_opt_args_selects_tier_and_preserves_extra(pure CPU,0skips): verifies<= 1 MiB,> 1 MiB,> UNOPTIMISED_ABOVE, explicit-O2/-Odsuppression, and-Gispreservation.compile_linked_forwards_opt_and_extra_args_to_dxc_linker(live DXC, skips only ifdxc::location().is_err()): compiles, validates, and disassembles linked compute shaders on DXC with[],["-O1"],["-O0", "-opt-disable", "debug-nops"],["-Gis"], and a> 1 MiBprogram.Tested
origin/main(08db8020d323bf478964fcc586152cce54959cfc):compile_hereunconditionally closedLINK_GATEand rancompile_wholeonE_OUTOFMEMORY, andcompile_linkedpassedNonetoIDxcLinker::Link.1.9.2609.5IDxcLinker::Linkaccepts[],["-O1"],["-O0", "-opt-disable", "debug-nops"], and["-Gis"]with valid DXIL output and expected IR differences (-O0preservesfadd fast float/mul i32with0dx.op.nop,-Gispreserves strictfadd floatwithoutfast).0compiler warnings indxc.rs):cargo test --release -p xcl --lib gpu::recomp::dxc:: -- --test-threads=1 --nocapture:23 passed; 0 failed; 0 ignored(0skipped).cargo test --release -p xcl --lib gpu::recomp::link_tests:: -- --test-threads=1 --nocapture:2 passed; 0 failed; 1 ignored(bench_memory_window_accessors),0skipped.XCL_ADAPTER=warp,XCL_WARP=1):cargo test --release -p xcl --lib gpu::recomp::dxc:: -- --test-threads=1 --nocapture:23 passed; 0 failed; 0 ignored(0skipped).cargo test --release -p xcl --lib gpu::recomp::link_tests:: -- --test-threads=1 --nocapture:2 passed; 0 failed; 1 ignored(linked_programs_keep_their_declarations0skips;gpu_linked_memory_accessorscleanly reportedSKIPPED: no wave64).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture):37test binaries:1432 passed; 0 failed; 47 ignored.29pre-existing runtimeSKIPPEDmessages (21no wave64on wave32-only RTX 4060,3per-lane form: refused,3no D3D12 debug layer/no d3d12SDKLayers.dll,1cannot disable the driver cache,1no heap windows).Regression run
Before (
origin/main08db8020d323bf478964fcc586152cce54959cfc):After (
fix-dxc-linked-oom-and-opt-args2066b32e5d12dd9da29bf66ee4921407723ca54e):Both 60 s runs reach steady
60presents per 2 s (60 61 60vs60 60 60) with0device removals,0crashes,1570vs1440frames shown (109.0%), and14011 MBvs14013 MBpeak commit.Not tested
E_OUTOFMEMORYinjection insideIDxcLinker::Linkor a> 4 GiBDXIL library blob (OOM gate preservation is covered directly bycompile_linked_or_fallback_keeps_gate_open_on_oom).d3d12SDKLayers.dllis not installed on this machine) and native wave64 GPU tests (RTX 4060 is wave32-only).AI use
Written and verified with Google Antigravity (Gemini 4 Neon). All code changes, live DXC 1.9
IDxcLinker::Linkargument checks, targeted RTX 4060 and WARP test runs, the full release workspace suite, and both paired 60 s GPU smoke runs were executed and checked locally.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-26T00:40:45Z.
Full-suite run, since this PR has no test report yet. Tested exact head
2066b32e(on its base08db802).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1420 passed, 0 failed, 45 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,dispatch_chain_native_wave64_builds_whole,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.compile_linked_or_fallback_keeps_gate_open_on_oom,link_opt_args_selects_tier_and_preserves_extra,compile_linked_forwards_opt_and_extra_args_to_dxc_linker.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1431 passed, 0 failed, 47 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main08db8020too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T01:09:45Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:40:43Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:25:32Z.
Triage (#1607) – head
2066b32Main already has this change. Commit
f470851, "DXC: keep LINK_GATE open on OOM and forward opt/extra args to IDxcLinker::Link" (merged with #2959), addsis_oom_error,compile_linked_or_fallback,link_opt_argsand theLinkargument forwarding incompile_linkedto dxc.rs. It includes the same three tests. #3099 only carries these lines from its base.Recommendation: close (superseded by main commit
f470851).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:54:52Z.
Closing as superseded: this change is already on
main(f4708511). PR's changed lines are identical to mainf4708511DXC: keep LINK_GATE open on OOM and forward opt/extra args (compared line by line, no difference)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed