DirectStorage: close a queue when its last reference is released #1665
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1675"
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?
Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T19:12:14Z.
DirectStorage specifies that
IDStorageQueue::Close(IDStorageQueueX::Close) is called automatically when the last reference on a queue is released.queue_releaseonly dropped the channel sender without callingclose(), so releasing the final queue reference without a priorClose()leftclosed == false: remaining submitted requests in the channel continued writing into caller destination buffers afterRelease()returned,Release()did not wait for in-flight worker activity or wake parallel decompression staging-budget waiters, and pending or remaining status-array entries stayedE_PENDINGor completed withS_OKinstead ofE_QUEUE_CLOSED.What is in it
crates/xcl/src/hle/dstorage.rs: movequeue_close's logic (includingparallel::wake_waiters(self)from #819) intoQueueInner::closeand call it from bothqueue_closeandqueue_releasewhenn == 0.crates/xcl/src/hle/dstorage.rs(tests): addlast_queue_release_closes_pending_and_submitted_work_before_returningverifying that a finalRelease()withoutClose()waits for the active worker item to finish, skips remaining submitted requests without touching caller destination buffers, and marks both submitted and unsubmitted status entries complete withE_QUEUE_CLOSED.Tested
32.0.32015.16001),rustc 1.100.0 (0ef1bc386 2026-11-09), debug and release.cargo test --workspace --no-fail-fast -- --test-threads=4: 890 passed, 0 failed, 42 ignored (SKIPPED GPU tests: 2 –shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is off);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).cargo test -p xcl --lib dstorage -- --test-threads=4(default andXCL_DSTORAGE_PARALLEL_DECOMPRESS=1): 30 passed, 0 failed on each run (last_queue_release_closes_pending_and_submitted_work_before_returningfailed before the fix becauseReleasereturned while the worker was still active and the submitted request wrote to the destination buffer afterwards).Regression run
main:PR head:
Not tested
Close()first.XCL_SAMPLE_*sample-data tests.AI use
queue_releasevsqueue_closeindstorage.rs, wroteQueueInner::closeand the unit test, rebased onto #819, and ran the test suite and 60 s smoke check.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:37:40Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by frenziedcoder on 2026-11-24T21:54:41Z.
NVIDIA test report for
47ce44e: the full workspace and a smoke pair on the retail title, next to @DavidM1911's RTX 3060 Ti library run above. Full suite green, the PR's own test passes, and a clean smoke pair (1656 vs 1649 frames).Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head47ce44e4b8d7d2a016a1166c680f6c0b1cfef20f, no local changes.cargo build --workspace && cargo test --workspace -- --test-threads=4(debug): 890 passed, 0 failed, 42 ignored; the PR's own test passes. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Regression run (
scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen;XCL_PSO_PRELOAD=0for both builds, because this machine's preload list holds the program of #1307)base (
b9b6ea6, this PR's merge base withmain):this PR:
Not tested: a title releasing a DirectStorage queue with requests in flight without
Close(); the world load; AMD.AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.
upstream-sync referenced this pull request2026-11-24 23:06:49 +00:00
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T03:55:25Z.
PR #1675 · DirectStorage queue close on final release
Tested clean head
47ce44e4b8d7d2a016a1166c680f6c0b1cfef20fon STOR-WINLAB. The focused DirectStorage run passed. The full workspace run exited 101.Tested
DoublePrecisionFloatShaderOps=0, and nod3d12SDKLayers.dll. DXC/DXIL 1.9.2609.5,rustc 1.100.0 (0ef1bc386 2026-11-09), unoptimized dev/test profiles with debug info disabled.cargo build --workspaceandcargo test --workspace --no-runsucceeded. Allcargo testinvocations usedInvoke-ArcTest.ps1withXCL_ADAPTER=A770.cargo test -p xcl hle::dstorage -- --nocapturereported 30 passed, 0 failed, 0 ignored, and 0SKIPPEDlines.last_queue_release_closes_pending_and_submitted_work_before_returningpassed in both runs. It checks that final release waits for active worker work, leaves the submitted request's destination buffer untouched, and completes submitted and pending statuses withE_QUEUE_CLOSED.cargo test --workspace --no-fail-fast -- --test-threads=4reported 872 passed, 18 failed, 42 ignored across 20 harness summaries inpr1675-suite.log. The log contains 4SKIPPEDlines, which are excluded from coverage.Failures and skips
CreateComputePipelineStatefailures (0x80070057, including FP64 cases) and four assertion failures covering fused FMA overflow, implicit-LOD sampling, FP16 high-half preservation, and pixel wave reductions.RSSetDepthBiasXrendering check. Its DirectStorage file read, status, and D3D12 fence check passed.Not tested
Retail-title smoke runs on
mainand the PR head, amainsuite baseline for the failures, optional game-data cases (XCL_SAMPLE_*unset), D3D12 debug-layer coverage, and other adapters.AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1675-suite.logand published.Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T19:44:28Z.
AMD RX 7800 XT test report
Tested locally by merging PR head
47ce44e4b8d7d2a016a1166c680f6c0b1cfef20fonto basemain3f2777019544c0ada2cd294aa792d3c378ff0df8(no push). The base is an ancestor of currentmainand both trees merge cleanly.Hardware and tools: AMD Radeon RX 7800 XT, driver 32.0.31035.1003; Windows 10 Pro; Rust 1.100.0 / Cargo 1.100.0; DXC 1.8.2502.11 (DXIL 1.8.2502.11). Debug test build.
cargo test --workspace --no-fail-fast -- --test-threads=4: 1,356 passed, 2 failed, 46 ignored. There were 7SKIPPEDreports: six GPU cases (wave32/wave64 variants for three unsupported instruction forms) and one heap-window case. The two failures and all 7SKIPPEDreports match the baseline (1,355 passed, 2 failed, 46 ignored).Not tested
AI use
Codex (gpt-6-luna) ran Phase 2 tests and wrote this report (Phase 1 pre-compile / initial baseline run used Claude Code (Claude Sonnet 5.5)).
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:27:52Z.
Review: COMMENTED
No concrete source defect found. Final Release close preserves lock order, rejects post-close enqueue/worker creation, wakes waiters, and waits outside locks; active/pending work test is useful. Please provide current Windows CI rather than only PR-description evidence, and add final-release coverage while parallel decompression workers await staging-budget capacity. I found no blocker.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T06:07:46Z.
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
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-26T06:48:56Z.
AMD RDNA4 / Linux (Proton Experimental) test report on head
47ce44e4(merged cleanly ontomainb49be183):Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnuIsolated unit tests (
mainb49be183+ #167547ce44e4, debug,--test-threads=1):xcl.exe hle::dstorage:: -- --test-threads=1: 32 passed, 0 failed, 0 ignored (0 skipped).Combined 300 s retail sanity run (release,
mainb49be183+ #1540 + #1675 + #1844 + #1899 + #2123 + #2369 + #2422, retail 1.0.2.1 pressingApast menus):exit=0), 0 crashes, 0 device removals,2,014PresentXframes,131,072translated draws,660,943dispatches (44,546chained split-compute dispatches),102,631Opus packets (0 errors).Not tested
AI use
main, ran the Proton unit tests and combined retail run on this machine, and drafted this report.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:28:31Z.
Triage (#1607) – head
47ce44eNo open or merged PR makes the same change; main's
queue_releaseincrates/xcl/src/hle/dstorage.rsstill only drops the worker sender on the last release.The diff moves
queue_close's body intoQueueInner::closeand calls it from the finalRelease, so pending status entries getE_QUEUE_CLOSEDand Release waits for the in-flight request. Note that the lastReleasecan now block the title's thread until the worker's current request finishes.The PR conflicts with main and needs a rebase.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.