D3D12.X: StorePipeline gives the driver the pipeline behind a stand-in #2853

Open
oni-swr wants to merge 1 commit from upstream-pr/2853 into main
oni-swr commented 2026-11-26 19:00:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T19:00:01Z.


ID3D12PipelineLibrary::StorePipeline handed the title's pointer to D3D12Core.dll as it was. A pipeline that is not built yet is a stand-in: a standin::Shell (no driver object) over a dummy driver pipeline shared by many titles' pipelines. The driver therefore got a pointer to a Shell, or (with XCL_SHARED_STANDINS=0) stored the dummy under the title's name for a later Load* / Serialize. This is the StorePipeline part of #2455 only.

Part of #2455. Independent of #2523 (MakeResident / Evict); touches different lines.

What is in it

  • real.rs: StorePipeline override on Kind::PipelineLibrary (lib_store_pipeline → store_pipeline / pipeline_to_store) and 5 CPU-only unit tests (store_pipeline_tests).
  • pso_async.rs: built(pso), a non-blocking lookup of a stand-in's real pipeline (Other / Real / NotYet).
  • standin.rs: is_shell(obj), true for one of our shells.

Behaviour:

  • Not a stand-in: forwarded unchanged (the driver judges null, foreign objects).
  • Built stand-in: the real pipeline is stored under the title's name.
  • Not built yet, build failed, or a shell with no entry: nothing is stored and the title gets E_INVALIDARG (logged for the first 3). A later StorePipeline of the same name works once the pipeline is built.
  • It does not wait (resolve_wait): a lazy pipeline is built only when bound (XCL_LAZY_PSO), and a wait would build every pipeline a title stores, defeating lazy creation (commit exhaustion), and could hold the title's thread for the driver's compile time. It does not call resolve either, which would enqueue a build.

Tested

  • CPU only; no GPU was used (XCL_ADAPTER=NONE_CPU_ONLY). Windows 11, stable-x86_64-pc-windows-msvc, debug.
  • cargo check --workspace --tests -j 4: finished, no errors.
  • cargo test -p xcl --lib -j 4 store_pipeline_tests: 5 passed, 0 failed, 0 ignored
  • cargo test -p xcl --lib -j 4 d3d12x::standin: 2 passed; d3d12x::pso_async: 14 passed
  • With the fix disabled (pipeline_to_store returning its argument), store_pipeline_tests: 1 passed, 4 failed; restored afterwards.
  • The tests drive store_pipeline with a fake driver callback and fake COM objects: pass-through, built stand-in → real pipeline (never the Shell or the dummy), lazy-unbuilt, failed build, shell with no entry.

Regression run

  • Not run. The full GPU suite (cargo test --workspace -- --test-threads=4) and the paired scripts/smoke.ps1 runs (main and this head) are pending a free RX 7800 XT (it was in use by another run). They will be pasted here; the PR checks workflow will refuse this PR until then, hence draft.

Not tested

  • The whole suite, any GPU test, scripts/smoke.ps1, any retail title: all pending a free GPU.
  • The real vtable override path (adopt + slot_of on a native ID3D12PipelineLibrary) was not exercised: the tests cover the logic behind it, not the dispatch. No native library was created.
  • ID3D12PipelineLibrary1::LoadPipeline, GetCachedBlob on a shell (see the comment on #2455) and other entry points are out of scope.
  • AMD / NVIDIA, wave32-only GPUs.

AI use

  • Claude Code, Claude Sonnet 5.5: wrote the change, the tests and this description; ran the CPU tests above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5515662032 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2853). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T19:00:01Z. --- `ID3D12PipelineLibrary::StorePipeline` handed the title's pointer to D3D12Core.dll as it was. A pipeline that is not built yet is a stand-in: a `standin::Shell` (no driver object) over a dummy driver pipeline shared by many titles' pipelines. The driver therefore got a pointer to a Shell, or (with `XCL_SHARED_STANDINS=0`) stored the dummy under the title's name for a later `Load*` / `Serialize`. This is the `StorePipeline` part of #2455 only. Part of #2455. Independent of #2523 (MakeResident / Evict); touches different lines. **What is in it** - `real.rs`: `StorePipeline` override on `Kind::PipelineLibrary` (`lib_store_pipeline` → `store_pipeline` / `pipeline_to_store`) and 5 CPU-only unit tests (`store_pipeline_tests`). - `pso_async.rs`: `built(pso)`, a non-blocking lookup of a stand-in's real pipeline (`Other` / `Real` / `NotYet`). - `standin.rs`: `is_shell(obj)`, true for one of our shells. Behaviour: - Not a stand-in: forwarded unchanged (the driver judges null, foreign objects). - Built stand-in: the **real** pipeline is stored under the title's name. - Not built yet, build failed, or a shell with no entry: nothing is stored and the title gets `E_INVALIDARG` (logged for the first 3). A later `StorePipeline` of the same name works once the pipeline is built. - It does **not** wait (`resolve_wait`): a lazy pipeline is built only when bound (`XCL_LAZY_PSO`), and a wait would build every pipeline a title stores, defeating lazy creation (commit exhaustion), and could hold the title's thread for the driver's compile time. It does not call `resolve` either, which would enqueue a build. **Tested** - CPU only; no GPU was used (`XCL_ADAPTER=NONE_CPU_ONLY`). Windows 11, stable-x86_64-pc-windows-msvc, debug. - `cargo check --workspace --tests -j 4`: finished, no errors. - `cargo test -p xcl --lib -j 4 store_pipeline_tests`: 5 passed, 0 failed, 0 ignored - `cargo test -p xcl --lib -j 4 d3d12x::standin`: 2 passed; `d3d12x::pso_async`: 14 passed - With the fix disabled (`pipeline_to_store` returning its argument), `store_pipeline_tests`: 1 passed, 4 failed; restored afterwards. - The tests drive `store_pipeline` with a fake driver callback and fake COM objects: pass-through, built stand-in → real pipeline (never the Shell or the dummy), lazy-unbuilt, failed build, shell with no entry. **Regression run** - Not run. The full GPU suite (`cargo test --workspace -- --test-threads=4`) and the paired `scripts/smoke.ps1` runs (main and this head) are pending a free RX 7800 XT (it was in use by another run). They will be pasted here; the `PR checks` workflow will refuse this PR until then, hence draft. **Not tested** - The whole suite, any GPU test, `scripts/smoke.ps1`, any retail title: all pending a free GPU. - The real vtable override path (`adopt` + `slot_of` on a native `ID3D12PipelineLibrary`) was not exercised: the tests cover the logic behind it, not the dispatch. No native library was created. - `ID3D12PipelineLibrary1::LoadPipeline`, `GetCachedBlob` on a shell (see the comment on #2455) and other entry points are out of scope. - AMD / NVIDIA, wave32-only GPUs. **AI use** - Claude Code, Claude Sonnet 5.5: wrote the change, the tests and this description; ran the CPU tests above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oni-swr commented 2026-11-28 03:56:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-28T03:56:18Z.


Rebased onto xcl-dev/xcl main (e429936c), head is now e38cee64.

  • Conflict resolution: updated pso_async::built to read p.build.real (matching Pending's current layout on main) and kept both test modules at the end of real.rs.
  • Targeted WARP test (XCL_WARP=1 cargo test -p xcl --lib -j 4 store_pipeline_tests): 5 passed, 0 failed, 0 ignored.

AI use: Antigravity (Gemini 4 Neon) completed the rebase and ran the targeted WARP unit tests.

<!-- greyfinch-sync:ivall/xcl:comment:7233528716 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2853#issuecomment-7233528716). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-28T03:56:18Z. --- Rebased onto `xcl-dev/xcl` `main` (`e429936c`), head is now `e38cee64`. - Conflict resolution: updated `pso_async::built` to read `p.build.real` (matching `Pending`'s current layout on `main`) and kept both test modules at the end of `real.rs`. - Targeted WARP test (`XCL_WARP=1 cargo test -p xcl --lib -j 4 store_pipeline_tests`): 5 passed, 0 failed, 0 ignored. AI use: Antigravity (Gemini 4 Neon) completed the rebase and ran the targeted WARP unit tests.
oni-swr commented 2026-11-28 20:55:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-28T20:55:09Z.


Rebased onto main beeb81be; new head a1b258ad.

  • Conflict: pso_async.rs, where main added peek at the same spot as built. Kept both.
  • Tests (CPU only, XCL_ADAPTER=NONE_CPU_ONLY, no GPU, debug): store_pipeline_tests 5 passed, 0 failed, 0 ignored; d3d12x::standin 3 passed; pso_async 191 passed, 0 failed.
  • Not run: the whole suite on a GPU and scripts/smoke.ps1; the Regression run section in the description is still pending, so this stays a draft.

AI use: Claude Code, Claude Sonnet 5.5, did the rebase and ran the tests above.

<!-- greyfinch-sync:ivall/xcl:comment:7245639466 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2853#issuecomment-7245639466). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-28T20:55:09Z. --- Rebased onto `main` `beeb81be`; new head `a1b258ad`. - Conflict: `pso_async.rs`, where `main` added `peek` at the same spot as `built`. Kept both. - Tests (CPU only, `XCL_ADAPTER=NONE_CPU_ONLY`, no GPU, debug): `store_pipeline_tests` 5 passed, 0 failed, 0 ignored; `d3d12x::standin` 3 passed; `pso_async` 191 passed, 0 failed. - Not run: the whole suite on a GPU and `scripts/smoke.ps1`; the Regression run section in the description is still pending, so this stays a draft. AI use: Claude Code, Claude Sonnet 5.5, did the rebase and ran the tests above.
Foniass commented 2026-12-01 09:04:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:04:03Z.


Triage (#1607) – head a1b258a

No open or merged PR overrides ID3D12PipelineLibrary::StorePipeline; main has no override for Kind::PipelineLibrary.
#2523 (MakeResident/Evict) and #2861 (CreateCommandList) handle other parts of #2455, so they are not duplicates. #2523 also adds standin::is_shell (via a VTABLE static), so the two will conflict in standin.rs; whichever merges second should reuse the other's helper.
No problems found in the diff. built() neither waits nor enqueues a build, and returning E_INVALIDARG for an unbuilt stand-in is documented.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7306166352 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2853#issuecomment-7306166352). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:04:03Z. --- **Triage (#1607)** – head a1b258a No open or merged PR overrides `ID3D12PipelineLibrary::StorePipeline`; main has no override for `Kind::PipelineLibrary`. #2523 (MakeResident/Evict) and #2861 (CreateCommandList) handle other parts of #2455, so they are not duplicates. #2523 also adds `standin::is_shell` (via a `VTABLE` static), so the two will conflict in `standin.rs`; whichever merges second should reuse the other's helper. No problems found in the diff. `built()` neither waits nor enqueues a build, and returning `E_INVALIDARG` for an unbuilt stand-in is documented. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2853:upstream-pr/2853'
git switch 'upstream-pr/2853'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2853'
git switch 'upstream-pr/2853'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2853'
git switch 'upstream-pr/2853'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2853'
git switch 'main'
git merge --squash 'upstream-pr/2853'
git switch 'main'
git merge --ff-only 'upstream-pr/2853'
git switch 'main'
git merge 'upstream-pr/2853'
git push origin 'main'
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!2853
No description provided.