Repository navigation
Conversation
|
Tested Independently reran the pinned XCL library test binary for Both native processes exited 0. Total was 2 passed, 0 failed, 0 ignored, 0 skipped. The fixture asserted that three synthetic pipelines went from refcounts Not tested Real D3D12 queues and fences, live COM objects, GPU, retail titles, leak rates, and the workspace suite. AI use T3 Code through Codex ( |
|
Follow-up on PR #3185 at head One lifecycle ordering still retains a pipeline: the title releases its last stand-in while the submission receipt is pending, then the fence completes after the PR's release-time sweep. If no later submission or PSO release occurs, nothing is guaranteed to sweep the receipt again. The native pipeline reference therefore remains retained after GPU use has ended. The related observed failure is tracked in #3441. I added this schedule as a synthetic regression. With the regression test added but before the runtime candidate, it failed after the fake fence advanced ( The candidate starts XCL's existing late-release worker after queuing an incomplete pinned receipt, then sweeps these receipts on worker ticks. This uses one existing worker and does not poll fences synchronously on each submission. This is focused CPU evidence only; I did not run the workspace suite, live D3D12 fence checks, GPU tests, or title smoke. The PR remains a draft, so this is not a merge check. Candidate fix and regression testdiff --git a/crates/xcl/src/hle/d3d12x/late_release.rs b/crates/xcl/src/hle/d3d12x/late_release.rs
@@ -254,11 +254,16 @@ fn start_thread() {
let _ = std::thread::Builder::new().name("xcl-late-release".into()).spawn(|| loop {
std::thread::sleep(TICK);
+ super::pso_async::sweep_native_generations();
unsafe { drain_known(false) };
});
});
}
+pub(super) fn start_native_generation_worker() {
+ start_thread();
+}
+
/// A pipeline state XCL owns (raw pointer, 0 = none) is let go: the compute pass of a two-pass
diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@ -3758,7 +3758,7 @@ fn dedup_generations<G>(pins: impl Iterator<Item = G>, identity: impl Fn(&G) -> usize) -> Vec<G> {
-fn sweep_native_generations() {
+pub(super) fn sweep_native_generations() {
@@ -3788,6 +3788,7 @@ pub(super) fn retire_native_generations<'a>(
}
RETIRING_GENERATIONS.lock().unwrap().push(receipt, pins);
+ super::late_release::start_native_generation_worker();
sweep_native_generations();
}
diff --git a/crates/xcl/src/hle/d3d12x/list_x.rs b/crates/xcl/src/hle/d3d12x/list_x.rs
@@ -7563,6 +7563,24 @@ fn releasing_a_standin_after_its_submission_completed_releases_the_pipeline() {
assert_eq!(native.refs.load(Ordering::Relaxed), 0, "a completed submission kept the released pipeline");
}
+/// A completion after the title's last release needs a background sweep even when no later
+/// submission or PSO release arrives to trigger one.
+#[test]
+fn release_before_receipt_completion_is_reaped_while_idle() {
+ let _serial = RETIRING_TESTS.lock().unwrap_or_else(|e| e.into_inner());
+ let standin = 0x7E57_B02Busize;
+ let (native, completed) = pinned_in_flight(standin);
+ super::super::pso_async::release(super::super::pso_async::released(standin));
+ assert_eq!(native.refs.load(Ordering::Relaxed), 1, "in-flight receipt released its generation");
+
+ completed.store(1, Ordering::Release);
+ let deadline = Instant::now() + Duration::from_secs(1);
+ while native.refs.load(Ordering::Relaxed) != 0 && Instant::now() < deadline {
+ std::thread::sleep(Duration::from_millis(1));
+ }
+ assert_eq!(native.refs.load(Ordering::Relaxed), 0, "idle completion worker did not retire the generation");
+}AI use: Codex (GPT-6.2 Sol) prepared and tested the candidate; GPT-6.2 Astra checked the fence-completion lifecycle. |
|
No open or merged PR makes the same change. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Review (head 0cd75ea, diff read, not a merge-check; draft):
Fine:
Once it's out of draft, a suite run and smoke pair on current main would make it ready. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Test report, head Edit: the lib test binary aborts in about 3 of 10 runs with this PR; see below. This report does not count as a clean run.
New abort. A second full-suite run, on this merge plus #1249 (which only touches
Not run: a title (no smoke run), AMD / wave64. Tool and model: Claude Code (Claude Opus 5.5) merged, built, ran the tests and drafted this; I checked it. |
retire_native_generations swept completed batches only when a new
in-flight batch arrived. A submission whose receipt was already complete
returned before the sweep, and the title's release of a stand-in did not
sweep at all. A pipeline pinned by a submission still running when it was
retired then kept its last reference for good when every later submission
had finished first, or when none followed: its TWO_PASS entry stayed too.
That made two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs
fail about 3 in 10 runs on an RTX 3090 ("releasing the title PSOs releases
their two-pass state", left 1; xcl-dev#3441). A trace showed the leaked
pipeline's pin queued behind a pending fence, then only complete
submissions.
Sweep before the early return for a complete receipt, at the start of
pso_async::released, and on each tick of the late-release worker, which
a pinned in-flight submission now starts: a fence that completes after
the title's last submission and release is otherwise never looked at
again (the case and the worker sweep are thehollowedone's, on xcl-dev#3185).
Three unit tests cover the cases and fail without the fix; the
generation retirement tests run one at a time, since a concurrent sweep
may still hold another test's retired pin.
Assisted-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0cd75ea to
6f26306
Compare
|
Rebased onto
#3441's test alone on the 3090: AI use: Claude Code (Claude Opus 5.5) rebased, added the fix, ran the tests and wrote this while I was away; posted with my standing approval for this session. |
|
Follow-up review of In short: This push adds a third sweep point. The late-release worker now sweeps completed pipeline pins on each tick, and it is started when a pinned submission is still in flight. A fence that completes after the title's last submission and release is now seen too. The lock doc comment now says which other sweeps run without it, and a third unit test covers the idle case. Nothing blocks it. Checked and fine
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point. |
|
The flaky
With a temporary trace on Other PRs' test reports count this test's two failures against the PR (for example on #3676), so this PR also cleans up their counts. AI use: Claude Code (Claude Opus 5.5) ran the tests and traced the references; I posted it. |
pso_async::retire_native_generationskeeps each pinnedNativeGeneration(an extra reference on the real PSO) until its submission's receipt completes. Completed batches were swept only when a new pending batch was queued. Retiring an already-complete receipt returned early, andreleased()didn't sweep at all. A batch queued behind a pending fence therefore leaked its pins, and the pipeline'sTWO_PASSentry with them, whenever every later submission had already completed or no later submission came. Introduced in 11613fb (#2959). Fixes #3441.What is in it (one commit, on
mainc53e9696)pso_async.rs: sweep completed batches when retiring an already-complete receipt, and at the start ofreleased(). Queuing an in-flight pinned receipt starts the late-release worker.late_release.rs: the worker sweeps the completed pins on each tick, so a fence that completes after the title's last submission and release is still looked at (thehollowedone's case and fix from the review below).list_x.rstests:a_completed_later_submission_retires_earlier_generations,releasing_a_standin_after_its_submission_completed_releases_the_pipeline, anda_submission_completed_after_the_last_release_is_swept_while_idle(thehollowedone's test). Each fails without its part of the fix. The tests that use the retirement queue take a shared lock (RETIRING_TESTS); its comment now says which other sweeps run without it.Tested
XCL_D3D12_DIRset to an empty folder: with the Agility SDK 1.620 the lib test binary stops on this machine, Tests: on an AMD RDNA2 iGPU the xcl lib test binary stops itself partway ("sparse upload preparation still failed after bounded retries") since #2959 #3488).cargo test --workspace --no-fail-fast -- --test-threads=4on6f263066: 3007 passed, 0 failed, 52 ignored; SKIPPED: 26 (22 no wave64 on this 32-lane GPU, 2 no xgameruntime.dll, 2 no heap windows). An earlier run of the same head had 3006 passed and 1 failed: the e2e test title's "a texture in title memory follows CPU writes" check, the intermittent failure of D3D12.X: a submit misses a CPU write into memory idle for 1.5 s (hot write-watch looks); intermittent e2e failure #3382;cargo test -p xcl --test e2ethen passed 3 of 3 on this head (and 5 of 5 onmain).cargo test -p xcl --test gpu_two_pass_cache_e2e -- --test-threads=1:mainc53e9696failed 3 of 6 (left: 1,right: 0at line 584);6f263066passed 6 of 6.cargo test -p xcl --lib -- --test-threads=4 hle::d3d12x::pso_async10 of 10 ok on6f263066(193 passed each). The race was ingraphics_first_use_carries_the_exact_serialized_recipe_identity, whose job returned a fake pipeline; Tests: pso_async first-use test submits a job that builds nothing #3493 (merged) made it return none, and this branch is now on top of it.a_submission_completed_after_the_last_release_is_swept_while_idlefails without the worker's sweep (left: 1,right: 0) and passes with it.Regression run
main:
this PR:
Not tested
GetCompletedValueper distinct fence among the pending batches on every 4 ms tick while any are pending (a lock and an empty check when none are). And of the sweep inreleased()at a level change that releases many pipelines. Not measured.smoke.ps1sends no input).AI use
🤖 Generated with Claude Code