DXC: unload a candidate folder that is not a usable dxcompiler (#2413) #2633
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2643"
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 kotekompotek on 2026-11-26T04:52:02Z.
load()scans candidate folders for a usable DXC: it loadsdxil.dll(the signer) anddxcompiler.dll, and keeps the first folder whosedxcompiler.dllexportsDxcCreateInstance. Whendxcompiler.dllfailed to load, or loaded without the entry point,load()moved on withoutFreeLibrary– the failed folder'sdxil.dll(anddxcompiler.dll) stayed mapped for the rest of the process. A staledxil.dllin the loaded-module list is the one a later candidate'sdxcompiler.dllbinds by name when it loads its owndxildependency, so a bad early folder poisons the later good one. Fixes #2413 (the candidate-load half; the empty-blob half is #2580).What is in it
gpu/recomp/dxc.rs: the per-folder attempt istry_dirnow and frees both handles before moving on (opus.rsuses the sameFreeLibrarypattern).candidate_unload_tests: a mapped file refuses deletion on Windows, so each test copies a stand-in DLL into a temp candidate folder, runstry_dir, and deletes the files – a leaked module keeps its file locked. One test covers thedxcompiler.dll-won't-load path, the other the missing-DxcCreateInstancepath; both fail before the fix (PermissionDenied).Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on the head5371d1df: 1434 passed, 3 failed, 47 ignored (SKIPPED GPU tests: 357 – this adapter has no SM 6.6 / mesh shaders)cargo test -p xcl --lib candidate_unload: 2 passedHRESULT/0x80070057, no SM 6.6 PSOs); details in the Not tested sectionRegression run (0 s, default settings, a retail title)
main:
this PR:
Not tested
hle::d3d12x::vram::tests::gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark,shaders::pipeline_cap_tests::stale_blob_cannot_bypass_the_offline_pipeline_cap,shaders::pipeline_cap_tests::split_compute_program_prebuilds_and_caches_chain_pieces: fail onmainidentically (GTX 1050 is SM 6.5 max; driver answers0x80070057).-Seconds 0produces a clean run; frames shown is 0 in both blocks.peak commitreads either ~900 MB (title killed during DLL loading) or ~5.4 GB (title reached its GDK heap reservation) depending on kill-vs-init timing under load; both blocks here are the ~900 MB outcome of otherwise identical runs.AI use
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T05:07:51Z.
The three GPU tests listed as not tested (they fail on the GTX 1050, which has SM 6.5 at most) pass with this PR on two SM 6.6 cards, an RX 9070 XT and an RTX 3060. The 2 new tests pass too.
Head
5371d1dapplied onmainb49be18, debug, Windows 11 Pro 26200, card chosen withXCL_ADAPTER, each run with--nocapture:cargo test -p xcl --lib -- <filter>a_candidate_(a_candidate_without_dxc_create_instance_is_unloaded,a_candidate_whose_dxcompiler_dll_does_not_load_keeps_no_dxil)gpu_retire_queue_holds_heap_until_blocked_queue_passes_markpipeline_cap_tests(both blob tests and the cap test)recomp::dxc::Not tested: the whole suite with this PR, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by sage-sage on 2026-11-26T05:18:02Z.
Test report: passes on NVIDIA, and both new tests fail without the unloads. Exact head
5371d1df(its base is currentmainb49be18, so head = merged).Tested
cargo test --workspace -- --test-threads=4: 1437 passed, 0 failed, 47 ignored; bothcandidate_unload_testspassmainon this machine): 21 wave64 tests (NVIDIA is wave32 only), 3 per-lane wave32 f16/f32 forms (refused), 3 D3D12 debug layer (d3d12SDKLayers.dllnot installed), 1no heap windows, 1pso_measurement_compiles_an_exact_synthetic_record(Developer Mode off)FreeLibrarycalls intry_dirtaken out (the old behaviour, local only): both new tests fail,dxcompiler.dll still mapped – leaked/dxil.dll still mapped – leaked(Access is denied). So they cover the fix.Not tested
Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T08:47:37Z.
Review: COMMENTED
At exact head
5371d1dfon current mainb49be18, one “unusable candidate” path still retains the early DLL and prevents a later working folder from being tried. This is a source-derived review; I did not build a fake DXC DLL.try_diraccepts and caches a candidate as soon asdxcompiler.dllexportsDxcCreateInstance. Itslibrary()call probes version info but explicitly treats that probe's failure as nonfatal. The interface XCL actually needs isCLSID_DxcCompiler/IDxcCompiler3, requested only later incompiler(). A DLL with the export that returnsE_NOINTERFACE(or a null pointer) for that interface is therefore published inLIB; every compile then fails, while a later usable DXC candidate is never visited. The earlydxil.dllalso stays mapped. The new unload tests cover a missing DLL and a missing export, but not an export that cannot create the required interface.Could
try_dirprobeIDxcCompiler3before publishing the candidate, release the probe object, and unload both handles on failure? An injected export that fails this IID followed by a good candidate would cover selection and cleanup.AI assistance: GPT-6.2 Sol found the missing interface check; GPT-6.2 Astra verified the exact-head loader and compiler paths.
xcl nvprofileputs xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2580Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:32:46Z.
Triage (#1607) – head
5371d1d#2467 made the same change (move the per-folder load into a helper that
FreeLibrarys dxil.dll / dxcompiler.dll when the folder gives noDxcCreateInstance); it was closed as a duplicate of this PR. #2441 (same issue #2413) handles the empty-blob half and does not overlap. Main still has the leak indxc.rsload().The PR conflicts with main now:
load()on main also looks upDxcCreateInstance2and returns it as a third tuple field, sotry_dirneeds to carry that over when rebasing.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.