D3D12.X: keep in-flight texture upload objects alive on Signal/wait failure #1476
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1486"
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 b3IKK on 2026-11-24T16:50:49Z.
After
ExecuteCommandLists,upload_batchcalledSignalandwaitand then dropped the allocator, command list and staging buffer unconditionally. IfSignalor the wait failed, the CPU freed memory the GPU could still be reading; the same applies to the uploader kept inUPLOADERS, which was keyed only by the queue pointer and could hand a device another device's staging buffer.This keeps the in-flight objects alive when
Signalor the wait fails (finish_gpu_waitforgets them instead of dropping them) and keys the uploader map by(device, queue).What is in it
crates/xcl/src/gpu/texture.rs:finish_gpu_wait;upload_batchkeeps(allocator, command list, staging)alive on error;UPLOADERSis keyed by(device, queue); unit testfinish_gpu_wait_keeps_inflight_alive_on_error_and_returns_on_ok.(device, queue)key when rebasing.Since the last push: rebased onto
main06c9f55. The conflict was in the test module, wheremainhad addedlarge_staging_uses_sixteen_mib_growth_steps/gpu_large_mixed_upload_keeps_tight_staging_and_exact_pixelsat the same place; both sides are kept.mainalso changed the uploader key to(device, queue), so the branch's test now builds that key too.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\\scripts\\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 1266 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib -- gpu::texture: 15 passed, 0 failedstd::mem::forget(in_flight)put back tostd::mem::drop(in_flight): 0 passed, 1 failed —assertion left == right failed: in-flight objects must stay alive on error(left: 1, right: 0)Regression run
main (
426a5a7, clean tree, no local changes):PR (
bd33797, clean tree, no local changes):(The main block is
426a5a7, an ancestor of the currentmain06c9f55, from the same machine and data folder.)Not tested
Signal/waitfailure while the GPU is still reading (the test drivesfinish_gpu_waitdirectly)AI use
06c9f55, kept both tests at the conflict, adapted the test tomain's(device, queue)key, confirmed the new test fails without the fix, ran the suite and thescripts/smoke.ps1pair.Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T16:55:30Z.
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on
main@b7aa9f3(baseline 770 passed, 0 failed, 41 ignored on this box):One more than the baseline; keeping in-flight texture upload objects alive is covered and green.
Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:28Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:26:21Z.
Empirical test report (
8151725a)PR #1486 at
8151725a18ccc773b0cf23ef1732224c52adc7aa.Hardware / environment
32.0.101.9175. Windows also listed a Microsoft Basic Display Adapter.rustc 1.100.0 (0ef1bc386 2026-11-09)and DXC1.9.2609.5(01b62ad47). The Cargo test profile was unoptimized, with incremental compilation and debug info disabled.XCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1. The GPU fixture requested the default D3D12 adapter. Its output did not identify the adapter.Commands and results
cargo test --workspace --no-runexited 0 outsideInvoke-ArcTest.ps1.Inside
Invoke-ArcTest.ps1, ran the compiled library test executablexcl-77aca8ccb20e299f.exewith these exact arguments.The focused run exited 0 and finished in 1.80 s. The log recorded 2 passed, 0 failed, 0 ignored, 0 skipped, and 742 filtered out. Both named tests reported
ok. Skips were counted from case-sensitiveSKIPPEDlines.Observed behavior
finish_gpu_wait. A synthetic error left the in-flight object's drop count at zero. A successful wait returned ownership, and dropping the returned value increased the count to one.(device, queue)cache key.Not tested
The full GPU workspace suite and game smoke runs were omitted. The focused run did not inject a real D3D12
Signalor fence-wait failure or exercise cache reuse across devices.AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1486-focused.logand published.Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-25T16:04:16Z.
Rebased onto
main06c9f55; the conflict wasmain's two new staging tests in the same module, and both are kept.mainhad also changed the uploader key to(device, queue), so the branch's test builds that key now. Headbd33797: suite 1266 passed, 0 failed, 46 ignored; withstd::mem::forget(in_flight)replaced bydropthe new test fails (left: 1, right: 0); smoke 1636 frames, 0 crashes, 0 removals.AI use: OpenCode, Claude Fable 5.2 rebased it, adapted the test, ran the suite and the smoke pair and wrote this.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:27:38Z.
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 Decodere on 2026-11-27T15:37:33Z.
Independent desktop NVIDIA verification of PR #1486 at head
bd33797d4255854b290515dd0c93757ccbf26c96(1commit; exact parent & merge-base:06c9f5505f63f10c5ec49ef932d75b2c28177324, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
bd33797d)cargo test --release -p xcl --lib -- --nocapture finish_gpu_wait_keeps_inflight_alive_on_error_and_returns_on_ok(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1222 filtered out× 3 (0.00s,0.00s,0.00s,0skipped)cargo test --release -p xcl --lib -- --nocapture gpu::texture::(3 consecutive runs)15 passed; 0 failed; 0 ignored; 1208 filtered out× 3 (0.65s,0.57s,0.58s;14executed incl. 3 live RTX 4060 GPU upload tests withbyte_exact=true+1self-skippedretail_ttpf_textures_detile_with_their_mip_chainsbecauseXCL_SAMPLE_TTPFis unset)cargo build --release -p xcl1m 29s, exit0,0new warnings ingpu/texture.rs)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
06c9f5505f63f10c5ec49ef932d75b2c28177324, cached baseline on the same machine):PR #1486 (
bd33797d4255854b290515dd0c93757ccbf26c96):Limits of coverage
finish_gpu_wait_keeps_inflight_alive_on_error_and_returns_on_okand all14executedgpu::texture::tests (including live RTX 4060gpu_upload_batches_reuse_the_queues_upload_buffer,gpu_console_textures_upload_every_mip_and_slice, andgpu_large_mixed_upload_keeps_tight_staging_and_exact_pixels) passed3/3;retail_ttpf_textures_detile_with_their_mip_chainsself-skipped becauseXCL_SAMPLE_TTPFwas unset.Signal/fence-wait failure path is verified by thefinish_gpu_waitunit test rather than by injecting a live D3D12 device removal during texture upload; the 60 s retail smoke confirms normal upload reuse and runtime stability (0device removals,0crashes, steady 60 Hz), with single-run frame/commit delta vs. the cached parent reflecting normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T16:12:31Z.
Tested on AMD / Linux:
bd33797d(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (not merged onto current
main), with its base06c9f550as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --lib -- gpu::texture:: --test-threads=1: 15 passed, 0 failed, 0 ignored (includesfinish_gpu_wait_keeps_inflight_alive_on_error_and_returns_on_ok).cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(here the first loses the RADV device, the other two run out of memory under Wine): lib 1181 passed, 16 failed, 26 ignored; base06c9f550(this PR's base) the same session: lib 1180 passed, 16 failed, 26 ignored. The failures are the same set as on the base. The other binaries fail the same 3 tests as on the base (e2e,pls_quota,predication_e2e).d3d12_resource_and_sync: 3 passed, 0 failed on this head; on the base its fence and queue test ended the process (exit 1), which it does in most trees here,mainincluded.Not tested
Signalor fence-wait failure happened)AI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T23:28:14Z.
merge-check claim
head:
bd33797d42Imported from ivall/xcl. Originally posted by throny on 2026-11-27T23:41:21Z.
merge-check
base:
2c717a04head:
bd33797d42merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1467 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1466 passed, 0 failed, 47 ignored (26 SKIPPED lines)
review: no blocking finding. On main a failed Signal in upload_batch returns early and drops the uploader while its list may still run, and upload() drops allocator, list and staging after a failed wait; the PR keeps them alive in both cases (a deliberate leak on an error path), which is right. Outside the stated purpose: the uploader table's key changes from the queue to (device, queue). The test checks the helper's forget / drop only, not an upload error path. For whoever merges: textual conflicts with #2558 and #2678 in texture.rs, and one in meaning: #2558's new error path drops the in-flight objects when its wait fails, which is what this PR forbids; whichever lands second should route that path through this PR's helper.
performance: none by default (error paths only).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T03:53:58Z.
merge-check
base:
e429936c10head:
bd33797d42merge: conflicts (crates/xcl/src/gpu/texture.rs)
build: not run (the PR does not merge into this base)
tests: not run
review: not done (the merge has conflicts)
performance: not assessed
verdict: not yet: conflicts with main (crates/xcl/src/gpu/texture.rs); rebase onto main
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile. Claude Code: Claude Opus 5.5 (coordination, draft).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:54:54Z.
Triage (#1607) – head
bd33797Part of this is on main now: commit
5ee15471(drop_after_wait) handles a failed Signal inupload_batch(fallback queue wait, objects forgotten only if that fails too), and the forget on a failedfence::waitwas already there. The PR conflicts with that code and should be rebased onto it.What main still lacks is the synchronous
texture::upload: it still doesdrop(staging)afterwaitfails, sofinish_gpu_wait((alloc, list, staging), ...)there is still useful.The UPLOADERS key change to (device, queue) is not mentioned in the title and is a separate change; a queue pointer already identifies its device.
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.