D3D12.X: title texture uploads run on the submitting queue, without a CPU wait #455

Closed
github-bot wants to merge 1 commit from gh-pr/455/head into gh-pr/455/base
Owner

@⁠Cattn on GitHub · 2026-11-24 00:31 UTC · original
Cattn:title-texture-uploads-on-title-queue → main · +263 −54 · 2 files · 1 commits · closed without merging

Part of #248; related to #262 (the same direction for sparse uploads, see https://github.com/ivall/xcl/issues/262#issuecomment-7117784188).

title_textures::refresh runs on the title's thread before each of its submits. It uploaded the CPU's writes to kept-in-step textures on XCL's own queue, then waited on the CPU until the GPU had run them (texture::upload_batch → wait). While a retail title streams its world with video memory past the card, those waits are long:

  • thread dumps every 30 s show its submit thread blocked in title_textures::refresh → texture::upload_batch → texture::wait → gpu::fence::wait;
  • presents drop to 0–8 per 20 s;
  • the title's watchdog ends it on the loading screen.

When the submitting queue is a DIRECT queue on the texture's device, the upload list now runs on that queue, ahead of the title's lists. The GPU orders the copies before the work that samples them, without a cross-queue wait (the deadlock #262 describes for waiting on title queues). A fence on that queue retires each batch's allocator, list and staging buffers at later submits; with over 512 MB in flight the oldest batches are waited for. Compute and copy queues, and a queue of another device, keep the upload queue and its wait.

What is in it

  • gpu/texture.rs: submit_batch = upload_batch without the wait, returning what has to stay alive (InFlight). upload_batch is submit_batch + wait, unchanged for its callers.

  • hle/d3d12x/title_textures.rs:

    • upload_all takes the submitting queue;
    • title_queue_for picks it when it is DIRECT on the same device;
    • submit_on_title_queue signals a per-queue fence;
    • reclaim releases finished batches and waits over the cap.
  • A batch whose wait fails or times out stays in flight. New GPU test gpu_an_upload_still_running_is_kept_when_its_wait_times_out stalls the queue on a gate fence and checks that. It fails if the batch is released on a timeout.

  • New GPU test gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released:

    • two uploads, each read back on the same queue, give their bytes;
    • with the cap at 0 every batch is waited for and released;
    • compute queues and no queue are not used.

    read_r8 moves from the mirror test to the test module so both tests use it. The existing gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes calls refresh with a DIRECT queue, so it now runs through this path too and still reads the written bytes back.

Tested

  • At 4a514ae, cargo build --release -p xcl passed. cargo test -p xcl --lib title_textures -- --nocapture on the RTX 4070 passed 11 tests, with 0 failed, 0 ignored and 0 skipped.

  • RTX 4070 12 GB (driver 617.42), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 26200, rustc 1.93.1.

  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 at 90b45fb (rebased on main 7ebf1b8): 679 passed, 0 failed, 41 ignored, run alone on the GPU.

    • SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
    • A first run hung in four recompiler GPU tests while another cargo test used the same GPU. The rerun alone passed.
  • cargo test --release -p xcl --lib title_textures: 10 passed, with #486's test.

  • Retail title, world streaming (guarded runs, XCL_NETWORK=0, frame-event, activity and thread-dump logging): with this change the title got past its loading screen for the first time on this machine, twice. Without it, every run ended on the loading screen (the title's watchdog, or a free-RAM guard). Both runs used larger local stacks:

    • main 3516080 + this change;
    • main 3516080 + #335 + this change + #435.

    After loading the world draws black and the title stops, which is a separate problem.

Regression run

main:

xcl-smoke v1
commit: 3db536ebe231418d76e8d6e52ccee0b47330a522
gpu: NVIDIA GeForce RTX 4070
title: 2615684f
seconds: 60
exit: 0x0
frames shown: 1600 (PresentX 1600)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16488 MB

PR:

xcl-smoke v1
commit: 4a514ae75a00336d0b461a72bc9650bc9f9a4510
gpu: NVIDIA GeForce RTX 4070
title: 2615684f
seconds: 60
exit: 0x0
frames shown: 1629 (PresentX 1629)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14930 MB

An earlier 60-second run on the same PR head showed 1,436 frames and peaked at 21,806 MB, above the 125% limit against this baseline. It also recorded zero device removals and crashes. The cause of the run-to-run variance is unknown.

Not tested

  • AMD GPUs; titles that submit kept-in-step textures from COMPUTE or COPY queues (those keep the old path).
  • The world-streaming runs were not on plain main + this change alone.

AI use

  • Claude Code (Claude Opus 5.5): found the blocked thread in thread dumps, wrote the change, the test and this description. I ran the builds, tests, smoke runs and game runs above on the hardware named.
  • Codex (gpt-6.2-sol): resolved the rebase conflict, ran the focused tests and refreshed the regression runs.
**@⁠Cattn** on GitHub · 2026-11-24 00:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/455) `Cattn:title-texture-uploads-on-title-queue` → `main` · +263 −54 · 2 files · 1 commits · closed without merging Part of #248; related to #262 (the same direction for sparse uploads, see https://github.com/ivall/xcl/issues/262#issuecomment-7117784188). `title_textures::refresh` runs on the title's thread before each of its submits. It uploaded the CPU's writes to kept-in-step textures on XCL's own queue, then waited on the CPU until the GPU had run them (`texture::upload_batch` → `wait`). While a retail title streams its world with video memory past the card, those waits are long: - thread dumps every 30 s show its submit thread blocked in `title_textures::refresh` → `texture::upload_batch` → `texture::wait` → `gpu::fence::wait`; - presents drop to 0–8 per 20 s; - the title's watchdog ends it on the loading screen. When the submitting queue is a DIRECT queue on the texture's device, the upload list now runs on that queue, ahead of the title's lists. The GPU orders the copies before the work that samples them, without a cross-queue wait (the deadlock #262 describes for waiting on title queues). A fence on that queue retires each batch's allocator, list and staging buffers at later submits; with over 512 MB in flight the oldest batches are waited for. Compute and copy queues, and a queue of another device, keep the upload queue and its wait. **What is in it** - `gpu/texture.rs`: `submit_batch` = `upload_batch` without the wait, returning what has to stay alive (`InFlight`). `upload_batch` is `submit_batch` + `wait`, unchanged for its callers. - `hle/d3d12x/title_textures.rs`: - `upload_all` takes the submitting queue; - `title_queue_for` picks it when it is DIRECT on the same device; - `submit_on_title_queue` signals a per-queue fence; - `reclaim` releases finished batches and waits over the cap. - A batch whose wait fails or times out stays in flight. New GPU test `gpu_an_upload_still_running_is_kept_when_its_wait_times_out` stalls the queue on a gate fence and checks that. It fails if the batch is released on a timeout. - New GPU test `gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released`: - two uploads, each read back on the same queue, give their bytes; - with the cap at 0 every batch is waited for and released; - compute queues and no queue are not used. `read_r8` moves from the mirror test to the test module so both tests use it. The existing `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` calls `refresh` with a DIRECT queue, so it now runs through this path too and still reads the written bytes back. **Tested** - At `4a514ae`, `cargo build --release -p xcl` passed. `cargo test -p xcl --lib title_textures -- --nocapture` on the RTX 4070 passed 11 tests, with 0 failed, 0 ignored and 0 skipped. - RTX 4070 12 GB (driver 617.42), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 26200, rustc 1.93.1. - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` at `90b45fb` (rebased on main `7ebf1b8`): 679 passed, 0 failed, 41 ignored, run alone on the GPU. - SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - A first run hung in four recompiler GPU tests while another `cargo test` used the same GPU. The rerun alone passed. - `cargo test --release -p xcl --lib title_textures`: 10 passed, with #486's test. - Retail title, world streaming (guarded runs, `XCL_NETWORK=0`, frame-event, activity and thread-dump logging): with this change the title got past its loading screen for the first time on this machine, twice. Without it, every run ended on the loading screen (the title's watchdog, or a free-RAM guard). Both runs used larger local stacks: - main `3516080` + this change; - main `3516080` + #335 + this change + #435. After loading the world draws black and the title stops, which is a separate problem. **Regression run** main: ``` xcl-smoke v1 commit: 3db536ebe231418d76e8d6e52ccee0b47330a522 gpu: NVIDIA GeForce RTX 4070 title: 2615684f seconds: 60 exit: 0x0 frames shown: 1600 (PresentX 1600) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16488 MB ``` PR: ``` xcl-smoke v1 commit: 4a514ae75a00336d0b461a72bc9650bc9f9a4510 gpu: NVIDIA GeForce RTX 4070 title: 2615684f seconds: 60 exit: 0x0 frames shown: 1629 (PresentX 1629) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14930 MB ``` An earlier 60-second run on the same PR head showed 1,436 frames and peaked at 21,806 MB, above the 125% limit against this baseline. It also recorded zero device removals and crashes. The cause of the run-to-run variance is unknown. **Not tested** - AMD GPUs; titles that submit kept-in-step textures from COMPUTE or COPY queues (those keep the old path). - The world-streaming runs were not on plain main + this change alone. **AI use** - Claude Code (Claude Opus 5.5): found the blocked thread in thread dumps, wrote the change, the test and this description. I ran the builds, tests, smoke runs and game runs above on the hardware named. - Codex (gpt-6.2-sol): resolved the rebase conflict, ran the focused tests and refreshed the regression runs.
title_textures::refresh runs on the title's thread before each of its
submits and uploaded the CPU's writes to its textures on XCL's own queue,
then waited on the CPU until the GPU had run them (texture::upload_batch).
While a retail title streams its world with video memory past the card,
those waits are long: thread dumps show its submit thread blocked in
fence::wait under refresh, presents drop to a few per 20 s, and the title's
watchdog ends it on the loading screen.

When the submitting queue is a DIRECT queue on the texture's device, the
upload list now runs on that queue, ahead of the title's lists, so the GPU
orders the copies before the work that samples them, with no cross-queue
wait. A fence on that queue retires each batch's allocator, list and staging
buffers at later submits; over 512 MB in flight the oldest batches are waited
for, and a batch whose wait fails or times out stays in flight. Compute and
copy queues, and a queue of another device, keep the upload queue and its
wait. texture::submit_batch is upload_batch without the wait.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:22:22 +00:00
github-bot closed this pull request 2026-11-26 04:22:22 +00:00
Author
Owner

@⁠PHeitor1 on GitHub · 2026-11-24 00:44 UTC · original

Tested 07e6199 merged onto main 2997c9a.

RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*.

Pass: 677 passed, 0 failed, 41 ignored. SKIPPED: only the 2 no wave64 tests (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware). Build clean.

Run and written with Claude Code (Claude Opus 5.5).

**@⁠PHeitor1** on GitHub · 2026-11-24 00:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7118382543) Tested `07e6199` merged onto `main` `2997c9a`. RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug, `cargo test --workspace --no-fail-fast -- --test-threads=4`, no `XCL_SAMPLE_*`. **Pass:** 677 passed, 0 failed, 41 ignored. SKIPPED: only the 2 `no wave64` tests (`gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`). Build clean. _Run and written with Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠TheHoracio on GitHub · 2026-11-24 00:46 UTC · original

Test report on AMD RDNA3: RX 7800 XT (16 GB, wave32 and wave64), driver 32.0.32015.7029, Ryzen 7 9800X3D, Windows 11 Pro 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug build. No retail data was used. The PR's own runs are all on NVIDIA, so this adds an AMD GPU with 64-lane waves.

Tested: the PR head 07e6199 as it is (on its base a6f5f7a).

  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 677 passed, 0 failed, 41 ignored, no SKIPPED tests (the two no wave64 tests run here).
  • The new gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released passes. Nothing hung; the run was alone on the GPU.

Not tested: a regression run on a title, a release build, the head merged onto current main.

AI use: Claude Code ran the commands and drafted this comment; the runs are real runs on the hardware above.

**@⁠TheHoracio** on GitHub · 2026-11-24 00:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7118412292) Test report on **AMD RDNA3**: RX 7800 XT (16 GB, wave32 and wave64), driver 32.0.32015.7029, Ryzen 7 9800X3D, Windows 11 Pro 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug build. No retail data was used. The PR's own runs are all on NVIDIA, so this adds an AMD GPU with 64-lane waves. **Tested:** the PR head `07e6199` as it is (on its base `a6f5f7a`). - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4`: **677 passed, 0 failed, 41 ignored**, no SKIPPED tests (the two `no wave64` tests run here). - The new `gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released` passes. Nothing hung; the run was alone on the GPU. **Not tested:** a regression run on a title, a release build, the head merged onto current `main`. AI use: Claude Code ran the commands and drafted this comment; the runs are real runs on the hardware above.
Author
Owner

@⁠grahamster2 on GitHub · 2026-11-24 01:10 UTC · original

Tested on an RTX 3080 against main and the two other PRs for the same fix (#451, #465). On this machine #455 ended in a device removal (DEVICE_HUNG) in 2 of 3 runs, about 11–14 s in. The run that completed played the intro video at the same ~4.7 fps as main, and world streaming started at 134 s instead of 140 s.

Setup: RTX 3080 10 GB, driver 610.88, 32 GB RAM with ~15–17 GB used by other programs. Release builds of main 2997c9a (code-identical to a6f5f7a) and of #451 2cefc88, #455 07e6199 and #465 1152852. Each PR was tested on its own. The retail title ran 180 s per run with XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PRESS_A_AT=14,17,21 on a warm cache. Numbers are from the activity (2 s) lines; the earlier patch test on db1ddb2 is here.

main #451 #455 #465
Runs 2 2 3 (2 ended in a device removal) 2
Intro video, presents per 2 s 8–10 (≈4.5 fps) 37–43 (≈20 fps) 8–11 (≈4.7 fps) 8–10 (≈4.5 fps)
Intro video, start → end 20 → 119 / 121 s 20 → 41 / 41 s 20 → 113 s 20 → 118 / 117 s
World streaming starts 140 / 140 s 60 / 60 s 134 s 138 / 136 s
Max presents per 2 s after that 35 / 35 45 / 58 47 55 / 48
Commit at the end 23.7 / 24.0 GB 24.5 / 24.4 GB 24.1 GB 24.5 / 25.1 GB
  • Every completed run was stopped by my watchdog (it kills XCL when free RAM falls below 1.5 GB). That happened 15–25 s after world streaming started, at about 24 GB commit, in every build. It's this machine's RAM limit, so the "after that" row covers only those seconds.
  • #455: 2 of 3 runs ended in a device removal. The removal was 0x887a0006 (DEVICE_HUNG), at 13.5 s and 11.0 s, before the intro video. The log line is D3D12 device removed: 0x887a0006 … – the title is stopped, and then the process ends with status 0x887a0006. main and the other PRs had no removals in their runs.
  • smoke.ps1, 60 s: it presses nothing, so every build stays on the menu, and all four look the same there.
smoke commit frames shown last 3 removals crashes peak commit
main 2997c9a 1532 60 60 60 0 0 14613 MB
#451 2cefc88 1590 60 61 60 0 0 14723 MB
#455 07e6199 1518 61 60 59 0 0 14589 MB
#465 1152852 1528 60 59 61 0 0 14663 MB

All smoke runs reported exit: 0x0 and gpu: NVIDIA GeForce RTX 3080. I left the title line out of the table.

Not tested:

  • Picture correctness: I can't see the screen.
  • Anything past ~20 s of world streaming, because of the RAM limit.
  • Combinations of the PRs.

The same numbers are posted on the other PRs: #451, #465.

Test runs and this report: Claude Code (Claude Opus 5.5).

**@⁠grahamster2** on GitHub · 2026-11-24 01:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7118837037) Tested on an RTX 3080 against `main` and the two other PRs for the same fix (#451, #465). **On this machine #455 ended in a device removal (DEVICE_HUNG) in 2 of 3 runs, about 11–14 s in.** The run that completed played the intro video at the same ~4.7 fps as `main`, and world streaming started at 134 s instead of 140 s. **Setup:** RTX 3080 10 GB, driver 610.88, 32 GB RAM with ~15–17 GB used by other programs. Release builds of `main` 2997c9a (code-identical to a6f5f7a) and of #451 2cefc88, #455 07e6199 and #465 1152852. Each PR was tested on its own. The retail title ran 180 s per run with `XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PRESS_A_AT=14,17,21` on a warm cache. Numbers are from the `activity (2 s)` lines; the earlier patch test on db1ddb2 is [here](https://github.com/ivall/xcl/pull/283#issuecomment-7118348035). | | main | #451 | #455 | #465 | |---|---|---|---|---| | Runs | 2 | 2 | 3 (2 ended in a device removal) | 2 | | Intro video, presents per 2 s | 8–10 (≈4.5 fps) | **37–43 (≈20 fps)** | 8–11 (≈4.7 fps) | 8–10 (≈4.5 fps) | | Intro video, start → end | 20 → 119 / 121 s | 20 → 41 / 41 s | 20 → 113 s | 20 → 118 / 117 s | | World streaming starts | 140 / 140 s | 60 / 60 s | 134 s | 138 / 136 s | | Max presents per 2 s after that | 35 / 35 | 45 / 58 | 47 | 55 / 48 | | Commit at the end | 23.7 / 24.0 GB | 24.5 / 24.4 GB | 24.1 GB | 24.5 / 25.1 GB | - **Every completed run was stopped by my watchdog** (it kills XCL when free RAM falls below 1.5 GB). That happened 15–25 s after world streaming started, at about 24 GB commit, in every build. It's this machine's RAM limit, so the "after that" row covers only those seconds. - **#455: 2 of 3 runs ended in a device removal.** The removal was `0x887a0006` (DEVICE_HUNG), at 13.5 s and 11.0 s, before the intro video. The log line is `D3D12 device removed: 0x887a0006 … – the title is stopped`, and then the process ends with status 0x887a0006. `main` and the other PRs had no removals in their runs. - `smoke.ps1`, 60 s: it presses nothing, so every build stays on the menu, and all four look the same there. | smoke | commit | frames shown | last 3 | removals | crashes | peak commit | |---|---|---|---|---|---|---| | main | 2997c9a | 1532 | 60 60 60 | 0 | 0 | 14613 MB | | #451 | 2cefc88 | 1590 | 60 61 60 | 0 | 0 | 14723 MB | | #455 | 07e6199 | 1518 | 61 60 59 | 0 | 0 | 14589 MB | | #465 | 1152852 | 1528 | 60 59 61 | 0 | 0 | 14663 MB | All smoke runs reported `exit: 0x0` and `gpu: NVIDIA GeForce RTX 3080`. I left the title line out of the table. **Not tested:** - Picture correctness: I can't see the screen. - Anything past ~20 s of world streaming, because of the RAM limit. - Combinations of the PRs. The same numbers are posted on the other PRs: [#451](https://github.com/ivall/xcl/pull/451#issuecomment-7118836420), [#465](https://github.com/ivall/xcl/pull/465#issuecomment-7118837330). Test runs and this report: Claude Code (Claude Opus 5.5).
Author
Owner

@⁠ryosen0 on GitHub · 2026-11-24 01:15 UTC · original

Long-run data point on RTX 3060 Ti 8 GB (Ryzen 7 9800X3D, driver 32.0.16.1742, Windows 11): with this PR's direction plus the rest of the texture-upload work, a retail run survives its old crash point and reaches world streaming with the frame rate intact.

Build: main 2997c9a + #440 + this PR (#455) + #435, plus theaustinayers' build-10 fork commits (threaded detile of large levels, skip-unchanged texture uploads, 1 ms timer) merged locally; release, XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=600.

Result: clean exit at the 600 s timer, 16434 frames. On this machine a 600 s run on the older stack died at ~395 s with 0xc0000005 during world loading (~26.6 GB commit). This run held 60 presents / 2 s from t≈26 s through t≈470 s - no intro dip at all (it used to be 4-8 fps for two minutes) - then streamed the world: a brief 20 presents / 2 s stretch around t≈480 s, back to 60, and at t≈598 s: 24.9 GB commit, 12.5 GB local + 4.6 GB non-local video on the 8 GB card, no device removal, no crash.

Not attributing the whole effect to this PR alone - it is the combined stack - but the CPU-wait removal is the piece that matches gw1337x's profiling in #283 (submit-thread stalls in texture::wait), and the run confirms the direction holds on a small-VRAM NVIDIA card for 10 minutes, not just 60 s.

Not tested: this PR in isolation on the retail title; no visual assessment (unattended run).

AI use: GPT-6.2 Astra (API model selector) in DSH ran the build and the run and wrote this comment; the human contributor reviewed it.

**@⁠ryosen0** on GitHub · 2026-11-24 01:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7118926857) Long-run data point on RTX 3060 Ti 8 GB (Ryzen 7 9800X3D, driver 32.0.16.1742, Windows 11): with this PR's direction plus the rest of the texture-upload work, a retail run survives its old crash point and reaches world streaming with the frame rate intact. **Build:** main `2997c9a` + #440 + this PR (#455) + #435, plus theaustinayers' build-10 fork commits (threaded detile of large levels, skip-unchanged texture uploads, 1 ms timer) merged locally; release, `XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=600`. **Result:** clean exit at the 600 s timer, **16434 frames**. On this machine a 600 s run on the older stack died at ~395 s with 0xc0000005 during world loading (~26.6 GB commit). This run held 60 presents / 2 s from t≈26 s through t≈470 s - no intro dip at all (it used to be 4-8 fps for two minutes) - then streamed the world: a brief 20 presents / 2 s stretch around t≈480 s, back to 60, and at t≈598 s: 24.9 GB commit, 12.5 GB local + 4.6 GB non-local video on the 8 GB card, no device removal, no crash. Not attributing the whole effect to this PR alone - it is the combined stack - but the CPU-wait removal is the piece that matches gw1337x's profiling in #283 (submit-thread stalls in `texture::wait`), and the run confirms the direction holds on a small-VRAM NVIDIA card for 10 minutes, not just 60 s. **Not tested:** this PR in isolation on the retail title; no visual assessment (unattended run). AI use: GPT-6.2 Astra (API model selector) in DSH ran the build and the run and wrote this comment; the human contributor reviewed it.
Author
Owner

@⁠Alpha325 on GitHub · 2026-11-24 01:20 UTC · original

Independent AMD RDNA4 check on clean PR head 90b45fb83ff7eace999dc2f01d02d2369fa73258.

Tested on Radeon RX 9060 XT (driver 32.0.32029.2010), Windows 11 build 26200.9974, Rust 1.100.0 MSVC x64, release. Synthetic fixtures only.

cargo test --offline --locked --release -j 4 -p xcl --lib title_textures::tests -- --test-threads=1 --nocapture

10 passed, 0 failed, 0 ignored, no skips. XCL confirmed it used the hardware D3D12 backend. The same-queue readbacks matched the uploaded bytes. The timeout test kept the blocked upload in flight, then retired it after the fence was signaled and verified the texture contents. The existing CPU-write and remap test also passed.

The three focused GPU tests passed again on a separate run. The D3D12 debug layer was unavailable, so this run adds no debug-layer coverage. Full workspace tests and performance were outside this check.

AI use: OpenAI Codex (GPT-6.2 Sol) ran the tests and drafted this report.

**@⁠Alpha325** on GitHub · 2026-11-24 01:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7118998141) Independent AMD RDNA4 check on clean PR head `90b45fb83ff7eace999dc2f01d02d2369fa73258`. **Tested** on Radeon RX 9060 XT (driver `32.0.32029.2010`), Windows 11 build `26200.9974`, Rust 1.100.0 MSVC x64, release. Synthetic fixtures only. `cargo test --offline --locked --release -j 4 -p xcl --lib title_textures::tests -- --test-threads=1 --nocapture` **10 passed, 0 failed, 0 ignored, no skips.** XCL confirmed it used the hardware D3D12 backend. The same-queue readbacks matched the uploaded bytes. The timeout test kept the blocked upload in flight, then retired it after the fence was signaled and verified the texture contents. The existing CPU-write and remap test also passed. The three focused GPU tests passed again on a separate run. The D3D12 debug layer was unavailable, so this run adds no debug-layer coverage. Full workspace tests and performance were outside this check. **AI use:** OpenAI Codex (GPT-6.2 Sol) ran the tests and drafted this report.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-24 00:37 UTC · original · edited 2026-11-24 03:18 UTC

Error 921 localized on main

On 63cdc25, the serial texture suite stopped in placed_title_textures_share_vram_and_preserve_pixels. The single test reproduced the error after I initialized the debug layer explicitly. Naming its resources identified the reused texture in the overlap case. Fixture release site

A wait before the grouped release was insufficient. Releasing one alias can reactivate another and queue more mapping work. In a scratch change limited to the fixture, I waited for the mapping fence via vram::before_execute and texture::wait before releasing each placed resource individually. The full texture suite then passed 10/10 in each of three fresh processes, with no skips or D3D12 errors. This verifies the fixture change on main; runtime resource lifetime under #455 remains a separate question.

RTX 3080 Ti / 621.35, Windows 11 build 26300, Rust 1.99.1 MSVC, debug. cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --nocapture --test-threads=1. Synthetic input only. Codex with GPT-6.2 Sol instrumented the fixture, ran the tests, and drafted the update.

Current-baseline retest

With D3D12 validation enabled, the serial title-texture suite stopped with error 921 on both main at dd2ae9a and a scratch integration of 4a514ae onto that same revision. The debug layer reported a resource reaching final release while a queue still referenced it. This confirms the diagnostic from my earlier report also occurs on current main.

On the integrated tree, the stock queue-ordering and timeout-retention tests each passed in a fresh process with no reported validation errors or skips. The existing mirror-upload and placed-texture GPU readback tests also passed individually on both trees. These runs leave the resource involved in the suite failure unidentified.

RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, debug. cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --nocapture --test-threads=1, then the individual test filters. Retail behavior remains untested. Codex with GPT-6.2 Sol ran the tests and drafted this update.

Results on earlier revisions

Tested

Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), Rust 1.99.1 MSVC, debug. The run confirmed XCL selected the real RTX 3080 Ti backend. Commit 07e6199d

cargo test --locked -p xcl --lib title_textures::tests -- --test-threads=1 --nocapture: 8 passed, 0 failed, 0 ignored, zero reported skips. The new queue test checked three 64×64 readbacks, confirmed that subsequent work on the direct queue saw the uploaded bytes, and verified that waiting at a zero staging cap retired all three uploads.

Not tested

Full workspace suite, AMD, retail titles, and frame-rate impact.

AI use

Codex with GPT-6.2 Sol ran the tests and drafted this report.

Retest at 90b45fb

The focused title-texture suite passed on the same RTX 3080 Ti setup, with 10 passed, 0 failed, 0 ignored and no reported skips. This includes the current head’s queue-ordering and timeout-retention tests. I selected the hardware with XCL_ADAPTER=3080 Ti, set XCL_REQUIRE_GPU=1, and ran cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --test-threads=1 --nocapture. Tested revision

I tested the PR head in isolation. After the #451 merge, Git reports a conflict in crates/xcl/src/gpu/texture.rs against main at 9ce2070. The combined upload path and retail behavior remain untested here.

Codex with GPT-6.2 Sol ran the retest and drafted this update.

D3D12 debug-layer follow-up at 90b45fb

With Windows Graphics Tools installed, XCL confirmed the debug layer was active on the RTX 3080 Ti. The queue-ordering and timeout-retention tests both reported pass. The overall synthetic title-texture suite did not complete successfully. The debug callback reported message 921, a resource reaching final release while a queue still referenced it. This was a separate run from the earlier 10/10 result with validation off. I did not identify which resource was released.

One ownership check before rebasing: InFlight holds the allocator, command list, and staging resources, but the submitted copies also reference destination textures from the caller’s batch. Could the in-flight batch retain the destinations of successfully recorded copies through the same completion fence? This is a source-level follow-up, not an attribution of the diagnostic. In-flight batch and recording loop

Windows 11 build 26300, driver 621.35, Rust 1.99.1 MSVC, debug. Retail behavior and integration with latest main were outside this run. Codex with GPT-6.2 Sol ran the diagnostic pass, reviewed resource ownership, and drafted this update.

**@⁠thehollowedone** on GitHub · 2026-11-24 00:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7118271070) · edited 2026-11-24 03:18 UTC **Error 921 localized on main** On [`63cdc25`](https://github.com/ivall/xcl/commit/63cdc25bc0d2b59cc2af85e6e23f619dfaf72866), the serial texture suite stopped in `placed_title_textures_share_vram_and_preserve_pixels`. The single test reproduced the error after I initialized the debug layer explicitly. Naming its resources identified the `reused` texture in the overlap case. [Fixture release site](https://github.com/ivall/xcl/blob/63cdc25bc0d2b59cc2af85e6e23f619dfaf72866/crates/xcl/src/hle/d3d12x/title_textures.rs#L1770-L1777) A wait before the grouped release was insufficient. Releasing one alias can reactivate another and queue more mapping work. In a scratch change limited to the fixture, I waited for the mapping fence via `vram::before_execute` and `texture::wait` before releasing each placed resource individually. The full texture suite then passed **10/10 in each of three fresh processes**, with no skips or D3D12 errors. This verifies the fixture change on main; runtime resource lifetime under #455 remains a separate question. RTX 3080 Ti / 621.35, Windows 11 build 26300, Rust 1.99.1 MSVC, debug. `cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --nocapture --test-threads=1`. Synthetic input only. Codex with GPT-6.2 Sol instrumented the fixture, ran the tests, and drafted the update. **Current-baseline retest** With D3D12 validation enabled, the serial title-texture suite stopped with error 921 on both [`main` at `dd2ae9a`](https://github.com/ivall/xcl/commit/dd2ae9a70af5eb5aad60f02d86e386b72abe1e95) and a scratch integration of [`4a514ae`](https://github.com/ivall/xcl/commit/4a514ae75a00336d0b461a72bc9650bc9f9a4510) onto that same revision. The debug layer reported a resource reaching final release while a queue still referenced it. This confirms the diagnostic from my earlier report also occurs on current main. On the integrated tree, the stock queue-ordering and timeout-retention tests each passed in a fresh process with no reported validation errors or skips. The existing mirror-upload and placed-texture GPU readback tests also passed individually on both trees. These runs leave the resource involved in the suite failure unidentified. RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, debug. `cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --nocapture --test-threads=1`, then the individual test filters. Retail behavior remains untested. Codex with GPT-6.2 Sol ran the tests and drafted this update. <details> <summary>Results on earlier revisions</summary> **Tested** Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), Rust 1.99.1 MSVC, debug. The run confirmed XCL selected the real RTX 3080 Ti backend. [Commit 07e6199d](https://github.com/ivall/xcl/pull/455/commits/07e6199d28283e9208f39364c0e6573a36c629ff) `cargo test --locked -p xcl --lib title_textures::tests -- --test-threads=1 --nocapture`: 8 passed, 0 failed, 0 ignored, zero reported skips. The new queue test checked three 64×64 readbacks, confirmed that subsequent work on the direct queue saw the uploaded bytes, and verified that waiting at a zero staging cap retired all three uploads. **Not tested** Full workspace suite, AMD, retail titles, and frame-rate impact. **AI use** Codex with GPT-6.2 Sol ran the tests and drafted this report. **Retest at 90b45fb** The focused title-texture suite passed on the same RTX 3080 Ti setup, with 10 passed, 0 failed, 0 ignored and no reported skips. This includes the current head’s queue-ordering and timeout-retention tests. I selected the hardware with `XCL_ADAPTER=3080 Ti`, set `XCL_REQUIRE_GPU=1`, and ran `cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --test-threads=1 --nocapture`. [Tested revision](https://github.com/ivall/xcl/commit/90b45fb83ff7eace999dc2f01d02d2369fa73258) I tested the PR head in isolation. After the #451 merge, Git reports a conflict in `crates/xcl/src/gpu/texture.rs` against [main at 9ce2070](https://github.com/ivall/xcl/commit/9ce2070eccf436d7bd38601c90407da447df34f3). The combined upload path and retail behavior remain untested here. Codex with GPT-6.2 Sol ran the retest and drafted this update. **D3D12 debug-layer follow-up at 90b45fb** With Windows Graphics Tools installed, XCL confirmed the debug layer was active on the RTX 3080 Ti. The queue-ordering and timeout-retention tests both reported pass. The overall synthetic title-texture suite did not complete successfully. The debug callback reported message 921, a resource reaching final release while a queue still referenced it. This was a separate run from the earlier 10/10 result with validation off. I did not identify which resource was released. One ownership check before rebasing: `InFlight` holds the allocator, command list, and staging resources, but the submitted copies also reference destination textures from the caller’s batch. Could the in-flight batch retain the destinations of successfully recorded copies through the same completion fence? This is a source-level follow-up, not an attribution of the diagnostic. [In-flight batch and recording loop](https://github.com/ivall/xcl/blob/90b45fb83ff7eace999dc2f01d02d2369fa73258/crates/xcl/src/gpu/texture.rs#L217-L240) Windows 11 build 26300, driver 621.35, Rust 1.99.1 MSVC, debug. Retail behavior and integration with latest main were outside this run. Codex with GPT-6.2 Sol ran the diagnostic pass, reviewed resource ownership, and drafted this update. </details>
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 04:24 UTC · original

Lifetime question at head 4a514ae75a (code read, not built).

texture::InFlight (crates/xcl/src/gpu/texture.rs) keeps _alloc, _list and _staging alive until the queue passes the fence, but not the destination textures the list copies into. XCL's only strong references to them are the ID3D12Resource clones in the batch passed to submit_batch, which are dropped when submit_on_title_queue returns. TEXTURES holds raw addresses. On main those clones lived across the CPU wait, so it didn't matter.

Scenario: a texture kept in step is uploaded at the next DIRECT submit, and the title makes its final Release before the title queue reaches that upload list. res_release (real.rs:1547) passes the release straight through, so the resource is destroyed under a submitted list. That's D3D12 error 921, the same kind @⁠thehollowedone localized above in placed_title_textures_share_vram_and_preserve_pixels. The window is the queue's backlog, which is longest in the streaming case this PR is for. upload_batch's comment in the same file already notes that "freeing them under the GPU removed the device".

Possible fix: keep the batch's ID3D12Resource clones in InFlight and release them when it's retired. Watch the lock order, since their final Release re-enters forget under ON_QUEUE/REFRESH.

I haven't shown that a title actually releases this early. This is from reading the code.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-24 04:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7121983305) Lifetime question at head `4a514ae75a` (code read, not built). `texture::InFlight` (`crates/xcl/src/gpu/texture.rs`) keeps `_alloc`, `_list` and `_staging` alive until the queue passes the fence, but not the **destination textures** the list copies into. XCL's only strong references to them are the `ID3D12Resource` clones in the `batch` passed to `submit_batch`, which are dropped when `submit_on_title_queue` returns. `TEXTURES` holds raw addresses. On `main` those clones lived across the CPU wait, so it didn't matter. **Scenario:** a texture kept in step is uploaded at the next DIRECT submit, and the title makes its final `Release` before the title queue reaches that upload list. `res_release` (`real.rs:1547`) passes the release straight through, so the resource is destroyed under a submitted list. That's D3D12 error 921, the same kind @⁠thehollowedone localized above in `placed_title_textures_share_vram_and_preserve_pixels`. The window is the queue's backlog, which is longest in the streaming case this PR is for. `upload_batch`'s comment in the same file already notes that "freeing them under the GPU removed the device". **Possible fix:** keep the batch's `ID3D12Resource` clones in `InFlight` and release them when it's retired. Watch the lock order, since their final `Release` re-enters `forget` under `ON_QUEUE`/`REFRESH`. I haven't shown that a title actually releases this early. This is from reading the code. AI-assisted (Claude Code).
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 05:05 UTC · original

Independent NVIDIA RTX 5080 build/test run and code review at head 4a514ae75a00336d0b461a72bc9650bc9f9a4510.

Code Review Findings (in addition to @⁠upipibi's destination-resource lifetime catch)

  1. Missing vram::before_execute(&tq) before uploading on the title queue (crates/xcl/src/hle/d3d12x/title_textures.rs, submit_on_title_queue + real.rs, q_execute_command_lists):
    • q_execute_command_lists calls title_textures::refresh(this) before vram::before_execute is called on the title's direct queue.
    • Inside refresh(), the fallback upload_queue path calls super::vram::before_execute(upload_queue) before submitting the upload list, whereas submit_on_title_queue(dev, &tq, &batch) submits the upload command list directly on tq without waiting on vram's mapping fence first.
    • For placed/reserved textures whose UpdateTileMappings work is still pending on XCL's mapping queue, the upload CopyTextureRegion on tq can race ahead of tile mapping completion. Adding super::vram::before_execute(&tq); at the start of submit_on_title_queue (before submit_batch) closes that gap.
  2. Minor (ON_QUEUE key lifetime): ON_QUEUE is keyed by queue.as_raw() as usize without an eviction hook on queue release (q_release). If a title destroys a direct queue and creates a new one on a different device at the same address, ON_QUEUE could inspect an entry from the old device's fence. Removing the entry in q_release (or retiring/cleaning up on drop) avoids address-reuse hazards.

Tested

  • Environment: NVIDIA GeForce RTX 5080 (16 GB, driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09), debug build.
  • Command: cargo build --workspace && cargo test --workspace -- --test-threads=4
  • Result: 688 passed, 0 failed, 41 ignored (0 new warnings).
  • PR-specific tests (all ok):
    • hle::d3d12x::title_textures::tests::gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released
    • hle::d3d12x::title_textures::tests::gpu_an_upload_still_running_is_kept_when_its_wait_times_out
    • Plus 9/9 existing hle::d3d12x::title_textures::tests::* tests.
  • SKIPPED (4):
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64)
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)
    • test_title_draws_with_a_root_signature_under_the_debug_layer (no d3d12SDKLayers.dll)
    • uploads_start_from_each_subresources_state (no D3D12 debug layer (0x887A002D))

Not tested

  • D3D12 debug layer (d3d12SDKLayers.dll not installed on this host), AMD/wave64 hardware, and retail titles.

AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.

**@⁠mastrr9** on GitHub · 2026-11-24 05:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7122620288) Independent NVIDIA RTX 5080 build/test run and code review at head `4a514ae75a00336d0b461a72bc9650bc9f9a4510`. ### Code Review Findings (in addition to @⁠upipibi's destination-resource lifetime catch) 1. **Missing `vram::before_execute(&tq)` before uploading on the title queue** (`crates/xcl/src/hle/d3d12x/title_textures.rs`, `submit_on_title_queue` + `real.rs`, `q_execute_command_lists`): - `q_execute_command_lists` calls `title_textures::refresh(this)` *before* `vram::before_execute` is called on the title's direct queue. - Inside `refresh()`, the fallback `upload_queue` path calls `super::vram::before_execute(upload_queue)` before submitting the upload list, whereas `submit_on_title_queue(dev, &tq, &batch)` submits the upload command list directly on `tq` without waiting on `vram`'s mapping fence first. - For placed/reserved textures whose `UpdateTileMappings` work is still pending on XCL's mapping queue, the upload `CopyTextureRegion` on `tq` can race ahead of tile mapping completion. Adding `super::vram::before_execute(&tq);` at the start of `submit_on_title_queue` (before `submit_batch`) closes that gap. 2. **Minor (`ON_QUEUE` key lifetime):** `ON_QUEUE` is keyed by `queue.as_raw() as usize` without an eviction hook on queue release (`q_release`). If a title destroys a direct queue and creates a new one on a different device at the same address, `ON_QUEUE` could inspect an entry from the old device's fence. Removing the entry in `q_release` (or retiring/cleaning up on drop) avoids address-reuse hazards. ### Tested - **Environment:** NVIDIA GeForce RTX 5080 (16 GB, driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug build. - **Command:** `cargo build --workspace && cargo test --workspace -- --test-threads=4` - **Result:** **688 passed, 0 failed, 41 ignored** (0 new warnings). - **PR-specific tests (all `ok`):** - `hle::d3d12x::title_textures::tests::gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released` - `hle::d3d12x::title_textures::tests::gpu_an_upload_still_running_is_kept_when_its_wait_times_out` - Plus 9/9 existing `hle::d3d12x::title_textures::tests::*` tests. - **SKIPPED (4):** - `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` (`no wave64`) - `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` (`no wave64`) - `test_title_draws_with_a_root_signature_under_the_debug_layer` (`no d3d12SDKLayers.dll`) - `uploads_start_from_each_subresources_state` (`no D3D12 debug layer (0x887A002D)`) ### Not tested - D3D12 debug layer (`d3d12SDKLayers.dll` not installed on this host), AMD/wave64 hardware, and retail titles. **AI use:** Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.
Author
Owner

@⁠iggyvilla on GitHub · 2026-11-24 07:34 UTC · original

Code read of 4a514ae; nothing built or run. The before_execute gap and the ON_QUEUE lifetime are already in @⁠ethandepstein-del's comment, the destination-resource lifetime in @⁠upipibi's. Not yet mentioned:

  1. A failed wait drops the in-flight batch. title_textures.rs:859-860 and :869-870: texture::wait(dev, queue)? returns early on error, including its 10 s timeout, and the batch f (InFlight: allocator, list, staging) is dropped while the GPU may still run the copy. upload_batch does the opposite for this case (gpu/texture.rs:284-289, mem::forget: "freeing them under the GPU removed the device"). Keep f alive on those paths. They are rare (CreateFence/Signal failing), but they are the paths where the device is already in trouble.
  2. submit_batch makes new objects per batch. It calls CreateCommandAllocator, CreateCommandList and CreateCommittedResource (UPLOAD) each time (gpu/texture.rs:324-328), where upload_batch reuses the Uploader, whose comment (:204-208) says per-batch creation cost 200–650 ms per call under streaming. The PR may still win overall; a submit-thread time under streaming, before and after, would show it. Note also the doc comment above upload_all ("one list and one wait each") is now stale.

When this is stacked under #640/#782, refresh_once remaps evicted textures after its vram::before_execute(q) (:735), so the missing wait in submit_on_title_queue matters for that combination too.

AI use: Claude Code, Claude Sonnet 5.5, read the code at the head above and drafted this; a person checked it before posting.

**@⁠iggyvilla** on GitHub · 2026-11-24 07:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7125135086) Code read of `4a514ae`; nothing built or run. The `before_execute` gap and the `ON_QUEUE` lifetime are already in @⁠ethandepstein-del's comment, the destination-resource lifetime in @⁠upipibi's. Not yet mentioned: 1. **A failed wait drops the in-flight batch.** `title_textures.rs:859-860` and `:869-870`: `texture::wait(dev, queue)?` returns early on error, including its 10 s timeout, and the batch `f` (`InFlight`: allocator, list, staging) is dropped while the GPU may still run the copy. `upload_batch` does the opposite for this case (`gpu/texture.rs:284-289`, `mem::forget`: "freeing them under the GPU removed the device"). Keep `f` alive on those paths. They are rare (CreateFence/Signal failing), but they are the paths where the device is already in trouble. 2. **`submit_batch` makes new objects per batch.** It calls `CreateCommandAllocator`, `CreateCommandList` and `CreateCommittedResource` (UPLOAD) each time (`gpu/texture.rs:324-328`), where `upload_batch` reuses the `Uploader`, whose comment (`:204-208`) says per-batch creation cost 200–650 ms per call under streaming. The PR may still win overall; a submit-thread time under streaming, before and after, would show it. Note also the doc comment above `upload_all` ("one list and one wait each") is now stale. When this is stacked under #640/#782, `refresh_once` remaps evicted textures after its `vram::before_execute(q)` (`:735`), so the missing wait in `submit_on_title_queue` matters for that combination too. AI use: Claude Code, Claude Sonnet 5.5, read the code at the head above and drafted this; a person checked it before posting.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-24 10:40 UTC · original

Holding off on merge until the three open review issues are resolved: (1) retaining destination ID3D12Resources in InFlight until GPU completion, (2) calling vram::before_execute before executing the upload, and (3) avoiding dropping InFlight on a failed wait — all likely contributors to the reported RTX 3080 DEVICE_HUNG.

**@⁠raylitebull** on GitHub · 2026-11-24 10:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7129104358) Holding off on merge until the three open review issues are resolved: (1) retaining destination `ID3D12Resource`s in `InFlight` until GPU completion, (2) calling `vram::before_execute` before executing the upload, and (3) avoiding dropping `InFlight` on a failed wait — all likely contributors to the reported RTX 3080 `DEVICE_HUNG`.
Author
Owner

@⁠Krashgamer on GitHub · 2026-11-24 22:00 UTC · original

Measurement at 4a514ae (merged onto main c4d37be with #742, #1791, #1765, #1055; conflict in refresh_once resolved by hand), RTX 3080 10 GB, i7-10700K, retail title, world load, with local timers around title_textures::refresh and its parts. On this machine the CPU wait is not where the refresh time goes. With this PR the slow refreshes take about as long, because the CPU work before the submit dominates.

Time in refresh calls of 50 ms or more, first 150 s:

without (2 runs) with 4a514ae (4 runs)
total 7.6 s, 8.2 s 2.6 s, 8.4 s, 9.9 s, 8.4 s
longest 1.8 s, 1.8 s 0.2 s, 2.6 s, 2.3 s, 2.5 s

Where the time goes inside the uploads with this PR, in the longest refreshes (2 runs, every upload went to the title queue):

  • 1,363 textures / 1.5 GB: hash 579 ms, subresources_of_all 1,001 ms, submit_on_title_queue 606 ms.
  • 1,976 textures / 2.4 GB: hash 761 ms, subresources_of_all 519 ms, submit_on_title_queue 991 ms.
  • Only 9 to 20 textures per refresh were skipped as unchanged, so during the world load the hash mostly costs time: most of these are first uploads.

The write-watch look, the range rebuild, and sparse / vram::before_execute together stay under 30 ms in these refreshes.

So for the world-load stall on this card, the detile (#1512 / #1513) and the hash are the larger parts; this PR's change alone did not shorten it. No device removal in these 4 runs (grahamster2 saw two on an RTX 3080 at an earlier head).

Not tested: the review fixes asked for above; main + this PR alone.

AI use: Claude Code (Claude Opus 5.5) ran the runs, added the local timers and wrote this.

**@⁠Krashgamer** on GitHub · 2026-11-24 22:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7145674383) Measurement at `4a514ae` (merged onto `main` `c4d37be` with #742, #1791, #1765, #1055; conflict in `refresh_once` resolved by hand), RTX 3080 10 GB, i7-10700K, retail title, world load, with local timers around `title_textures::refresh` and its parts. **On this machine the CPU wait is not where the refresh time goes. With this PR the slow refreshes take about as long, because the CPU work before the submit dominates.** Time in `refresh` calls of 50 ms or more, first 150 s: | | without (2 runs) | with `4a514ae` (4 runs) | |---|---|---| | total | 7.6 s, 8.2 s | 2.6 s, 8.4 s, 9.9 s, 8.4 s | | longest | 1.8 s, 1.8 s | 0.2 s, 2.6 s, 2.3 s, 2.5 s | Where the time goes inside the uploads with this PR, in the longest refreshes (2 runs, every upload went to the title queue): - 1,363 textures / 1.5 GB: hash 579 ms, `subresources_of_all` 1,001 ms, `submit_on_title_queue` 606 ms. - 1,976 textures / 2.4 GB: hash 761 ms, `subresources_of_all` 519 ms, `submit_on_title_queue` 991 ms. - Only 9 to 20 textures per refresh were skipped as unchanged, so during the world load the hash mostly costs time: most of these are first uploads. The write-watch look, the range rebuild, and `sparse` / `vram::before_execute` together stay under 30 ms in these refreshes. So for the world-load stall on this card, the detile (#1512 / #1513) and the hash are the larger parts; this PR's change alone did not shorten it. No device removal in these 4 runs (grahamster2 saw two on an RTX 3080 at an earlier head). **Not tested**: the review fixes asked for above; `main` + this PR alone. AI use: Claude Code (Claude Opus 5.5) ran the runs, added the local timers and wrote this.
Author
Owner

@⁠ozimchuk on GitHub · 2026-11-25 06:51 UTC · original

Test report at 4a514ae, and a measured interaction for review point 1 (keeping the destination textures until the list has run).

Tested – NVIDIA (32-lane waves), Linux, Wine + vkd3d-proton, release build for x86_64-pc-windows-gnu, the title_textures tests with --test-threads=1:

  • 4a514ae as it is: 11 passed, 0 failed, none SKIPPED.
  • 4a514ae with InFlight also holding the destinations (_dests: Vec<ID3D12Resource>, filled from planned in submit_batch): 9 passed, 2 failed. placed_title_textures_share_vram_and_preserve_pixels fails at "reactivated unmapped texture remapped cleanly" (the texture reads back as zeros); transitions_apply_when_their_list_is_submitted then fails on the lock the first one poisoned.

Why: title_textures reactivates a shadowed placement, and has vram remap it, when the texture over it is finally released (Table::remove through forget). With the upload batch holding a reference, that release moves to the reclaim of a later submit, after the uncovered texture's next upload has gone into unmapped tiles. Keeping the destinations is still right for the GPU; the reactivation then has to follow the title's release rather than the last reference, or the finished batches have to be reclaimed before the next submit's uploads are chosen.

The same holds on a tree with this PR merged together with other title-texture changes: without the destinations all 19 of its title_textures tests pass on the GPU, with them the same two fail.

For anyone repeating Krashgamer's split of the refresh time: #2144 prints it under XCL_ACTIVITY (submit work (2 s): …), without local timers.

Not tested: Windows, AMD; a fix for the reactivation.

AI-assisted. Claude Code, Claude Opus 5.5.

**@⁠ozimchuk** on GitHub · 2026-11-25 06:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7155228244) Test report at `4a514ae`, and a measured interaction for review point 1 (keeping the destination textures until the list has run). **Tested** – NVIDIA (32-lane waves), Linux, Wine + vkd3d-proton, release build for `x86_64-pc-windows-gnu`, the `title_textures` tests with `--test-threads=1`: - `4a514ae` as it is: 11 passed, 0 failed, none SKIPPED. - `4a514ae` with `InFlight` also holding the destinations (`_dests: Vec<ID3D12Resource>`, filled from `planned` in `submit_batch`): 9 passed, 2 failed. `placed_title_textures_share_vram_and_preserve_pixels` fails at "reactivated unmapped texture remapped cleanly" (the texture reads back as zeros); `transitions_apply_when_their_list_is_submitted` then fails on the lock the first one poisoned. Why: `title_textures` reactivates a shadowed placement, and has `vram` remap it, when the texture over it is finally released (`Table::remove` through `forget`). With the upload batch holding a reference, that release moves to the `reclaim` of a later submit, after the uncovered texture's next upload has gone into unmapped tiles. Keeping the destinations is still right for the GPU; the reactivation then has to follow the title's release rather than the last reference, or the finished batches have to be reclaimed before the next submit's uploads are chosen. The same holds on a tree with this PR merged together with other title-texture changes: without the destinations all 19 of its `title_textures` tests pass on the GPU, with them the same two fail. For anyone repeating Krashgamer's split of the refresh time: #2144 prints it under `XCL_ACTIVITY` (`submit work (2 s): …`), without local timers. **Not tested:** Windows, AMD; a fix for the reactivation. AI-assisted. Claude Code, Claude Opus 5.5.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 07:04 UTC · original

Thanks @⁠ozimchuk. That corrects the fix I suggested above: holding the destinations in InFlight is right for the GPU, but on its own it moves the reactivation of a shadowed placement to a later reclaim and breaks placed_title_textures_share_vram_and_preserve_pixels. A complete fix needs one of your two follow-ups: reactivate on the title's release rather than on the last reference, or reclaim finished batches before the next submit picks its uploads.

For whoever picks this up: #1452 has a second race in the same path (treybertram06, Aftermath dump on an RTX 3080). Textures created after refresh_once's vram::before_execute(q) are uploaded on the title queue without waiting for their page mappings, and a copy-engine write faulted 64 KiB into a 47 ms-old texture. They report a one-line wait fixed it in 4 of 4 runs. It is a different bug from the lifetime one.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-25 07:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7155458435) Thanks @⁠ozimchuk. That corrects the fix I suggested above: holding the destinations in `InFlight` is right for the GPU, but on its own it moves the reactivation of a shadowed placement to a later `reclaim` and breaks `placed_title_textures_share_vram_and_preserve_pixels`. A complete fix needs one of your two follow-ups: reactivate on the title's release rather than on the last reference, or reclaim finished batches before the next submit picks its uploads. For whoever picks this up: #1452 has a second race in the same path (treybertram06, Aftermath dump on an RTX 3080). Textures created after `refresh_once`'s `vram::before_execute(q)` are uploaded on the title queue without waiting for their page mappings, and a copy-engine write faulted 64 KiB into a 47 ms-old texture. They report a one-line wait fixed it in 4 of 4 runs. It is a different bug from the lifetime one. AI-assisted (Claude Code).
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 14:15 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 14:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7165005960) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
Author
Owner

@⁠treybertram06 on GitHub · 2026-11-25 22:55 UTC · original

@⁠Cattn this PR no longer merges into main, and it has had no update for a day, so I carried it forward in #2558. Your commit is rebased onto main e1d84b7 with your authorship kept; the two conflicts in title_textures.rs are described there. A second commit adds the page-mapping wait for title-queue uploads that @⁠upipibi pointed to. On @⁠upipibi's and @⁠ozimchuk's lifetime point: main's late_release now holds the title's last Release behind a fence on every title queue, which covers an in-flight upload without holding the destinations in InFlight. If you would rather pick this up again yourself, say so and I'll close #2558.

(Claude Code, Claude Opus 5.5.)

**@⁠treybertram06** on GitHub · 2026-11-25 22:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7176950968) @⁠Cattn this PR no longer merges into `main`, and it has had no update for a day, so I carried it forward in #2558. Your commit is rebased onto `main` `e1d84b7` with your authorship kept; the two conflicts in `title_textures.rs` are described there. A second commit adds the page-mapping wait for title-queue uploads that @⁠upipibi pointed to. On @⁠upipibi's and @⁠ozimchuk's lifetime point: `main`'s `late_release` now holds the title's last `Release` behind a fence on every title queue, which covers an in-flight upload without holding the destinations in `InFlight`. If you would rather pick this up again yourself, say so and I'll close #2558. (Claude Code, Claude Opus 5.5.)
Author
Owner

@⁠Prime1997 on GitHub · 2026-11-26 00:19 UTC · original

Closing because #2558 supersedes this PR. #2558 carries this PR's commit with your authorship kept, rebased onto current main. This head no longer merges: it conflicts in title_textures.rs and is 765 commits behind. #2558 also adds a fix for the page-mapping race that the reviews here found. Your work continues there.

Compared at heads 4a514ae7 (this PR) and 2dc76ac8 (#2558) against main 08db802. Reviewed with Claude Code (Claude Opus 5.5); I checked the comparison before closing.

**@⁠Prime1997** on GitHub · 2026-11-26 00:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/455#issuecomment-7178638551) Closing because #2558 supersedes this PR. #2558 carries this PR's commit with your authorship kept, rebased onto current main. This head no longer merges: it conflicts in `title_textures.rs` and is 765 commits behind. #2558 also adds a fix for the page-mapping race that the reviews here found. Your work continues there. Compared at heads 4a514ae7 (this PR) and 2dc76ac8 (#2558) against main 08db802. Reviewed with Claude Code (Claude Opus 5.5); I checked the comparison before closing.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.