D3D12.X: retain resolved async pipelines until reset and retirement #2417

Open
github-bot wants to merge 1 commit from github-bot/gh-2417 into main AGit
Owner

@⁠fixgep on GitHub · 2026-11-25 18:12 UTC · original
fixgep:fix/pso-async-lifetime-retention → main · +1393 −238 · 8 files · 1 commits · open

Retain resolved async pipeline COM references across command list recording, reset, and GPU queue retirement so background-built pipelines cannot be freed while bound or in flight (XCL-BT-008). Part of #916. Part of #1488.

What is in it

  • Synchronize Pending completion, state updates, and unstarted/adopted stand-in release under Pending::state (Pending::finish_release), return COM-retaining Resolved handles (resolve_wait_retained, resolve_for_bind_retained, resolve_if_pending, resolve_cached_* including nonwaiting resolve_cached_if_pending) with settled fast-path tracking, and gate adopted stand-in release via try_release_standin (pso_async.rs)
  • Retain resolved ID3D12PipelineState references on command lists (list_x::ListState::retained_psos, console_list::ListState::retained_psos, and bound-pipeline tracking in bind/list_x) across creation, Reset, ClearState, SetPipelineState, Draw*/Dispatch/ExecuteIndirect, RSSetDepthBiasX restore/prepare, KickoffX, mid-list split (using nonwaiting resolve_cached_if_pending so deferred compute dispatches still wait only at submit), and console_list::close until reset or release
  • Route final adopted PSO release (only when add(this) == 2 proves the caller released the actual last ref, removing the else if f(this) == 1 branch so 2 -> 1 releases stay non-final) and unadopted COM pipeline releases through non-spinning late_release::hold_deferred, dispatch unadopted COM objects via vtable slot 2 in late_release::drain_known, and clone queue COM references safely under QUEUES (present::known_queue_refs) while purging retired test queues from Held::fences (real.rs, late_release.rs, present.rs, pso_async.rs)
  • Add synthetic COM stress race (UnstartedReal RAII guard), GPU queue retirement (late_release + stalled queue), standin::shell command-list lifetime, pending stand-in bind/retain -> title Release (2 -> 1) -> list Reset (1 -> 0) regression tests, and extend a_dispatch_with_a_pipeline_still_building_waits_at_the_submit to bind a real still-building stand-in via SetPipelineState across mid-list splits (with XCL_ADAPTER=warp / agility::create_device fallback and clean skip when no D3D12 adapter is present) in pso_async.rs, late_release.rs, list_x.rs, and real.rs
  • Why this >800-line diff cannot be split safely: list-side COM retention in list_x/bind/console_list and deferred retirement/locking in pso_async/late_release/real form a single COM reference-lifetime invariant across command-list recording, reset, and GPU queue retirement. Landing list-side retention without pso_release's add(this) == 2 guard and try_release_standin would misclassify 2 -> 1 title releases as final (double-releasing or forgetting tracked state while lists still hold refs) or leak retained refs; landing pso_async/late_release without list-side Resolved retention would leave use-after-free windows while stand-ins or resolved PSOs are bound on open or split command lists.

Tested

  • Hardware: NVIDIA GeForce RTX 3060 (driver 32.0.15.9144), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 x64 (10.0.26200.0), rustc 1.100.0 (0ef1bc386 2026-11-09), debug and release (rebased onto upstream/main b49be1836844, head 1a51cb95ebd73348679073a39eaab7f185e6fce6)
  • cargo build --workspace: exited 0 with 0 new compiler warnings (3 pre-existing warnings in real.rs, xgameruntime/mod.rs, and vram.rs)
  • cargo test -p xcl --lib pso_async -- --test-threads=1 (default RTX 3060): 15 passed, 0 failed, 0 ignored
  • cargo test -p xcl --lib list_x -- --test-threads=1 (default RTX 3060): 40 passed, 0 failed, 0 ignored
  • cargo test -p xcl --lib hle::d3d12x -- --test-threads=4 (default RTX 3060): 260 passed, 0 failed, 2 ignored (0 SKIPPED GPU tests)
  • XCL_ADAPTER=warp cargo test -p xcl --lib pso_async -- --test-threads=1: 15 passed, 0 failed, 0 ignored
  • XCL_ADAPTER=warp cargo test -p xcl --lib list_x -- --test-threads=1: 40 passed, 0 failed, 0 ignored
  • XCL_ADAPTER=warp cargo test -p xcl --lib hle::d3d12x -- --test-threads=1: 260 passed, 0 failed, 2 ignored (0 SKIPPED GPU tests)
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (default RTX 3060): 1440 passed, 1 failed, 47 ignored (26 SKIPPED GPU tests: 21 no wave64, 3 wave32 per-lane refused, 1 no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record requiring Windows Developer Mode; the 1 failure is the unrelated pre-existing gpu::recomp::tests::gpu_clamp_and_omod_per_instruction)

Regression run
main (b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):


xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1634 (PresentX 1634)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13967 MB

PR (1a51cb95ebd73348679073a39eaab7f185e6fce6):


xcl-smoke v1
commit: 1a51cb95ebd73348679073a39eaab7f185e6fce6
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1578 (PresentX 1578)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13988 MB

Not tested

  • AMD / Intel GPUs, native wave64 / ShaderCacheControl paths, Linux / Wine without VKD3D_CONFIG=retain_psos, and non-Windows targets (not built / not tested)
  • XCL_SAMPLE_* external shader packs (unset)
  • Full clean .\scripts\test.ps1 pass (unrelated pre-existing gpu::recomp::tests::gpu_clamp_and_omod_per_instruction failure on RTX 3060)

AI use

  • Antigravity (Gemini 4 Hydrogen): verified XCL-BT-008 unclaimed via GitHub REST API, authored failing-first and multi-threaded COM lifetime tests, implemented COM reference retention, late_release synchronization, and WARP/no-GPU test guards across d3d12x, addressed @bmjask review feedback (pso_release add(this) == 2 check and pending stand-in 2 -> 1 -> 0 reset regression), addressed @luckyteagirl review feedback (nonwaiting resolve_cached_if_pending in list_x::split and extending a_dispatch_with_a_pipeline_still_building_waits_at_the_submit to bind a real stand-in via SetPipelineState), rebased onto upstream/main b49be1836844, and ran hle::d3d12x, WARP, workspace tests, and 60 s smoke runs
**@⁠fixgep** on GitHub · 2026-11-25 18:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417) `fixgep:fix/pso-async-lifetime-retention` → `main` · +1393 −238 · 8 files · 1 commits · open Retain resolved async pipeline COM references across command list recording, reset, and GPU queue retirement so background-built pipelines cannot be freed while bound or in flight (`XCL-BT-008`). Part of #916. Part of #1488. **What is in it** - Synchronize `Pending` completion, state updates, and unstarted/adopted stand-in release under `Pending::state` (`Pending::finish_release`), return COM-retaining `Resolved` handles (`resolve_wait_retained`, `resolve_for_bind_retained`, `resolve_if_pending`, `resolve_cached_*` including nonwaiting `resolve_cached_if_pending`) with settled fast-path tracking, and gate adopted stand-in release via `try_release_standin` (`pso_async.rs`) - Retain resolved `ID3D12PipelineState` references on command lists (`list_x::ListState::retained_psos`, `console_list::ListState::retained_psos`, and bound-pipeline tracking in `bind`/`list_x`) across creation, `Reset`, `ClearState`, `SetPipelineState`, `Draw*`/`Dispatch`/`ExecuteIndirect`, `RSSetDepthBiasX` restore/prepare, `KickoffX`, mid-list split (using nonwaiting `resolve_cached_if_pending` so deferred compute dispatches still wait only at submit), and `console_list::close` until reset or release - Route final adopted PSO release (only when `add(this) == 2` proves the caller released the actual last ref, removing the `else if f(this) == 1` branch so `2 -> 1` releases stay non-final) and unadopted COM pipeline releases through non-spinning `late_release::hold_deferred`, dispatch unadopted COM objects via vtable slot 2 in `late_release::drain_known`, and clone queue COM references safely under `QUEUES` (`present::known_queue_refs`) while purging retired test queues from `Held::fences` (`real.rs`, `late_release.rs`, `present.rs`, `pso_async.rs`) - Add synthetic COM stress race (`UnstartedReal` RAII guard), GPU queue retirement (`late_release` + stalled queue), `standin::shell` command-list lifetime, pending stand-in bind/retain -> title `Release` (`2 -> 1`) -> list `Reset` (`1 -> 0`) regression tests, and extend `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` to bind a real still-building stand-in via `SetPipelineState` across mid-list splits (with `XCL_ADAPTER=warp` / `agility::create_device` fallback and clean skip when no D3D12 adapter is present) in `pso_async.rs`, `late_release.rs`, `list_x.rs`, and `real.rs` - Why this >800-line diff cannot be split safely: list-side COM retention in `list_x`/`bind`/`console_list` and deferred retirement/locking in `pso_async`/`late_release`/`real` form a single COM reference-lifetime invariant across command-list recording, reset, and GPU queue retirement. Landing list-side retention without `pso_release`'s `add(this) == 2` guard and `try_release_standin` would misclassify `2 -> 1` title releases as final (double-releasing or forgetting tracked state while lists still hold refs) or leak retained refs; landing `pso_async`/`late_release` without list-side `Resolved` retention would leave use-after-free windows while stand-ins or resolved PSOs are bound on open or split command lists. **Tested** - Hardware: NVIDIA GeForce RTX 3060 (driver `32.0.15.9144`), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 x64 (`10.0.26200.0`), `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug and release (rebased onto `upstream/main` `b49be1836844`, head `1a51cb95ebd73348679073a39eaab7f185e6fce6`) - `cargo build --workspace`: exited `0` with 0 new compiler warnings (3 pre-existing warnings in `real.rs`, `xgameruntime/mod.rs`, and `vram.rs`) - `cargo test -p xcl --lib pso_async -- --test-threads=1` (default RTX 3060): `15 passed, 0 failed, 0 ignored` - `cargo test -p xcl --lib list_x -- --test-threads=1` (default RTX 3060): `40 passed, 0 failed, 0 ignored` - `cargo test -p xcl --lib hle::d3d12x -- --test-threads=4` (default RTX 3060): `260 passed, 0 failed, 2 ignored` (0 `SKIPPED` GPU tests) - `XCL_ADAPTER=warp cargo test -p xcl --lib pso_async -- --test-threads=1`: `15 passed, 0 failed, 0 ignored` - `XCL_ADAPTER=warp cargo test -p xcl --lib list_x -- --test-threads=1`: `40 passed, 0 failed, 0 ignored` - `XCL_ADAPTER=warp cargo test -p xcl --lib hle::d3d12x -- --test-threads=1`: `260 passed, 0 failed, 2 ignored` (0 `SKIPPED` GPU tests) - `cargo test --workspace --no-fail-fast -- --test-threads=4` (default RTX 3060): `1440 passed, 1 failed, 47 ignored` (`26 SKIPPED` GPU tests: 21 `no wave64`, 3 wave32 per-lane `refused`, 1 `no heap windows`, 1 `pso_measurement_compiles_an_exact_synthetic_record` requiring Windows Developer Mode; the 1 failure is the unrelated pre-existing `gpu::recomp::tests::gpu_clamp_and_omod_per_instruction`) **Regression run** main (`b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1634 (PresentX 1634) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13967 MB ``` PR (`1a51cb95ebd73348679073a39eaab7f185e6fce6`): ``` xcl-smoke v1 commit: 1a51cb95ebd73348679073a39eaab7f185e6fce6 gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1578 (PresentX 1578) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13988 MB ``` **Not tested** - AMD / Intel GPUs, native wave64 / `ShaderCacheControl` paths, Linux / Wine without `VKD3D_CONFIG=retain_psos`, and non-Windows targets (not built / not tested) - `XCL_SAMPLE_*` external shader packs (unset) - Full clean `.\scripts\test.ps1` pass (unrelated pre-existing `gpu::recomp::tests::gpu_clamp_and_omod_per_instruction` failure on RTX 3060) **AI use** - Antigravity (Gemini 4 Hydrogen): verified `XCL-BT-008` unclaimed via GitHub REST API, authored failing-first and multi-threaded COM lifetime tests, implemented COM reference retention, `late_release` synchronization, and WARP/no-GPU test guards across `d3d12x`, addressed `@bmjask` review feedback (`pso_release` `add(this) == 2` check and pending stand-in `2 -> 1 -> 0` reset regression), addressed `@luckyteagirl` review feedback (nonwaiting `resolve_cached_if_pending` in `list_x::split` and extending `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` to bind a real stand-in via `SetPipelineState`), rebased onto `upstream/main` `b49be1836844`, and ran `hle::d3d12x`, WARP, workspace tests, and 60 s smoke runs
`pso_async::resolve`, `resolve_wait`, and `resolve_for_bind` previously returned unretained raw `ID3D12PipelineState` addresses while `released()` could synchronously drop `real` outside any shared lock with callers or before command list reset and GPU retirement.

Synchronize pending pipeline completion, resolution, and stand-in release under `Pending::state`, introduce `Resolved` COM-owning handles across command list creation, reset, binding, draw/dispatch, KickoffX, and `console_list` replay, keep bound resolved pipelines on `bind`/`list_x` state so released stand-ins are not re-dereferenced, and route final stand-in/real COM release (including unadopted COM objects and `pso_release` only when `add(this) == 2` proves the caller released the actual last ref) through `late_release::hold_deferred` until GPU queues pass their fences.

Drop unstarted orphaned jobs immediately across `Pending::finish_release` and `drop_unstarted_job`, guard pre-allocated test pipelines against early-orphan drops and worker saturation in `pso_async::used_tests`, clone `present` queue COM references under `QUEUES` in `late_release::drain_known` while purging retired test queue fences, and add bind/retain -> title Release -> list Reset regression coverage in `async_pso_lifetime_tests` (selecting WARP via `XCL_ADAPTER` / `agility::create_device` fallback).

Part of #1488

Assisted-by: Antigravity (Gemini 4 Hydrogen)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:30:18 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-11-25 18:25 UTC · original

Ran the async-pipeline lifetime tests at 8142aa1:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

Results

  • cargo test -p xcl --lib async_pso -- --test-threads=4: 3 passed, 0 failed (exit 0)
  • cargo test -p xcl --lib pso_async -- --test-threads=4: 12 passed, 0 failed (exit 0)
  • cargo test -p xcl --lib late_release -- --test-threads=4: 3 passed, 0 failed (exit 0)
  • cargo test -p xcl --lib list_x -- --test-threads=4: 34 passed, 0 failed (exit 0)

The new lifetime tests (async_pso_stays_alive_through_command_list_reset_and_gpu_retirement, concurrent_resolve_retained_and_release_never_exposes_freed_pipeline and the late_release queue-retirement case) pass here on a real D3D12 device and command list.

What this adds: the author ran these filters on an Ampere RTX 3060; this is a Blackwell wave32 part. No test report from another machine exists in the thread yet.

Not tested: the whole xcl --lib run (the description lists a pre-existing gpu_clamp_and_omod_per_instruction failure), a paired 60 s smoke run, AMD and Intel GPUs, Wine, release profile, title data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-25 18:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#issuecomment-7170883943) Ran the async-pipeline lifetime tests at `8142aa1`: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. **Results** - `cargo test -p xcl --lib async_pso -- --test-threads=4`: 3 passed, 0 failed (exit 0) - `cargo test -p xcl --lib pso_async -- --test-threads=4`: 12 passed, 0 failed (exit 0) - `cargo test -p xcl --lib late_release -- --test-threads=4`: 3 passed, 0 failed (exit 0) - `cargo test -p xcl --lib list_x -- --test-threads=4`: 34 passed, 0 failed (exit 0) The new lifetime tests (`async_pso_stays_alive_through_command_list_reset_and_gpu_retirement`, `concurrent_resolve_retained_and_release_never_exposes_freed_pipeline` and the `late_release` queue-retirement case) pass here on a real D3D12 device and command list. What this adds: the author ran these filters on an Ampere RTX 3060; this is a Blackwell wave32 part. No test report from another machine exists in the thread yet. Not tested: the whole `xcl --lib` run (the description lists a pre-existing `gpu_clamp_and_omod_per_instruction` failure), a paired 60 s smoke run, AMD and Intel GPUs, Wine, release profile, title data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 19:47 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1 real failure, deterministic (also fails --test-threads=1, 1219/1):
gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier
  assertion failed: group barriers in the program (lower_dxil.rs:1155)

The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge.

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-25 19:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#issuecomment-7172773027) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: **1 real failure**, deterministic (also fails `--test-threads=1`, 1219/1): ``` gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier assertion failed: group barriers in the program (lower_dxil.rs:1155) ``` The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge. — Devin
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-25 19:54 UTC · original

Independent AMD RDNA4 (native wave64) test report on exact head 75726f769e996fdeae51c37f1a6beb26371f9e98 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1349 passed, 3 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.
    • Both PR tests passed: hle::d3d12x::late_release::tests::unadopted_com_object_is_released_after_queue_retirement and hle::d3d12x::pso_async::used_tests::concurrent_resolve_retained_and_release_never_exposes_freed_pipeline.
    • The 3 failures are pre-existing on the PR's base main: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722) and fuzz_validate_and_gpu_3 (seed 1599) on this GPU, plus gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier (from 50a9fde / #2074, fixed later on main in #2420).

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: 75726f769e996fdeae51c37f1a6beb26371f9e98
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1575 (PresentX 1575)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16128 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
**@⁠emirduran707** on GitHub · 2026-11-25 19:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#issuecomment-7172932259) Independent AMD RDNA4 (native wave64) test report on exact head `75726f769e996fdeae51c37f1a6beb26371f9e98` (clean detached checkout, no local changes). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2602.17; tests debug, smoke release. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **1349 passed, 3 failed, 46 ignored; 8 SKIPPED** (6 in `lower_dxil::tests::{f16,f32}_programs_on_the_gpu` refused by per-lane form; `heap_window_out_of_memory_falls_back_to_the_switch_form`; `pso_measurement_compiles_an_exact_synthetic_record`). All native wave64 GPU tests ran and passed. - Both PR tests passed: `hle::d3d12x::late_release::tests::unadopted_com_object_is_released_after_queue_retirement` and `hle::d3d12x::pso_async::used_tests::concurrent_resolve_retained_and_release_never_exposes_freed_pipeline`. - The 3 failures are pre-existing on the PR's base `main`: `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` (seed 722) and `fuzz_validate_and_gpu_3` (seed 1599) on this GPU, plus `gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier` (from `50a9fde` / #2074, fixed later on `main` in #2420). **Regression run** (60 s retail-title smoke, `XCL_NETWORK=0`, release) ``` xcl-smoke v1 commit: 75726f769e996fdeae51c37f1a6beb26371f9e98 gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1575 (PresentX 1575) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16128 MB ``` (Matched `main` `68a284a` baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.) **Not tested** - D3D12 debug layer; Intel GPUs. **AI use** - Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
Author
Owner

@⁠fixgep on GitHub · 2026-11-25 20:50 UTC · original

Thanks for catching this! Removed the else if f(this) == 1 branch in pso_release (crates/xcl/src/hle/d3d12x/real.rs) so it now matches res_release and pso_async::release: a separate deferred ref is held in late_release::hold_deferred only when add(this) == 2 proves the caller is releasing the actual last ref (1 -> 0), and any add(this) > 2 call immediately drops its speculative ref via f(this) and runs the caller's release let n = f(this) with held = false. Also added async_pso_lifetime_tests::pending_standin_retained_on_command_list_survives_title_release_until_reset covering pending stand-in bind/retain (1 -> 2) → title Release() (2 -> 1) → command list Reset() (1 -> 0) and GPU retirement, rebased onto upstream/main, and refreshed the hle::d3d12x test and 60 s smoke runs.

**@⁠fixgep** on GitHub · 2026-11-25 20:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#issuecomment-7174253907) Thanks for catching this! Removed the `else if f(this) == 1` branch in `pso_release` (`crates/xcl/src/hle/d3d12x/real.rs`) so it now matches `res_release` and `pso_async::release`: a separate deferred ref is held in `late_release::hold_deferred` only when `add(this) == 2` proves the caller is releasing the actual last ref (`1 -> 0`), and any `add(this) > 2` call immediately drops its speculative ref via `f(this)` and runs the caller's release `let n = f(this)` with `held = false`. Also added `async_pso_lifetime_tests::pending_standin_retained_on_command_list_survives_title_release_until_reset` covering pending stand-in bind/retain (`1 -> 2`) → title `Release()` (`2 -> 1`) → command list `Reset()` (`1 -> 0`) and GPU retirement, rebased onto `upstream/main`, and refreshed the `hle::d3d12x` test and 60 s smoke runs.
Author
Owner

@⁠itsSio on GitHub · 2026-11-26 00:12 UTC · original · edited 2026-11-26 00:39 UTC

Two points from reading the diff against main 08db802:

  • Size. The PR is 1314 + / 226 − (1540 changed lines, 8 files). CONTRIBUTING.md says: "Over ~800 lines, the description must say why it cannot be split." The description doesn't say that yet. @⁠pr1sm-dev's comment on #916 (2026-11-25) describes a ~100-line shape of the list-side retention (one reference per pipeline bound on a PC list, keyed by alloc_pool::recording_backing, dropped in dispatch_chain::allocator_reset). That suggests the retention could be one PR and the pso_async / late_release changes another.
  • Issue link. The description says "Part of #1488". #916 (goal:world-load, Linux + NVIDIA vkQueueSubmit2 AV) is where @⁠pr1sm-dev stood down their own fix in favour of this PR. If this is meant to fix #916, a Fixes #916 / Part of #916 line and one Linux / Wine run without VKD3D_CONFIG=retain_psos would show it does. The current Tested section is Windows only.

I checked pso_release (real.rs, the hunk at 1716): the else if f(this) == 1 branch from @⁠bmjask's review is gone. The last reference is now held for late_release::hold_deferred only when add(this) == 2.

AI use:
Ran via Samaritan:

  • OpenCode (Claude Opus 5.5): read the diff and the threads, checked each point above against the code and wrote this comment.
  • OpenCode (Claude Opus 5.5), a helper session: read the diff and the threads.

The points were checked by the account owner as well (edited to complete this AI use line).

**@⁠itsSio** on GitHub · 2026-11-26 00:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#issuecomment-7178516700) · edited 2026-11-26 00:39 UTC Two points from reading the diff against `main` `08db802`: - **Size.** The PR is 1314 + / 226 − (1540 changed lines, 8 files). `CONTRIBUTING.md` says: "Over ~800 lines, the description must say why it cannot be split." The description doesn't say that yet. @⁠pr1sm-dev's comment on #916 (2026-11-25) describes a ~100-line shape of the list-side retention (one reference per pipeline bound on a PC list, keyed by `alloc_pool::recording_backing`, dropped in `dispatch_chain::allocator_reset`). That suggests the retention could be one PR and the `pso_async` / `late_release` changes another. - **Issue link.** The description says "Part of #1488". #916 (`goal:world-load`, Linux + NVIDIA `vkQueueSubmit2` AV) is where @⁠pr1sm-dev stood down their own fix in favour of this PR. If this is meant to fix #916, a `Fixes #916` / `Part of #916` line and one Linux / Wine run without `VKD3D_CONFIG=retain_psos` would show it does. The current Tested section is Windows only. I checked `pso_release` (`real.rs`, the hunk at 1716): the `else if f(this) == 1` branch from @⁠bmjask's review is gone. The last reference is now held for `late_release::hold_deferred` only when `add(this) == 2`. AI use: Ran via Samaritan: - OpenCode (Claude Opus 5.5): read the diff and the threads, checked each point above against the code and wrote this comment. - OpenCode (Claude Opus 5.5), a helper session: read the diff and the threads. The points were checked by the account owner as well (edited to complete this AI use line).
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 02:23 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: 1 failure under parallel scheduling; clean on --test-threads=1 rerun (1308 passed, 0 failed, 27 ignored, 81s). Intermittent single-test flake — tracked in #1978.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 02:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#issuecomment-7180766898) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: 1 failure under parallel scheduling; clean on `--test-threads=1` rerun (**1308 passed, 0 failed, 27 ignored**, 81s). Intermittent single-test flake — tracked in #1978. Thanks! — Devin
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 20:28 UTC · original · reviewed

P1: pso_release can misclassify a normal 2->1 release as final and double-release a retained pending stand-in. With late release enabled, real.rs:1721-1734 treats f(this)==1 as final, removes async state, and queues a deferred raw Release. But this PR intentionally AddRefs a bound pending stand-in via Resolved/retained_psos, so title Release commonly changes title+list retention from 2 to 1. The branch then reports zero/forgets state and schedules release of the list-owned ref; when the list resets and drops its retained ID3D12PipelineState, it releases that same ref again. Please retain a separate deferred ref only after proving the caller released the actual last ref, and add a bind/retain -> title Release -> list reset regression.

**@⁠bmjask** on GitHub · 2026-11-25 20:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#pullrequestreview-6064502229) · **reviewed** P1: pso_release can misclassify a normal 2->1 release as final and double-release a retained pending stand-in. With late release enabled, real.rs:1721-1734 treats f(this)==1 as final, removes async state, and queues a deferred raw Release. But this PR intentionally AddRefs a bound pending stand-in via Resolved/retained_psos, so title Release commonly changes title+list retention from 2 to 1. The branch then reports zero/forgets state and schedules release of the list-owned ref; when the list resets and drops its retained ID3D12PipelineState, it releases that same ref again. Please retain a separate deferred ref only after proving the caller released the actual last ref, and add a bind/retain -> title Release -> list reset regression.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 07:58 UTC · original · reviewed

At head 5333a9b91290a0163e2368bc27e89907c5e4207a, the mid-list split now calls resolve_cached_for_bind(bound_pso, &bound_resolved) (list_x.rs:2855). For a still-tracked compute PSO, that calls resolve_for_bind_retained, which waits for the build (or runs an unclaimed job on the recording thread); the default XCL_PSO_WAIT_MS budget is unbounded. A normal SetPipelineState records the pending PSO in both bind and list_x, and bind::dispatch calls defer specifically so the build is waited for at submit. The split therefore blocks inside Dispatch before defer can return, losing the record-now/wait-at-submit behavior. Could the split use a retained nonwaiting lookup for the continuation's initial PSO, and extend a_dispatch_with_a_pipeline_still_building_waits_at_the_submit through the normal SetPipelineState path? That test currently initializes list_x::bound_pso to zero, so it misses this branch.

This is a source-derived timing review of the exact head; I did not run a native timing reproduction. AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the source and drafted this point; I checked the call chain and existing test before posting.

**@⁠luckyteagirl** on GitHub · 2026-11-26 07:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#pullrequestreview-6070353863) · **reviewed** At head `5333a9b91290a0163e2368bc27e89907c5e4207a`, the mid-list split now calls `resolve_cached_for_bind(bound_pso, &bound_resolved)` (`list_x.rs:2855`). For a still-tracked compute PSO, that calls `resolve_for_bind_retained`, which waits for the build (or runs an unclaimed job on the recording thread); the default `XCL_PSO_WAIT_MS` budget is unbounded. A normal `SetPipelineState` records the pending PSO in both `bind` and `list_x`, and `bind::dispatch` calls `defer` specifically so the build is waited for at submit. The split therefore blocks inside `Dispatch` before `defer` can return, losing the record-now/wait-at-submit behavior. Could the split use a retained nonwaiting lookup for the continuation's initial PSO, and extend `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` through the normal `SetPipelineState` path? That test currently initializes `list_x::bound_pso` to zero, so it misses this branch. This is a source-derived timing review of the exact head; I did not run a native timing reproduction. AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the source and drafted this point; I checked the call chain and existing test before posting.
github-bot force-pushed github-bot/gh-2417 from 5333a9b912 to 1a51cb95eb 2026-11-26 12:26:04 +00:00 Compare
Author
Owner

@⁠fixgep on GitHub · 2026-11-26 12:25 UTC · original

@⁠luckyteagirl Good catch, thanks! Changed list_x::split to use a non-blocking lookup (resolve_cached_if_pending) so it won't wait before submit, and updated a_dispatch_with_a_pipeline_still_building_waits_at_the_submit to cover this with a bound stand-in PSO (1a51cb95).

**@⁠fixgep** on GitHub · 2026-11-26 12:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/2417#issuecomment-7191989077) @⁠luckyteagirl Good catch, thanks! Changed `list_x::split` to use a non-blocking lookup (`resolve_cached_if_pending`) so it won't wait before submit, and updated `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` to cover this with a bound stand-in PSO (`1a51cb95`).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2417/head:github-bot/gh-2417'
git switch 'github-bot/gh-2417'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2417'
git switch 'github-bot/gh-2417'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2417'
git switch 'github-bot/gh-2417'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2417'
git switch 'main'
git merge --squash 'github-bot/gh-2417'
git switch 'main'
git merge --ff-only 'github-bot/gh-2417'
git switch 'main'
git merge 'github-bot/gh-2417'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.