D3D12.X: abort failed device batches and restore pending in title_textures::upload_all #2214
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2224"
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 Decodere on 2026-11-25T10:30:09Z.
What is in it
Part of #2109.
When
upload_queueortexture::upload_batchfails intitle_textures::upload_all()(for example after a 10 s GPU wait timeout on a stalled queue),upload_all()previously kept submitting every remaining batch intodofor the same device, turning one stalled queue into anN x 10 sfreeze while leaving failed and skipped textures stuck withpending = falseand staleLAST_CONTENThashes.This change extracts pure-CPU batch-control (
run_upload_batches) and pending-restoration (restore_pending) helpers incrates/xcl/src/hle/d3d12x/title_textures.rswithout changingtexture.rsor any other file:failed_devices: Vec<usize>across batches (zero allocations on the happy path). Onceupload_queueortexture::upload_batchreturnsErr(e)for a device, log viawarn(&e)and mark that device failed so all remainingtodoitems for that device are drained without runningcontent_hash/same_as_last_upload/subresources_of_all/upload_batch, while unaffected devices continue uploading normally.LAST_CONTENTfor every resource in a failedErrbatch (so retries cannot false-skip as unchanged) and for each failed index in a partialOk(failed)result. OnOk(failed), count only(batch.len() - failed_keys.len())towardUPLOADSand do not restorepending(avoiding infinite retry loops on permanently failing textures).ID3D12Resourcehandles of failed and skipped same-device items until after the loop, lockTEXTURESonce to restorepending = true(and incrementPENDING) only on activeby_resentries where!e.pending && !e.gpu_written, and drop the retainedID3D12Resourcehandles after releasingTEXTURESso raw pointers stay pinned during lookup and COMRelease->forget()cannot re-enterTEXTURES.pendingafter batch failures (Part of #2109); does not claim to fix the upstream RTX 3090 GPU queue stall itself.(Rebased onto
main83b00818to preserve #2844'swith_title_bytes(*va, tex.size() as usize, content_hash)safe-copy read and new concurrent-decommit/guard-page tests insidetitle_textures.rs, alongside #2306'svram::level_pages()->map_levels_with_texels(&r, &subs)and #2976'sXCL_PREPARE=0.)Tested
1.9.2609.5,rustc 1.100.0, debug + release.upload_all_*: 0 passed / 2 failed — device 1 submitted all 4 batches instead of aborting after batch 1 and leftretryempty;restore_pending_*: 0 passed / 1 failed — returned0instead of1).cargo clippy --all-targets -- -A clippy::approx_constanton rebased head043a59f0: exit0,0new warnings or errors incrates/xcl/src/hle/d3d12x/title_textures.rs(only pre-existing upstream warnings elsewhere in the file).XCL_ADAPTER=warp,XCL_WARP=1):cargo test -p xcl --lib -- hle::d3d12x::title_textures:: --test-threads=1 --nocapture-> 24 passed, 0 failed, 0 ignored across 3/3 consecutive runs (14.79–15.38 s,0runtime skips — includes all existing GPU upload tests, #2306'sa_placed_texture_gets_the_pages_of_a_level_with_its_texels, #2844'stitle_bytes_survive_concurrent_decommit+title_bytes_leave_guard_pages_alone, and all 3 PR tests:upload_all_aborts_failed_device_batches_while_other_devices_continue,upload_all_clears_last_content_on_batch_err_and_partial_ok_without_poisoning_skipped, andrestore_pending_requeues_only_active_non_pending_non_gpu_written_entries).cargo test --release -p xcl --lib -- hle::d3d12x::title_textures:: --test-threads=1 --nocapture-> 24 passed, 0 failed, 0 ignored across 3/3 consecutive runs (3.73–3.83 s,0runtime skips).Regression run
Paired quiet 60 s
--releaseruns on desktop NVIDIA GeForce RTX 4060 withXCL_PREPARE=0andXCL_NETWORK=0(viascripts/smoke.ps1 -Seconds 60):Baseline (
main83b008188efbf954b846667f48d75e3fa9310a01,XCL_PREPARE=0 XCL_NETWORK=0):PR head (
043a59f04d3594f4b523cf6f20acc4b0aec54702,XCL_PREPARE=0 XCL_NETWORK=0):Not tested
texture::upload_batchtimeout on live D3D12 hardware; failure-path batch abort,LAST_CONTENTinvalidation, andrestore_pendingstate transitions are covered by the pure-CPU unit tests, while the happy path ran under the WARP and RTX 4060 GPU unit tests and paired 60 s smoke runs above.prepare_for_launch) was skipped in the paired 60 s smoke runs viaXCL_PREPARE=0(introduced by #2976); shaders compiled on demand during the run.83b00818(onlyclippy --all-targets, targeted 3x Debug WARP + 3x Release RTX 4060title_textures::suites, and paired 60 s smokes ran on043a59f0).ID3D12Devicehardware scenarios live (covered by pure-CPU unit test) or non-Windows / Wine hosts.AI use
Implemented, rebased, and verified with Google Antigravity (Gemini 4 Neon). All code changes, failing-first and post-rebase unit tests, clippy checks, and paired 60 s RTX 4060 smoke runs were reviewed and executed locally.
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:48:33Z.
Code review on
3a60f54:run_upload_batches+restore_pendingincrates/xcl/src/hle/d3d12x/title_textures.rscleanly stops submitting subsequent batches for a failed device, preservesLAST_CONTENTfor unchanged/skipped entries while clearing failed keys, and re-markspendingonly for active!pending && !gpu_writtenentries (dropping COM handles outsideTEXTURESto prevent lock re-entry).Build and testandPR descriptionare both green (CLEAN).Remaining before merge: Dual-vendor (AMD + NVIDIA) verification on
3a60f54.Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-25T12:31:36Z.
Verification on NVIDIA RTX 5070 Ti (Windows 11), head
3a60f54e96c01ea9600744ba69ce3d2d39cf91b3Tested
3a60f54e96c01ea9600744ba69ce3d2d39cf91b3(git rev-parse HEADof a clean worktree, no local changes, built as is; merge-base withmain568e7db7729c8fa6c8f0f4b32d798faaf11462bb). The PR was open and the head unchanged when I started and again before writing this.cargo testdefault), DXC from the Windows SDK 10.0.26100.0 (dxcompiler/dxil 1.8.2502.11).cargo test -p xcl --lib title_textures -- --test-threads=4 --nocapture: 17 passed, 0 failed, 0 ignored (9 s). This includes the three new tests (upload_all_aborts_failed_device_batches_while_other_devices_continue,upload_all_clears_last_content_on_batch_err_and_partial_ok_without_poisoning_skipped,restore_pending_requeues_only_active_non_pending_non_gpu_written_entries).cargo test -p xcl --lib hle::d3d12x -- --test-threads=4 --nocapture: 180 passed, 0 failed, 2 ignored (11 s).cargo test -p xcl --lib -- --test-threads=4 --nocapture(whole lib): 1097 passed, 4 failed, 26 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3, each withCreateComputePipelineState: Not enough memory resources are available to complete this operation. (0x8007000E). They are not from this PR: the same four tests fail with the same message on its merge-base568e7db(same command: 1094 passed, 4 failed, 26 ignored; the 3 extra passes here are this PR's new tests). Runninggpu::dxil::fuzz_testsalone at this head, twice, gave 4 failed both times (andfuzz_validate_and_gpu_0alone with--test-threads=1failed too), andgpu::dxil::fuzz_testson the merge-base gave 4 failed again.SKIPPEDlines in the whole-lib run: 23 GPU tests withno wave64orrefused (unsupported V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 ...)on this wave32-only GPU, andshaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required), 0x887A002D.Not tested
xcl-smokerun; this is a unit-test run only.cargo test --workspaceand the other test targets undercrates/xcl/tests; release profile.AI use
Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T17:14:21Z.
Rebased onto
50a9fdef(85d79bf6, preserving#2306'svram::level_pages()/map_levels_with_texelsandvram::before_executeinsideupload_all). Re-verifiedtitle_textures::tests(22/0), paired 60 s RTX 4060 smoke (1544 -> 1565,0device removals/crashes), and workspace (1291 passed, 1 failedsolely on50a9fdef's#2074test).Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T18:13:26Z.
Independent AMD RDNA4 (native wave64) test report on exact head
85d79bf639d42a0c7149c3efcadf6bb0cd3abb1a(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: 1289 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::title_textures::tests::restore_pending_requeues_only_active_non_pending_non_gpu_written_entries,upload_all_aborts_failed_device_batches_while_other_devices_continue, andupload_all_clears_last_content_on_batch_err_and_partial_ok_without_poisoning_skipped.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
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T08:15:23Z.
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-27T07:19:07Z.
Rebased cleanly onto
main(83b008188efbf954b846667f48d75e3fa9310a01) at043a59f04d3594f4b523cf6f20acc4b0aec54702, resolving conflicts incrates/xcl/src/hle/d3d12x/title_textures.rswhile preserving #2844'swith_title_bytessafe-copy read and tests alongside #2976'sXCL_PREPARE=0.Re-verified on the rebased head (
rustc 1.100.0, DXC1.9.2609.5, Windows 11, desktop NVIDIA RTX 4060):cargo clippy --all-targets -- -A clippy::approx_constant: clean (0new warnings intitle_textures.rs)hle::d3d12x::title_textures::(3xeach):24 passed; 0 failed; 0 ignored(0runtime skips)--releasesmoke runs withXCL_PREPARE=0 XCL_NETWORK=0(83b008181609frames /14027 MBvs043a59f01604frames /14042 MB,0device removals,0crashes)PR description,Build and test (Windows, no GPU)): passing (MERGEABLE/CLEAN)Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:37:04Z.
Triage (#1607) – head
043a59fNo other open PR aborts the rest of a failed device's batches in
title_textures::upload_all. #508 touches the same loop but differently: it only records the content hash after a successful upload. Here the hash is cleared on failure viaclear_last. The two will conflict.No problems found in the diff. Note that items in an
Ok(failed)partial failure have their hash cleared but are not put back topending; only whole-batch/queue failures are retried. A permanently removed device keeps its textures pending, and each submit retries one batch.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.