DXC: unload a candidate folder that is not a usable dxcompiler (#2413) #2643
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2643
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@kotekompotek on GitHub · 2026-11-26 04:52 UTC · original
kotekompotek:fix/dxc-candidate-leak→main· +77 −26 · 1 files · 1 commits · openload()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
@DarkPanda69 on GitHub · 2026-11-26 05:07 UTC · original
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.
@sage-sage on GitHub · 2026-11-26 05:18 UTC · original
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.
@luckyteagirl on GitHub · 2026-11-26 08:47 UTC · original · reviewed
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.
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.