d3d12: opt-in once-per-frame checks for placed textures that stopped changing #590

Merged
Jerkin42 merged 1 commit from upstream-pr/590 into main 2026-11-30 19:10:29 +00:00
Jerkin42 commented 2026-11-30 12:45:04 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-30T12:45:04Z.


Summary

Part of #472, focus 3 on #533.

Section-backed XMem pages have no write watch (#464). So every placed texture over them is digested before every batch, including the many that never change.

On the RX 9060 XT in the world, main hashed about 548 GB a minute this way, about 16.5 s of digest per minute (submit profile, placement digest).

TUXBOX_CHECK_ONCE_PER_FRAME=1 checks a texture whose last eight checks found it unchanged at most once per presented frame. A check that finds a change, or doesn't settle, resets the count.

A skipped check doesn't rearm the watch or clear the note. A write is therefore still seen at the next frame's check, at most a frame late. That delay is the trade-off, and why the switch is opt-in.

The presented-frame counter is bumped in PresentX.

Tested

  • The checks relevant to this change passed (see the two unrelated failures below)
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below. It needs a title that presents frames and keeps textures over section pages. I measured it in the game instead.
  • Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them: NVIDIA not run

GPU, driver and backend: AMD RX 9060 XT (1002:7590), Mesa 26.1.8 RADV, GE-Proton11-14

Evidence: TuxBox check of a564e8c07bf6 with uncommitted changes, no GPU checks: 12 passed, 1 failed, 0 not run

Commands run and their results:

python tuxbox.py check --no-gpu
  12 passed; Python tests: 2 failures, neither in code this touches:
  - test_stage_baseline GuestWatch...guest_that_died: fails the same way on unchanged main here
  - test_xcrdapi_abi built_provider_exports: the worktree's build/ held an older xcrdapi.dll

ProjectScarlett: same build and settings twice, warm cache, the switch off and on. Frames per second come from TUXBOX_FRAME_LOG, by 90 s window after reaching the world. The build was main e5d2e913 with #390, #572 and #567 for the world, plus the change.

0–90 s 90–180 s 180–270 s
off: fps 0.20 0.22 0.27
on: fps 0.22 0.24 0.30
off: submit / placement per frame 1988 / 1230 ms 1870 / 1131 ms 1819 / 1106 ms
on: submit / placement per frame 1226 / 514 ms 1179 / 503 ms 1248 / 521 ms
  • Digest: about 16.5 s per minute off, about 1 s per minute on.
  • Stability: no GPU fault and no rejected batch.
  • Frame time: placement is now about 0.5 s of a ~4 s frame. Most of the rest is queues held at title memory waits (#472).

Checks

No evidence JSON changed.

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5565535630 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/590). Originally posted by [Jerkin42](https://github.com/Jerkin42) on 2026-11-30T12:45:04Z. --- ## Summary Part of #472, focus 3 on #533. Section-backed XMem pages have no write watch (#464). So every placed texture over them is digested before every batch, including the many that never change. On the RX 9060 XT in the world, main hashed about **548 GB a minute** this way, about 16.5 s of digest per minute (submit profile, `placement digest`). **`TUXBOX_CHECK_ONCE_PER_FRAME=1`** checks a texture whose last eight checks found it unchanged at most once per presented frame. A check that finds a change, or doesn't settle, resets the count. A skipped check doesn't rearm the watch or clear the note. A write is therefore still seen at the next frame's check, at most a frame late. That delay is the trade-off, and why the switch is opt-in. The presented-frame counter is bumped in `PresentX`. ## Tested - [x] The checks relevant to this change passed (see the two unrelated failures below) - [ ] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below. It needs a title that presents frames and keeps textures over section pages. I measured it in the game instead. - [ ] Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them: NVIDIA not run GPU, driver and backend: AMD RX 9060 XT (`1002:7590`), Mesa 26.1.8 RADV, GE-Proton11-14 ```text Evidence: TuxBox check of a564e8c07bf6 with uncommitted changes, no GPU checks: 12 passed, 1 failed, 0 not run ``` Commands run and their results: ```text python tuxbox.py check --no-gpu 12 passed; Python tests: 2 failures, neither in code this touches: - test_stage_baseline GuestWatch...guest_that_died: fails the same way on unchanged main here - test_xcrdapi_abi built_provider_exports: the worktree's build/ held an older xcrdapi.dll ``` **ProjectScarlett:** same build and settings twice, warm cache, the switch off and on. Frames per second come from `TUXBOX_FRAME_LOG`, by 90 s window after reaching the world. The build was main e5d2e913 with #390, #572 and #567 for the world, plus the change. | | 0–90 s | 90–180 s | 180–270 s | |---|---|---|---| | off: fps | 0.20 | 0.22 | 0.27 | | on: fps | 0.22 | 0.24 | 0.30 | | off: submit / placement per frame | 1988 / 1230 ms | 1870 / 1131 ms | 1819 / 1106 ms | | on: submit / placement per frame | 1226 / 514 ms | 1179 / 503 ms | 1248 / 521 ms | - **Digest:** about 16.5 s per minute off, about 1 s per minute on. - **Stability:** no GPU fault and no rejected batch. - **Frame time:** placement is now about 0.5 s of a ~4 s frame. Most of the rest is queues held at title memory waits (#472). ## Checks No evidence JSON changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
NickStallman commented 2026-12-01 02:20:11 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T02:20:11Z.


A measurement of TUXBOX_CHECK_ONCE_PER_FRAME=1 on an RTX 5090 (620.70.10, GE-Proton11-15), ProjectScarlett, 20 minutes each, integration build on main 82109205 (one run per arm, other settings the same, default page mode, no private views):

After 300 s Frames Median frame 90th percentile Median placement time a frame
Default 581 1,212 ms 2,991 ms 1,049 ms
TUXBOX_CHECK_ONCE_PER_FRAME=1 692 911 ms 2,763 ms 386 ms
  • Placement per frame falls by about 63%. The frame falls by about 25%, so something else is the larger part of it now.
  • Single runs vary: across the default arm, a run of the same build with TUXBOX_TILE_POOL=0 and two runs of the previous integration build, medians were 1,212 to 1,860 ms and placement a frame 766 to 1,064 ms, so the 386 ms is outside that spread. The frame-time difference is not clearly outside it.
  • No GPU loss, no refusal. I can't see a visual difference I'd attribute to it, but the picture isn't right to begin with.
  • The runs had the fault trace and the stale-image check on in both arms, so absolute times are higher than a plain run's.
<!-- greyfinch-sync:brcly/TuxBox:comment:7298498295 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/590#issuecomment-7298498295). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-12-01T02:20:11Z. --- A measurement of `TUXBOX_CHECK_ONCE_PER_FRAME=1` on an RTX 5090 (620.70.10, GE-Proton11-15), ProjectScarlett, 20 minutes each, integration build on main 82109205 (one run per arm, other settings the same, default page mode, no private views): | After 300 s | Frames | Median frame | 90th percentile | Median placement time a frame | | --- | --- | --- | --- | --- | | Default | 581 | 1,212 ms | 2,991 ms | 1,049 ms | | `TUXBOX_CHECK_ONCE_PER_FRAME=1` | 692 | 911 ms | 2,763 ms | 386 ms | - Placement per frame falls by about 63%. The frame falls by about 25%, so something else is the larger part of it now. - Single runs vary: across the default arm, a run of the same build with `TUXBOX_TILE_POOL=0` and two runs of the previous integration build, medians were 1,212 to 1,860 ms and placement a frame 766 to 1,064 ms, so the 386 ms is outside that spread. The frame-time difference is not clearly outside it. - No GPU loss, no refusal. I can't see a visual difference I'd attribute to it, but the picture isn't right to begin with. - The runs had the fault trace and the stale-image check on in both arms, so absolute times are higher than a plain run's.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!590
No description provided.