Repository navigation
Conversation
…ker::Link Fix two linked-compilation bugs in dxc.rs introduced alongside accessor-library linking (xcl-dev#174): 1. Keep LINK_GATE open and propagate transient E_OUTOFMEMORY errors directly from compile_linked_or_fallback instead of permanently disabling linked compilation and falling back to the heavier monolithic compile_whole path under memory pressure (preserving non-"dxc: " error prefixes so transient OOM is never negatively cached). Deterministic non-OOM failures still close LINK_GATE once and fall back to compile_whole. 2. Forward the shader's auto-selected optimization tier (-O1 above 1 MiB, -O0 -opt-disable debug-nops above UNOPTIMISED_ABOVE, suppressed when extra already specifies -O*/-Od) and caller extra arguments (e.g. -Gis) to IDxcLinker::Link via link_opt_args(program_src_len, extra) instead of passing None, and guard CreateBlob length with u32::try_from. Add unit tests in dxc::accessor_library_tests covering OOM gate retention, link_opt_args tier boundaries, and live DXC IDxcLinker::Link argument forwarding. Part of xcl-dev#174 Part of xcl-dev#1566 Part of xcl-dev#1269 Part of xcl-dev#1833 Assisted-by: Google Antigravity (Gemini 4 Neon)
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! — Devin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.