Repository navigation
Conversation
Member
|
Code review on
Remaining before merge: Dual-vendor (AMD + NVIDIA) verification on |
Contributor
|
Verification on NVIDIA RTX 5070 Ti (Windows 11), head Tested
Not tested
AI use
Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5). |
…tures::upload_all When `upload_queue` or `texture::upload_batch` fails (for example, a 10 s GPU wait timeout), `title_textures::upload_all()` previously kept submitting every remaining batch in `todo` for the same device, turning a single stalled queue into an `N x 10 s` freeze and leaking failed/skipped textures with `pending = false` and stale `LAST_CONTENT` hashes. Track failed devices across batches via `run_upload_batches` and `restore_pending`: - Once a device returns `Err` from `upload_queue` or `texture::upload_batch`, skip remaining `todo` items for that device (avoiding `content_hash`, detiling, and further submits) while still allowing unaffected devices to upload normally. - Clear `LAST_CONTENT` for every resource in a failed `Err` batch and for each failed item in a partial `Ok(failed)` result (counting only succeeded uploads toward `UPLOADS`, without requeuing permanently failing `Ok(failed)` items). - Keep the `ID3D12Resource` handles for failed/skipped batch items alive across a single `TEXTURES` lock after the loop to restore `pending = true` (and increment `PENDING`) only on active `!pending && !gpu_written` entries, dropping the handles after releasing `TEXTURES` so COM release cannot re-enter the lock. Part of xcl-dev#2109 Assisted-by: Google Antigravity (Gemini 4 Neon)
Decodere
force-pushed
the
fix-2109-upload-all-abort-restore
branch
from
November 25, 2026 17:14
3a60f54 to
85d79bf
Compare
Contributor
Author
|
Rebased onto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 × 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 incrementPENDINGby the exact restored count) 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
origin/main50a9fdefto integrate #2306'svram::level_pages()->map_levels_with_texels(&r, &subs)call cleanly insideupload_all's batch submit closure.)Tested
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 test --release -p xcl --lib hle::d3d12x::title_textures::tests:: -- --test-threads=1 --nocaptureon85d79bf6atop50a9fdef): 22 passed, 0 failed, 0 ignored (0.93 s,0skipped — includes all existing GPU upload tests, D3D12.X: XCL_TEXTURE_LEVEL_PAGES=1 gives a sampled texture's levels their pages with their texels #2306'sa_placed_texture_gets_the_pages_of_a_level_with_its_texels, and all 3 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, andrestore_pending_requeues_only_active_non_pending_non_gpu_written_entries).cargo build --release --workspaceandcargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocaptureon Windows 11, Intel Core i5-11400F, NVIDIA GeForce RTX 4060 driver 621.14, DXC1.9.2609.5): 23 test binaries, 1291 passed, 1 failed, 46 ignored, where the sole failure isorigin/main50a9fdef's pre-existinggpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(left: 3, right: 1, failing onmainCI run45656870453after Recompiler: a bridged mask write in the split form meets no barrier #2074), plus 28 runtimeSKIPPEDlines (21no wave64on RTX 4060,3wave32 per-lane formrefusedby driver,2missingd3d12SDKLayers.dll/ D3D12 debug layer,1driver shader cache toggle unavailable,1no heap windows).Regression run
Baseline (
origin/main50a9fdef81cb796b8756a31defb0648301d002ce):PR head (
85d79bf639d42a0c7149c3efcadf6bb0cd3abb1a):Not tested
texture::upload_batchtimeout on live D3D12 hardware; failure-path batch abort,LAST_CONTENTinvalidation, andrestore_pendingstate transitions are covered by the new pure-CPU unit tests, while the happy path ran under the RTX 4060 GPU unit tests and 60 s smoke test above.#[ignore]tests did not execute on this machine.ID3D12Devicehardware scenarios live (covered by pure-CPU unit test).AI use
Implemented and verified with Google Antigravity (Gemini 4 Neon). All code changes, failing-first and post-fix unit tests, full workspace release tests, and paired 60 s RTX 4060 smoke runs were reviewed and executed locally.