D3D12.X: preserve replacement driver blobs after refusal #2606

Closed
mokkamokacaffe wants to merge 1 commit from upstream-pr/2616 into main
mokkamokacaffe commented 2026-11-26 02:18:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mokkamokacaffe on 2026-11-26T02:18:29Z.


An older PSO-cache reader now retains the file handle that supplied its bytes and invalidates that exact file object after the driver refuses it. It can no longer remove a replacement published at the same pathname, including an identical-byte replacement from another process. Fixes #2601.

This does not change which HRESULTs count as a blob refusal; #2426 owns that policy and should pass the loaded-blob token through its refusal classifier when the changes are combined.

This is an alternative to #2614. It identifies a cache generation by the exact opened file object rather than content equality under a cooperative pathname lock, so identical-byte replacements and writers that do not use the same lock remain protected.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: retain an on-disk blob's shared bytes and exact Windows file handle through compute, graphics and two-pass PSO creation; invalidate with handle-based POSIX disposition, avoid following final-component reparse points, and keep readable blobs usable when delete access is unavailable.
  • crates/xcl/src/hle/d3d12x/real.rs: add synthetic regressions for unchanged-blob removal, an identical-byte cross-process replacement, overlapping writers and cache symlinks.
  • crates/xcl/src/shaders.rs: use the same exact-generation invalidation for rejected offline blobs over the DXIL size cap.

Tested

  • Independent Windows/NVIDIA report by @DavidM1911: Windows 11, NVIDIA GeForce RTX 3060 Ti, branch merged with current main; cargo test -p xcl --lib: all tests passed, 0 failed, 26 ignored. Current main is still the PR's base (b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). The report did not include the total passed count, GPU driver, CPU, Rust version or exact local merge commit. Test report
  • Linux host, Rust 1.100.0. A Windows-target type check of the library and test code passed: cargo check -p xcl --tests --target x86_64-pc-windows-msvc. The host lacks MSVC lib.exe, so the check used a local archive shim; it did not link or execute Windows code.
  • git diff --check: passed.

Regression run

  • Not run. Before merge, this runtime change still needs matching xcl-smoke blocks from a clean main checkout and clean PR head 06d08685e60b37a38728c6caf9b1f103995bf468, using the same title and duration.

Not tested

  • The complete workspace suite or retail title on the reported Windows/NVIDIA machine.
  • AMD or Intel hardware, Wine/Proton, ReFS, or an observed real-world cache race; the new test forces the replacement interleaving deterministically.
  • Paired retail-title smoke or world-load runs; cache-race frequency and timing impact remain unmeasured.
  • Integration after #2426, #2574 or #2577 lands.

AI use

  • OpenAI Codex (GPT-6.2 Astra, Ultra reasoning) reviewed the issue and active PR overlap, wrote the implementation and tests, performed independent handle/race reviews, ran the available checks, and drafted this description. The independent Windows/NVIDIA test report was written by @DavidM1911.
<!-- greyfinch-sync:ivall/xcl:issue:6618066628 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2616). Originally posted by [mokkamokacaffe](https://github.com/mokkamokacaffe) on 2026-11-26T02:18:29Z. --- An older PSO-cache reader now retains the file handle that supplied its bytes and invalidates that exact file object after the driver refuses it. It can no longer remove a replacement published at the same pathname, including an identical-byte replacement from another process. Fixes #2601. This does not change which HRESULTs count as a blob refusal; #2426 owns that policy and should pass the loaded-blob token through its refusal classifier when the changes are combined. This is an alternative to #2614. It identifies a cache generation by the exact opened file object rather than content equality under a cooperative pathname lock, so identical-byte replacements and writers that do not use the same lock remain protected. **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs`: retain an on-disk blob's shared bytes and exact Windows file handle through compute, graphics and two-pass PSO creation; invalidate with handle-based POSIX disposition, avoid following final-component reparse points, and keep readable blobs usable when delete access is unavailable. - `crates/xcl/src/hle/d3d12x/real.rs`: add synthetic regressions for unchanged-blob removal, an identical-byte cross-process replacement, overlapping writers and cache symlinks. - `crates/xcl/src/shaders.rs`: use the same exact-generation invalidation for rejected offline blobs over the DXIL size cap. **Tested** - Independent Windows/NVIDIA report by @DavidM1911: Windows 11, NVIDIA GeForce RTX 3060 Ti, branch merged with current `main`; `cargo test -p xcl --lib`: all tests passed, 0 failed, 26 ignored. Current `main` is still the PR's base (`b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`). The report did not include the total passed count, GPU driver, CPU, Rust version or exact local merge commit. [Test report](https://github.com/xcl-dev/xcl/pull/2616#issuecomment-7180891488) - Linux host, Rust 1.100.0. A Windows-target type check of the library and test code passed: `cargo check -p xcl --tests --target x86_64-pc-windows-msvc`. The host lacks MSVC `lib.exe`, so the check used a local archive shim; it did not link or execute Windows code. - `git diff --check`: passed. **Regression run** - Not run. Before merge, this runtime change still needs matching `xcl-smoke` blocks from a clean `main` checkout and clean PR head `06d08685e60b37a38728c6caf9b1f103995bf468`, using the same title and duration. **Not tested** - The complete workspace suite or retail title on the reported Windows/NVIDIA machine. - AMD or Intel hardware, Wine/Proton, ReFS, or an observed real-world cache race; the new test forces the replacement interleaving deterministically. - Paired retail-title smoke or world-load runs; cache-race frequency and timing impact remain unmeasured. - Integration after #2426, #2574 or #2577 lands. **AI use** - OpenAI Codex (GPT-6.2 Astra, Ultra reasoning) reviewed the issue and active PR overlap, wrote the implementation and tests, performed independent handle/race reviews, ran the available checks, and drafted this description. The independent Windows/NVIDIA test report was written by @DavidM1911.
DavidM1911 commented 2026-11-26 03:06:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T02:32:03Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7180891488 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2616#issuecomment-7180891488). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T02:32:03Z. --- 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 commented 2026-11-26 03:06:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mokkamokacaffe on 2026-11-26T02:47:59Z.


Reopening after test from DavidM1911

<!-- greyfinch-sync:ivall/xcl:comment:7181129430 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2616#issuecomment-7181129430). Originally posted by [mokkamokacaffe](https://github.com/mokkamokacaffe) on 2026-11-26T02:47:59Z. --- Reopening after test from [DavidM1911](https://github.com/xcl-dev/xcl/pull/2616#issuecomment-7180891488)
upstream-sync closed this pull request 2026-11-26 04:07:26 +00:00
mokkamokacaffe commented 2026-11-26 04:07:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mokkamokacaffe on 2026-11-26T03:13:42Z.


Superseded by #2614.

Confirmed that its live history now preserves 06d0868 as commit bb54f23, with my original Git authorship and GitHub noreply address intact. The subsequent cd7be10 commit contains the separate three-line test adjustment, and the resulting tree matches the previously tested revision exactly.

Thank you for preserving the durable attribution.

<!-- greyfinch-sync:ivall/xcl:comment:7181511429 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2616#issuecomment-7181511429). Originally posted by [mokkamokacaffe](https://github.com/mokkamokacaffe) on 2026-11-26T03:13:42Z. --- Superseded by #2614. Confirmed that its live history now preserves `06d0868` as commit `bb54f23`, with my original Git authorship and GitHub noreply address intact. The subsequent `cd7be10` commit contains the separate three-line test adjustment, and the resulting tree matches the previously tested revision exactly. Thank you for preserving the durable attribution.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2606
No description provided.