D3D12.X: preserve replaced driver blobs after stale rejection #2614
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!2614
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2614"
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?
@luckyteagirl on GitHub · 2026-11-26 02:03 UTC · original
luckyteagirl:codex/pso-blob-reject-race→main· +146 −27 · 2 files · 2 commits · openFixes #2601. A driver can reject a cached blob after another process replaces the same path. A pathname delete then removes the replacement, even if both generations have identical bytes. Keep the handle that supplied the old blob through PSO creation and invalidate that file object on refusal.
What is in it
crates/xcl/src/hle/d3d12x/real.rs: retain the exact opened file generation and dispose that handle on runtime refusal; a cross-process regression directly replaces a still-open blob with identical bytes.crates/xcl/src/shaders.rs: retain and invalidate the same file generation for an offline over-cap refusal.Tested
cargo build --locked --workspace -j 1: passed.943947c: a new identical-byte replacement regression failed 0 passed, 1 failed, showing that the replacement was deleted. This draft revision uses the exact file handle instead.cargo test --locked -p xcl --lib -j 1 hle::d3d12x::real::driver_cache::tests -- --test-threads=1 --show-output: 6 passed, 0 failed, 0 ignored, 1332 filtered. The direct cross-process, identical-byte replacement test passed separately (1 passed, 0 failed).cargo test --locked -p xcl --test gpu_compute_e2e -j 1 -- --test-threads=1 --show-output: 7 passed, 0 failed, 0 ignored; one test reportedSKIPPEDfor unavailable heap windows.XCL_ADAPTER=nomatchwithcargo test --locked --workspace --no-fail-fast -j 1 -- --test-threads=1 --show-output: 37 target summaries, 1437 passed, 0 failed, 47 ignored. The log contains 138 standaloneSKIPPEDnotices, many repeated subcases, and more inline skip notices; adapter-dependent GPU cases are not coverage. No complete RX 6800M suite is claimed.cbc165f, which has the same source tree as the current headcd7be10,XCL_ADAPTER=6800M XCL_REQUIRE_GPU=1with the same workspace command stopped in the library test process atgpu::dxil::core_tests::raw_loads_in_root_windows_respect_exec_and_boundswith0xc0000005(STATUS_ACCESS_VIOLATION), before a library summary. The--no-fail-fastintegration targets continued, includinggpu_compute_e2eat 7 passed / 0 failed. A prior clean-main control on this RX 6800M crashed in the same focused raw-load test; I have not rerun that control onb49be18.cd7be10on an RTX 5070 Ti and an AMD Ryzen 7 9800X3D iGPU. With explicitly listed exclusions for tests that also fail on main on those systems, the NVIDIA workspace run reported 1,425 passed, 0 failed, 45 ignored; the AMD iGPU run reported 1,436 passed, 0 failed, 47 ignored. The new blob-replacement tests passed. These were debug test runs, not game runs. Independent report with hardware, exclusions and SKIPPED notices.cargo test --workspace --no-fail-fast -- --test-threads=4: 1,437 passed, 0 failed, 47 ignored, 25 explicit GPU skips (native wave64 and refused per-lane forms). All sixdriver_cachetests passed, and the six-test group passed 30 of 30 parallel reruns at eight test threads. These are the independent reporter's results, not runs on our RX 6800M.Regression run
Guarded 30-second debug builds on the owned title, same RX 6800M and fresh per-run cache/data. The revised head showed 315/385 frames (81.8% of main) and 8267/8284 MB peak commit (99.8% of main). Both exited normally with no device removal or crash.
main:
PR:
Not tested
AI use
bb54f23; my follow-up commitcd7be10strengthens the child-process replacement test. OpenAI Codex (GPT-6; exact serving variant unavailable), with Luna subagents, adapted that test, reviewed the code, ran the stated checks, and prepared this description.@DavidM1911 on GitHub · 2026-11-26 02:32 UTC · original
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
@mokkamokacaffe on GitHub · 2026-11-26 02:38 UTC · original
I independently prepared a fix for #2601 before noticing this PR had opened concurrently, so I will not open a competing PR.
One generation-identity edge remains in
invalidate_if_unchanged: byte equality does not prove that the pathname still names the generation that was read. If replacement B is byte-for-byte identical to A, rejection of A still deletes B. The protection also depends on every writer using the new.lockprotocol, which mixed XCL versions do not guarantee.An alternative is to retain the exact file handle used to read A through PSO creation, opened with delete access and
FILE_SHARE_DELETE, then invalidate that file object withFileDispositionInfoExand POSIX delete semantics. This remains correct for identical replacements and non-cooperating writers and does not add persistent lock files.I have an unsubmitted reference implementation and an identical-byte cross-process regression here:
github.com/mokkamokacaffe/xcl@06d08685e6That branch has only passed Windows-target compilation from Linux, whereas this PR has real Windows/AMD execution, so I am offering it as a design/test contribution rather than claiming it is better validated.
AI-assisted review: OpenAI Codex (GPT-6.2 Astra, Ultra reasoning).
@mokkamokacaffe on GitHub · 2026-11-26 03:01 UTC · original
Interesting
@luckyteagirl on GitHub · 2026-11-26 03:03 UTC · original
Thanks for catching the generation-identity gap and offering the reference implementation. I reproduced the identical-byte failure on the previous
943947chead: the replacement was deleted (0 passed, 1 failed in the focused regression). I adapted your retained-handle approach on draft headcbc165f, credited your commit in the commit message and PR description, and changed the cross-process test so the child publishes B directly over the still-open A before the delayed parent invalidates A.On Windows, the new cross-process test passes; all six
driver_cache::testspass,gpu_compute_e2epasses 7/7 on the RX 6800M, and the full workspace run with adapter selection disabled reports 1,437 passed / 0 failed / 47 ignored. Windows no-GPU CI is green. The full GPU run still stops at the same raw-load access violation previously observed on clean main; the revised head's paired title smoke is pending. This response was prepared with OpenAI Codex (GPT-6; exact serving variant unavailable).@mokkamokacaffe on GitHub · 2026-11-26 03:06 UTC · original
Thanks for the clear provenance, the failing-first reproduction, and the Windows/AMD validation.
I compared revised head
cbc165fwith my reference commit06d08685e60b37a38728c6caf9b1f103995bf468; the resulting trees differ only in the three-line strengthening of the child-process regression. Since the retained-handle implementation and the rest of the tests were adopted substantially intact, could the Git history preserve authorship as well?Either approach would work:
06d08685e60b37a38728c6caf9b1f103995bf468and put the direct-replacement test adjustment in a follow-up commit; orCo-authored-by: mokkamokacaffe <[email protected]>The existing commit-message and PR-body attribution is appreciated; this request is only so the authorship survives in Git/GitHub history.
AI-assisted comment: OpenAI Codex (GPT-6.2 Astra, Ultra reasoning).
@luckyteagirl on GitHub · 2026-11-26 03:10 UTC · original
Done. I rewrote the draft PR as two commits:
bb54f23is a cherry-pick of your06d0868, retaining you as the Git author, andcd7be10is my three-line test adjustment. I verified the final source tree is identical to the previously testedcbc165ftree. Thanks for asking for the durable credit; the PR commit list now shows your authorship directly.The paired title smoke remains pending. This reply was prepared with OpenAI Codex (GPT-6; exact serving variant unavailable).
@mokkamokacaffe on GitHub · 2026-11-26 03:15 UTC · original
Thank you, @luckyteagirl — I really appreciate you restructuring the history to preserve my original Git authorship and keeping your test adjustment as a separate commit.
I verified the resulting tree matches the revision that was already tested, so I’ll close #2616 as superseded and delete its branch. Thanks again for handling this so thoughtfully.
AI-assisted comment: OpenAI Codex (GPT-6.2 Astra, Ultra reasoning).
@fromthemoonx on GitHub · 2026-11-26 03:25 UTC · original
A complete GPU workspace suite on NVIDIA (both listed under Not tested): passes, and the
driver_cachetests are stable in parallel.Tested:
cd7be10(its base is currentmainb49be18, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300 (NTFS), Rust 1.100.0 MSVC, debug.cargo test --workspace --no-fail-fast -- --test-threads=4SKIPPEDlines (no wave64, refused per-lane forms); all 6driver_cache::testsran and passed, includingan_older_process_cannot_remove_a_replacement_blobanda_cache_symlink_never_disposes_its_targethle::d3d12x::real::driver_cache::tests::(6 tests),--test-threads=8, 30 runsThe library process ran to the end here (no
0xc0000005), so this is the full GPU run the RX 6800M log could not give.Not tested: a refusal in a real title (no stale blob was produced), a release build, AMD (covered above).
AI use: Claude Code (Claude Opus 5.5) ran the suite and the repeats, and wrote this report.
@upipibi on GitHub · 2026-11-26 05:30 UTC · original
NVIDIA test report for
cd7be10: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4(thehle::xaudio2tests hang on this machine, onmaintoo):driver_cachetests (an_older_process_cannot_remove_a_replacement_blob,a_cache_symlink_never_disposes_its_target) ran in it and passed.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
@futurepro62 on GitHub · 2026-11-26 05:34 UTC · original
NVIDIA and AMD full-suite run, to go with the reports above by fromthemoonx, upipibi, since none of them covers AMD. Tested exact head
cd7be10f(on its baseb49be18).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: 1425 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.an_older_process_cannot_remove_a_replacement_blob,a_cache_symlink_never_disposes_its_target.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1436 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 mainb49be183too, 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
@DavidM1911 on GitHub · 2026-11-26 08:29 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
@KOLESNiii on GitHub · 2026-11-26 11:45 UTC · original
Wine/Proton concern with the open
LoadedBlobhandle (checked againstcd7be10f).Under Wine, renaming over a file that has any open handle fails. In
server/fd.c,set_fd_namereturnsSTATUS_ACCESS_DENIEDwhen the destination inode has open fds ("can't replace an opened file"). It does not look at share modes, and it ignoresFILE_RENAME_POSIX_SEMANTICS. This happens on ext4 or any other Linux filesystem.FileDispositionInfoExwith POSIX semantics is accepted, and the file is unlinked when its handle closes, soinvalidate()itself works.Where it breaks: the refused, not-over-cap branch of
Pipelinesincrates/xcl/src/shaders.rs.loadedis still open when the uncached compile finishes anddriver_cache::write(path, ..)renames the new blob over the same path. Under Wine that rename always fails, and the stale file is not invalidated in this branch. Every later--pipelinespass loads the same stale blob, gets it refused, compiles again and fails to save. Before this PR,remove_filecleared the stale file. On NTFS the POSIX rename succeeds, so this only shows up under Wine (and on Windows volumes without POSIX rename).Suggested change: once the driver has refused the blob, invalidate it (which closes the handle) before the uncached compile, as the over-cap branch above already does:
The runtime call sites in
real.rsalready callnote(false, loaded.take())before the retry andkeep, so they don't hit this within one process. They do keep the handle open through the first driver compile, though. While a cache file is open there, a second XCL process sharing the cache dir cannotkeepa replacement for it under Wine. Dropping the handle earlier would avoid that, for example by keeping the bytes and reopening for deletion only on refusal, at the cost of the generation check. That is a smaller issue.Not tested: this comes from reading Wine master's source on the GitHub mirror. The
server/fd.cbehaviour was read in the source itself; the ntdll and kernelbase handling is from a summary of those files. Nothing was run under Wine or Proton. The same lifetime affectsan_older_process_cannot_remove_a_replacement_blob: its child'swriteover a file the parent still has open would be refused under Wine.AI use: found and written with Claude Code (Claude Opus 5.5) and checked by me.
github-bot referenced this pull request2026-11-26 12:40:17 +00:00
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.