D3D12.X: a pipeline is forgotten before its address is free #2422
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2422
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2422"
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?
@veyn-sudo on GitHub · 2026-11-25 18:24 UTC · original
veyn-sudo:pr/forget-pso-first→main· +58 −1 · 1 files · 1 commits · openpso_releasedrops what XCL keeps of a pipeline by its address (forget_pso) after the driver has freed it. A pipeline that another thread makes in between can get the same address, register itself, and lose its own entries: a translated compute program then counts as untranslated (is_translated_compute) and its dispatches are skipped. Background workers make pipelines while titles release them, so nothing keeps the two apart.Found by reading the code while looking into #2403. I have not seen it happen in a title.
res_releasehas the same question, see #1404 and #1527; the stand-ins ofstandin.rsalready forget first. #2417 changespso_releasetoo, as part of a larger change; withXCL_LATE_RELEASE=0it still forgets after the release.What is in it
crates/xcl/src/hle/d3d12x/real.rs: on the last reference (AddRefsays 2)pso_releaseforgets before it releases. Two threads that release the last two references at once can both miss being the last: then it is forgotten after the release, as before.main(left: Some(true),right: Some(false)).Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on349970c: 1364 passed, 0 failed, 46 ignored.SKIPPEDlines: 21 no wave64, 3 f16 forms refused, 1 no heap windows.Regression run
main:
this PR:
Not tested
AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_01WStEFektfHt5AEbK6Wupac
@emirduran707 on GitHub · 2026-11-25 19:00 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
836ddedac40e3ef43164a17df941c950c26a3df4(clean detached checkout, no local changes).Tested
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: 1288 passed, 3 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused 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.hle::d3d12x::real::pso_release_tests::a_pipeline_is_forgotten_before_its_address_is_free.main68a284a:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722) andfuzz_validate_and_gpu_3(seed 1599) on this GPU, plusgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(from50a9fde/ #2074).Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@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):The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge.
— Devin
@veyn-sudo on GitHub · 2026-11-25 21:04 UTC · original
That test was failing on
mainitself then (#2074's, fixed since). On this head (349970c, rebased) the suite is 1364 passed, 0 failed.AI use: Claude Code (Claude Opus 5.5) wrote this.
@veyn-sudo on GitHub · 2026-11-25 21:46 UTC · original
The first
Releasebalances theAddRef(add(this)) above it, which is how the count is read. So a call takes off one reference: the test starts with two and sees one after the firstpso_release; two taken off would leave zero.AI use: Claude Code (Claude Opus 5.5) wrote this.
@oni-swr on GitHub · 2026-11-25 22:10 UTC · original
Independent AMD report for
349970c0a7ad9d336675e3ea2a93263294c09511.Tested
XCL_ADAPTER=radeon. Exact PR head (not a local merge ontomain); main at the time was6d12f58a.cargo test --workspace --no-fail-fast -j 4 -- --test-threads=4: 1363 passed, 1 failed, 46 ignored. The one failure isgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722:res[30] = 0x1, CPU 0x7fffffff); it fails identically onmain6d12f58aon this adapter (cargo test -p xcl --lib fuzz_validate_and_gpu_1), so it is not caused by this PR.f16_programs_on_the_gpu/f32_programs_on_the_gpuper-lane cases refused forV_MUL_F16,V_PK_MUL_F16orV_CVT_F16_F32, andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).real::pso_release_tests::a_pipeline_is_forgotten_before_its_address_is_freepassed.Not tested
scripts/smoke.ps1/ a retail title (no regression run), other adapters, NVIDIA. No game data was used.AI use
Claude Code (Claude Sonnet 5.5) ran the tests and wrote this report. No game files, dumps or shader names are included.
@DavidM1911 on GitHub · 2026-11-26 02:22 UTC · original
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
@itsSio on GitHub · 2026-11-26 03:57 UTC · original
Independent dual-PC NVIDIA full-workspace test report on clean head
349970c0a7ad9d336675e3ea2a93263294c09511.Tested
32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200,rustc 1.97.0(stable-x86_64-pc-windows-msvc), DXC1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA)cargo build --workspace: exit 0cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1364 passed, 0 failed, 46 ignored (real::pso_release_tests::a_pipeline_is_forgotten_before_its_address_is_freepassed)SKIPPED: 26 (wave64-only GPU tests,#1426wave32 f16/cvt refusals,heap_window_out_of_memory_falls_back_to_the_switch_form,pso_measurement_compiles_an_exact_synthetic_record)32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200,rustc 1.99.1(stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA)cargo build --workspace: exit 0cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1363 passed, 1 failed, 46 ignored (real::pso_release_tests::a_pipeline_is_forgotten_before_its_address_is_freepassed; the sole failure was unrelated intermittentxgameruntime::gamesave::tests::atomic_writes_preserve_xcltmp_blobs_and_skip_leftover_tempsatgamesave.rs:958, which passed 2/3 standalone reruns and 11/11 in thegamesavemodule)SKIPPED: 29 (same 26 as Machine 1 plus 3 requiringd3d12SDKLayers.dll)Not tested
scripts/smoke.ps1runs--release)AI use
Ran via Samaritan:
github-bot referenced this pull request2026-11-26 06:18:31 +00:00
@ClosetPie107 on GitHub · 2026-11-26 06:49 UTC · original
AMD RDNA4 / Linux (Proton Experimental) test report on head
349970c0(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 / GPU tests (
mainb49be183+ #2422349970c0, debug,--test-threads=1,WINEDLLOVERRIDES="d3d12,d3d12core=n"):xcl.exe hle::d3d12x::real:: -- --test-threads=1: 61 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.@bmjask on GitHub · 2026-11-25 20:51 UTC · original · reviewed
P1: pso_release calls the original Release twice: f(this); then let n = f(this). Every caller Release therefore drops two COM references, risking premature pipeline destruction/use-after-free. The new test masks this by starting from two refs; after its first pso_release it sees one rather than proving the expected one-reference decrement. Remove the stray first call and assert exact one-release/one-ref behavior.
xcl nvprofileputs xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590View 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.