D3D12.X: small render targets in unwatched memory keep being re-checked (glyph caches) #3537
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3537"
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 throny on 2026-11-30T17:07:17Z.
Small CPU-filled render targets in memory that write-watch does not cover (the GPU_UPLOAD part of the unified-memory window with
XCL_UMA_DRIVER=mixed:<a>:<b>) are caught only by the unwatched re-check intitle_textures.rs. That re-check fingerprints three 16 KiB slices (start, middle, end) at 4, 12, 40, 120 and 400 frames after the last whole upload, and drops the texture after five unchanged checks. A glyph cache that the title fills letter by letter is written later than that and outside those slices, so the new glyphs never reach the PC texture and the on-screen control hints in a retail title's world show only a few letters. In that run's log, 4 of the 7 logged glyph-cache textures were in that range and no "streamed unwatched re-uploads triggered" line appeared.Part of #1049 (letters missing from glyph text; that issue's RDNA4 flicker may have another cause).
What is in it
D3D12.X: keep re-checking small CPU-filled targets in unwatched memory, incrates/xcl/src/hle/d3d12x/title_textures.rs:Entry::target) of up to 4 MiB is no longer retired after the last milestone. After an unchanged check it is checked again every 16 frames for as long as it lives. A change still resets it to the first milestone.stream_fingerprint).steady_offset), so textures seeded on the same frame do not stay due together.STREAM_STEADY_BUDGET); a check over it waits for the next frame, oldest due first, and the first check of a frame is always made. The milestones (4, 12, 40, 120, 400) are not limited.stream_recheck_keeps_checking_small_targets_and_hashes_all_of_them(an unchanged target is still scheduled after 900 frames, and a write outside the three slices queues it; fails onmain),steady_recheck_is_only_for_small_targets,steady_rechecks_are_staggered_and_kept_to_a_byte_budget(300 targets of 256 KiB seeded on one frame: no frame over the budget, each checked again within 40 frames; pins the 16-frame interval).Tested
cd0a6883, no uncommitted changes.cargo test -p xcl --lib -j 8 -- title_textures --test-threads=2: 68 passed, 0 failed, 1 ignored.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 2888 passed, 1 failed, 51 ignored. The failure,gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, also fails onmain(9dfbe3ea), run alone.SKIPPEDlines: 22no wave64(this GPU is wave32 only:gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole, thegpu::recomp::lower*andgpu::recomp::tests::*wave*tests),heap_window_out_of_memory_falls_back_to_the_switch_formandhle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap(no heap windows),shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache: Windows Developer Mode is required).Regression run (
scripts/smoke.ps1 -Game <title folder>, same title, 60 s)main (
9dfbe3ea):this PR's head (
cd0a6883):An earlier pair of runs was discarded because other GPU work ran at the same time.
Not tested
is_small_cpu_filled_targetstill rejects a 4096x64 R8 target (wider than 2048). That is a separate change and is not in this PR.AI use
main, ran the test suite and the smoke runs, and prepared this PR.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-30T18:05:34Z.
Ran the
title_texturesgroup from the description atcd0a6883on an NVIDIA Blackwell desktop part with 16 GB of VRAM, then repeated the same command onmain9dfbe3eabuilt in a separate target directory.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, DXC 1.9.2609.5, debug build,
XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.The description records 68 passed, 0 failed, 1 ignored for the first command; on this host it is 63/5/1 over the same 69 selected tests (the filter selects 66 on
main, 69 here, so this head adds 3 tests).The first failure is the root:
hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelspanics withassertion left == right failed: row 5: stale shadowed texture corrupted Battitle_textures.rs:6396at the PR head and attitle_textures.rs:6321onmain(a secondmainrun stopped earlier in the same test attitle_textures.rs:6297, therow 3assertion), with stdout512 unreleased 1 MiB textures over 16 MiB. The other four at the PR head (stream_recheck_keeps_checking_small_targets_and_hashes_all_of_them,stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads,stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload,stream_recheck_schedule_catches_late_writes_and_resets_milestones) panic withPoisonErroron a lock, consistent with it having been poisoned by that first panic (in the serial run it failed first, at 36/69, and the other four after it). Onmainthe same three pre-existingstream_recheck_*tests fail the same way;stream_recheck_keeps_checking_small_targets_and_hashes_all_of_themis new in this PR, which is why the totals are 5 failures here and 4 there.Run alone at
cd0a6883, each of the five passes (1 passed, 0 failed, 0 ignored each), and so do the twosteady_recheck_*tests of the description (1/0/0 each). The same test also passes alone onmain. So the group failure reproduces onmainon this host and is not introduced by this head.Not tested: the full workspace suite, a title that fills a glyph cache letter by letter (the
#1049scenario),XCL_UMA_DRIVER=mixed:<a>:<b>in a real title, native wave64 hosts, AMD and Intel GPUs, Wine, release profile, game data.AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-30T18:30:51Z.
@throny I tested the late texture refresh on my RTX 3080 (driver 616.92). I used the same
256×256R8 texture fixture onmainat9dfbe3eaand on the PR atcd0a6883. I verified that the texture backing was in the unwatchedGPU_UPLOADsegment, advanced the fixture to frame 800, then wrote0xB6across the backing and checked the native texture by GPU readback.main0xB6.0xB6.The watched control texture updated on both revisions. This confirms that the PR picks up a late write after stock has retired the texture. I used a whole-backing write, so localized glyph writes and visible text in the retail game remain untested.
I used Codex GPT-6.2 Sol to adapt and run the fixture. A separate GPT-6.2 Sol agent reviewed the source and original GPU results. Codex GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by throny on 2026-11-30T19:42:38Z.
In-world check running: this PR's head
cd0a6883vs its base9dfbe3ea, RTX 4080, four alternating 600 s runs, same save and inputs, judging whether the in-world text (control hints, HUD) is complete. Results here when done.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by throny on 2026-11-30T20:36:12Z.
Update on the in-world check: the two runs of this PR were invalid on our side (our local input-timing patch was missing from the PR build, so the scripted presses never reached the game and it stayed in the account-select menu; the menu text there was complete). The base runs reached the world. Rerunning the PR build with the patch after the runs now on the GPU. @Gevroska thanks for your RTX 3080 report; I'll answer with the world result.
AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T02:28:14Z.
World result, and it is negative: this PR does not bring the missing letters back. RTX 4080 16 GB (621.40), this PR's head
cd0a6883(plus our local input-timing patch) vs its base9dfbe3ea, same save and inputs,XCL_SPLIT_INDIRECT_ROUNDS=1, frames saved every few seconds.main. No subtitles appeared in the sampled frames. Menu text (account select) is complete in both builds.Turning this into a draft. The glyphs are probably not CPU-filled small targets in unwatched memory, which is what this PR re-checks. @Gevroska, thanks for your RTX 3080 report above.
AI use: Claude Code (Claude Opus 5.5) checked the frames; runs and frame sampling by Claude Sonnet 5.5 / Haiku 5.5 sub-agents.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T02:30:37Z.
Correction to my earlier review: I misread the state transition. An eligible small target enters the steady schedule after its first unchanged milestone, including the +4 check after a change. The 280-frame delay I claimed does not occur; I withdraw that finding.
There is a shorter, concrete deadline regression in that transition. Seed a 256 KiB target at frame 0 with an address whose
steady_offsetis 15. Let the +4 check find it unchanged, then write a byte at frame 5. With rechecks each frame and no budget contention, the base checks at frame 12; this head movesbase_frameto 19 and next checks at frame 35. The write therefore waits 23 more frames than on the base. Please retain the +12 milestone before switching to the staggered steady schedule, and test this sequence throughrecheck_streamed_unwatched_at, including the queued upload. This is a source-derived schedule, not a measured glyph or frame-time result; the author's world replay did not restore the missing text.Separately, the budget filter does quadratic ID searches on the submission thread. With 1,024 overdue 512 KiB targets, eight fit 4 MiB and 1,016 are deferred.
check.retain(|c| !skipped.contains(&c.0))makes 524,764 ID comparisons before any hashing. A set of deferred IDs, or constructing the check list from accepted entries, keeps that partition linear. A regression can exercise the production partition with a large overdue batch and a milestone entry, checking classification and bounded lookup counts without a timing assertion. No hitch was measured here.AI use: Codex (GPT-6.2 Sol) rechecked the source and arithmetic; Codex (GPT-6.2 Astra) identified the state-transition misread and the backlog path.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T02:56:03Z.
Review (head
cd0a6883, diff read, not a merge-check; draft, so not built or run):stream_fingerprintnow hashes a steady target of up to 512 KiB in full, and it is also used when a texture is recorded and at the milestone checks (4, 12, 40, …), which have no limit. So a level load that creates ~200 small RT/UAV textures in unwatched memory that the GPU hasn't written means ~100 MiB copied and hashed on the submitting thread four frames later. Main reads ~9.6 MiB there (48 KiB sampled each). Either sample at seed/milestones and hash in full only on steady checks, or correct the cost line in the description.steady_rechecks_are_staggered_and_kept_to_a_byte_budgetdoesn't run the real scheduling. It builds its own due list and only usessteady_checks_over_budget. It would still pass ifrecheck_streamed_unwatched_atdropped a check pushed back by the budget or used the offset wrongly.assert_eq!(STREAM_RECHECK_STEADY, 16)only pins the constant.STREAM_RECHECKentries are removed in this file. They look complementary, but expect a small conflict in the tests.Fine: a check pushed back by the budget keeps its state and goes first the next frame, a change sends the texture back to the first check, and GPU-written textures still leave the re-check.
stream_recheck_keeps_checking_small_targets_and_hashes_all_of_themfails on main as claimed.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T03:18:38Z.
Correction to my earlier #3537 review: the claimed 280-frame wait was wrong. I edited that comment to withdraw it and document the verified shorter deadline case and an independent quadratic backlog cost. Please use the corrected version.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T06:47:05Z.
Closing: the world run above shows it does not fix the missing letters, which was its purpose. Branch kept on throny/xcl.
AI use: Claude Code (Claude Opus 5.5).
Pull request closed