WIP: fix(vk): a rewritten finalized target goes at three quarters only where the rest is in memory, with a retire reason of its own #1489

Draft
mooki wants to merge 6 commits from mooki/Longshot:fix/finalized-target-review into main
Member

Type: fix · Risk: low · Tested on: Linux, RTX 4090 (a 6 GB card's allowance by switch); game-free checks · Needs: Windows, any GPU; an 8 GB card

TL;DR

Follows #1462, which lets go of a finalized terrain tile once the game has rewritten its memory. HumanBean's review of it (1687, 1690) made three suggestions that were not blocking: apply the three-quarters rule only where the untouched quarter is known to be in memory, name these textures in the "textures retired" line instead of calling them "drawn over", and run the check once per texture per pass. This PR does all three, each with a test that failed first. A 16-minute walk at a simulated 6 GB allowance on this head kept the render-target images in a band; the cost of the texture pass is not measured yet (the night's timings were invalid; queued again).

Breakdown

  • Who it helps: players on small cards (the leak of #1443) get the same fix with less risk of a wrong texture; whoever reads a log gets a retire reason that says what happened.
  • What was wrong: the rule let a one-level target, or one over 1 MB, go at three quarters rewritten, though the renderer never put its texels into the game's memory, so the untouched quarter would come back from memory that never held it. The retired line counted these textures as drawn over. The check walked a tile's page generations up to four times a pass.
  • What changes: three quarters only for a texture the write-back covers (written_back_for == last_written), all of the storage otherwise; a fourth retire reason, "rewritten by the game N"; the answer kept in the texture for the pass.
  • What does not change: the terrain tiles still go at three quarters; the cap on kept tiles; the other cleanup passes; no switch, no setting.
  • How it was checked: three red-first tests; the whole suite (same failing names as main); the Windows compile check; a walk of 16 minutes in the game at a simulated 6 GB allowance, with pictures looked at. The paired cost of the pass is not measured yet (the night's timings were invalid; queued again).
  • What is still open: the cost (tex_frame_ms, not measured yet: the night's timings were invalid and are queued again), a real 8 GB card, Windows execution.
  • Risk: low. The rule frees less than #1462's, never more; the one visible change is a field added to a log line.

Why

#1462 (merged) stops the render-target images of #1443 from climbing, by letting go of finalized terrain tiles the game has rewritten. Its review found three things to improve and left them to the author. The first is a correctness one on a narrow path: a target that the write-back never covers has the part the game did not rewrite only in its image, which the first form of the rule did not take into account. The others are a log reason and a repeated computation.

Follows #1462. Refs #1443.

How to reproduce

Seen on: Linux, Arch, RTX 4090, NVIDIA 615.78.08, main @ 93bc8a7fb (the merge of #1462)
Settings and switches: defaults
Steps: the three are shown by the new game-free test, python -I -B tests/test_target_retention.py, run on main @ 93bc8a7fb with this PR's test copied in; in the game, read the "textures retired" line of a walk through Hyrule Field
Expected: a one-level or over-1 MB target rewritten by three quarters stays; the retired line has a column for the textures the game rewrote; a tile's written runs are read once a pass
Actual: on main the first two cases fail ("one level, three quarters written over: stays" and "over 1 MB, three quarters written over: stays"), the line counts the textures as drawn over, and a tile's runs are read up to four times a pass

What changed

Three review points of #1462, each as a test commit that fails on the commit before it and its fix.

  • Three quarters only where the rest is in memory (finalized_obsolete() in gpu/vk/vk_texture.cpp, HumanBean's first suggestion): a finalized texture the GPU drew, of 32 KB or more, goes at three quarters of its storage rewritten only if t.written_back_for == t.last_written (a mip chain up to 1 MB, which drawn_writeback.h writes back: the terrain tiles); any other needs all of its storage rewritten. The fixture models the write-back with drawn_writeback.h's own noted and kFrames.
  • A retire reason of its own (gpu/vk/evict_reason.h, the second suggestion): OBSOLETE; classify takes whether the texture is obsolete; the line reads budget N, drawn over N, dead targets N, rewritten by the game N (the first three unchanged); the Evict record carries the flag instead of the or; the line's buffer grows from 160 to 192 bytes.
  • Once per texture per pass (Texture::obsolete_pass and Texture::obsolete in gpu/vk/vk_texture.h, the third suggestion): the answer is kept in the texture with the frame_no the pass runs under, so the page generations are walked once. HumanBean put the cost at tens of microseconds a pass; the timing, queued again, is the measurement.
Commit What
fd954e25d test, red: a single-level or over-1 MB target rewritten by three quarters must stay
337f9cdf1 fix: three quarters only where the write-back put the texels into memory; all of the storage otherwise
1bcb62b92 test, red: the retired line names the reason
a1022ad7b fix: the reason OBSOLETE, "rewritten by the game N"
750dffe9a test, red: a texture's written runs are read once per pass
761394e7d perf: finalized_obsolete answers once per texture per pass

The branch is on main @ 310e7c9df and merges with current main @ a6c8ed570 without a conflict. It was first made on main @ 93bc8a7fb, the merge of #1462 (the six commits had been prepared on #1462's own branch before it merged), and rebased; git range-diff of the two ranges shows all six patches identical. Main's changes in between add 225 lines to gpu/vk/vk_texture.cpp; in texture_frame there are two single lines (ahead_budget_bytes = size_budget; before the budget rules and rendered_forget(gone); after the eviction loop), neither in a line this PR changes. The 16-minute walk below ran on the first form (5f83ff7c7, on 93bc8a7fb); a 9-minute walk on this head follows it.

Measurements

Verdict: the walk below is the in-game run of this change: over 16 minutes at a simulated 6 GB allowance the render-target images stay in a band (no steady rise from minute to minute) and the new retire reason fires. The cost of the texture pass is not measured yet. The two paired exclusive timings of the night (17 Nov, 22:37 to 22:41) each ended after their first run with no measuring window (the walk driver teleported at the first play state and the arrival never came; details in the comment of 18 Nov), so there is no number and no quiet verdict, not a result of the machine being loud. A repaired driver is being rehearsed; the timing is queued again and this table is filled in a dated update. A first look from the diagnostic runs is in the comment of 18 Nov (the texture pass's own time per frame, 0.19 ms before #1462 and 0.16 ms with it, ordinary runs, no speed claim).

Hardware: Linux, RTX 4090, NVIDIA 615.78.08, i9-13900K, 96 GB; the walk is an ordinary run, the timing runs are exclusive holds under the quiet rule
Scene: Hyrule Field (child) for the timing, Kokiri Forest and Hyrule Field with area changes for the walk; DLAA 2048x1152
Method: the frame trace (RX_VK_FRAME_TRACE=1): tex_frame_ms (the texture pass's own time) and the frame times of the window, main, head, main, head in one hold, two holds in all; the walk samples the game's own log lines
How to reproduce: the workbench's paired timing hold with the field-walk scenario and its lap script; the commands are under How it was tested

Before: main @ 93bc8a7fb After: this PR @ 5f83ff7c7
tex_frame_ms, mean and p99 of the window not measured yet (the night's timings were invalid: no window) not measured yet (the night's timings were invalid: no window)
frame time, mean and p99 of the window not measured yet (the night's timings were invalid: no window) not measured yet (the night's timings were invalid: no window)
what #1462 itself cost: main @ 415a8944c (before) against main @ 93bc8a7fb (with it), same two rows not measured yet (the night's timings were invalid: no window) not measured yet (the night's timings were invalid: no window)

A walk of 16 minutes at a simulated 6 GB allowance (a 24 GB card, not an 8 GB card)

The game is the build of this change's first form (5f83ff7c7: main @ 93bc8a7fb and the six commits), RX_VK_TEST_ALLOWED_MB=6144 (the renderer sees a 6144 MB allowance on the 24 GB RTX 4090), windowless, a child-Link save in Kokiri Forest. The lap script's laps: teleport to Hyrule Field, walk a planned route for 6000 game presents, teleport back, with a lap's end sampled; it ran 989.7 s of wall time and 44,708 presents (6 laps; the machine was busy at the start, load 69 falling to 12, so the game ran at about 20 to 45 frames a second: an ordinary run, no speed claim). Exit 0, fatal 0, crash 0, device lost 0, kernel Xid/NVRM lines 0 (journal coverage complete), no "ran without a core" lines.

minute render-target images kept finalized (n) VRAM used by the renderer, MB (of 6,144) process RSS, MB
2 (arrival, Kokiri Forest) 93 3 4,628 13,428
3 150 37 4,984 14,520
4 180 41 5,314 13,283
5 163 31 5,410 13,053
6 151 54 4,866 12,025
7 181 52 5,376 7,847
8 142 66 5,226 7,553
9 179 71 5,198 7,174
10 155 63 5,418 7,358
11 164 64 5,194 8,137
12 201 52 5,504 6,536
13 151 61 5,514 6,350
14 142 70 5,134 6,554
15 146 64 5,130 6,353
16 142 64 5,450 6,247
17 208 54 5,312 6,125

At the lap ends (0 to 6): render-target images 93, 126, 140, 165, 138, 142, 208; kept finalized targets 3, 51, 63, 77, 70, 70, 54. So after the first laps the images move between 126 and 208 and the kept targets between 51 and 77, with no steady rise; the renderer's VRAM stays between 4.6 and 5.5 GB (one lap-end sample reads 6,226 MB, 82 MB over the 6,144 MB allowed) and the process's RSS falls from 13.4 GB to 6.1 GB. The last sample (208 images, minute 17) is the highest of the series: I do not know whether that is the start of a rise or a one-off, and there is no main beside this walk, so this is "no growth beyond a band in 16 minutes", not a proof of a plateau and not a comparison with main (that comparison is #1462's, on its laps). The retired lines of the walk sum to 32,093 textures: budget 25,318, drawn over 1,962, dead targets 4,403, rewritten by the game 410, so the new reason shows and the terrain tiles are still let go under the narrowed rule.

Pictures: 10 taken while walking and 11 at the ends of laps and legs, looked at as contact sheets (320 x 180 tiles): the ground, grass, rock faces, a path and a cliff draw normally; no streaks along edges, black patches or missing tiles at that size. The last lap ended with the teleport back refused ("an event is playing": a character's text box was on screen in the last walking picture), so lap 6 ends in Hyrule Field. A subtle streak would not show at this size; a closer look by a person is under Must be tested. In the dark passage out of Kokiri Forest a row of small white flecks shows on the ground; a walk on main before #1462 (415a8944c, with counters only) shows the same flecks at the same spot, so they do not come from this change.

Four of the walk's pictures on this head at the 6 GB allowance, from lap 2 to the last minutes: grass, rock faces, the fence and the far field draw normally.

What an earlier pair on the pre-rebase twin of #1462's review head (4cd44a7a3: #1462 and these six patches over main @ 645d58e68) showed for the retired line: a 375 s walk summed to budget 12,187, drawn over 434, dead targets 990, rewritten by the game 144, against main's 9,898, 1,147 and 538 with no such column; that pair was not route-matched (229 m against 92 m in lap 1) and is not used for the leak, which #1462's own runs showed.

A walk of 9 minutes on this head, at the same allowance

The same route and setting on 761394e7d itself (the game logs v3.0.0-rc.7-67-g761394e7d), a full build over main @ 310e7c9df: 555 s, 22,578 presents, 3 laps; exit 0, no fatal, crash, device-lost, kernel or NVRM line. Render-target images moved between 98 and 170 by minute and read 107, 143 and 156 at the lap ends; kept finalized targets rose from 22 to 87 by minute 10, the same shape as the first 10 minutes of the 16-minute walk (3 to 77); the new retire reason fired 180 times in 13,339 retirements. The walk and lap pictures, looked at as a contact sheet, draw normally (ground, grass, rock faces, caves); the white flecks in the dark passage are the ones main shows. Ten minutes say nothing about a plateau either way: this is the game run of this head, not a leak measurement.

The Test Farm's three reports on #1462 and the review's reading

The Test Farm ran field-retention on #1462's head (1c09f9d12) against its base: one game start a side, a 20 s field window, the 60 fps cap. RTX 4070: field p99 18.27 to 23.19 ms (+26.9 %, over the 20 % rule, failed). RX 9070 XT: 19.93 to 20.63 (+3.5 %, passed). RTX 3070 8 GB: 19.88 to 19.89 (+0 %, passed). The sticky's median over the two Windows reports it counted was +15 %, and the farm marked the 4070's report as disagreeing with its peers.

HumanBean's reading (review 1690) is that this is noise, not the change: main's side of the 4070 run was unusually smooth (field max 20.7 ms against 47 to 88 ms on main for the other PCs), p50 did not move (16.67 to 16.62), there were no stutters or hitches on either side, the other two PCs do not show it, field VRAM is flat on all three (+0 % to +1.7 %), and the work added per pass is tens of microseconds. I find that consistent with what the three reports show, and I am not using it as a measurement: the direct checks are the paired tex_frame_ms above and a diagnostic run on my PC (not part of this PR; running now) that counts rendered textures let go and made again within 30, 120 and 600 frames on the same field walk, main before and with #1462, next to the frame trace. Their numbers go into this description as a dated update.

Flags and settings

None.

How it was tested

Everything here was run by an AI agent (Claude Sonnet 5.5) working for me; commands are given so anyone can rerun them. The tools are the repository's own game-free tests and, for the game runs, the workbench's (https://github.com/mooki000/ls-workbench: the run wrapper with its GPU gate, the scripted-play drivers over the control bridge described in https://git.magicbean.dev/MagicBeanDev/Longshot/src/branch/main/docs/control.md, the regression worker's paired timing hold and the idle-class test gate).

  1. Red first, three times. python -I -B tests/test_target_retention.py cuts, by their text, texture_frame's choice of which textures go and finalized_obsolete() out of gpu/vk/vk_texture.cpp (tests/srccut.py), compiles them with stand-ins for the Texture fields they read, and runs 30 laps of 60 render targets the size of the terrain tiles (260 x 260 RG8, nine levels, 176 KB of texels, 325 KB as the allocator gives it), each drawn once, finalized, never used again, with the game writing over a lap's storage two laps on (all of it, a quarter, half, three quarters, or a 16 KB texture); the write-back is drawn_writeback.h's own noted and kFrames. Each test commit was run on the commit before it:
Point Test commit Result before its fix Fix commit Result after
three quarters only where the rest is in memory fd954e25d two cases fail: one level, and over 1 MB, three quarters written over: must stay 337f9cdf1 pass
a reason of its own 1bcb62b92 test_evict_reason.py no longer finds the new classify call; the fixture does not compile (no obsolete member of Evict) a1022ad7b both pass
once per texture per pass 750dffe9a a texture's written runs are read at most 4 times in a pass, within the budget and over it: 2 cases fail 761394e7d pass: at most 1 time

Each fix was also broken on purpose in a copy of the tree and the test failed every time: the first with the old rule (always three quarters), with always all of the storage ("three quarters is" fails) and with the condition inverted; the second with the pass handing the flag back as drawn over ("each went as obsolete" fails); the third without the memo (the read count is four) and with a memo that never expires (five cases fail).
2. The neighbours. test_evict_reason.py, test_readback_timeout_reuse.py, test_vram_compact.py and test_drawn_writeback.py, which also cut texture_frame, pass on the rebased head.
3. Whole suite and Windows syntax, on the build of the first form (5f83ff7c7, over main @ 93bc8a7fb). python -I -B tests/run_all.py --jobs 6 --strict through the workbench's idle-class gate (the idle wrapper, three slots, core dumps off, a fresh HOME): 675 passed, 38 failed, 17 skipped. Compared by name with main: 37 of the 38 are in the list of the earlier whole-suite run of main @ 645d58e68, and the 38th, test_log_open_failure.py, is a test main added since; run alone on main @ 93bc8a7fb it fails the same way (its C fixture does not compile with this PC's gcc and -Werror). test_crash_record.py, which failed on main @ 645d58e68, passed in this run. I did not run the whole suite on main @ 93bc8a7fb. The workbench's Windows fixture check (llvm-mingw ucrt-x86_64) compiles the changed C++ fixtures for the Windows target: PASS, 2 translation units, 0 failures, 0 unjudged. It is a syntax check, not a Windows run.
4. The walk. The game was driven over the control bridge by the lap script of the workbench's scripted-play drivers: it starts the game through the run wrapper with a save and the allowance switch, teleports to Hyrule Field, follows a planned route with the left stick (the position and camera from the bridge's status give the stick's angle), teleports back, and samples every 4 s the process's memory from /proc, the card's memory from nvidia-smi and the newest values of the renderer's own log lines (image blocks of the render targets, finalized textures kept, VRAM, textures, the retired line), with a picture of the game's frame every 90 s of walking. The table takes the last value of each line before a minute's mark; the numbers come from the run's samples.csv through a small script, nothing is averaged.
5. Still to run on my PC: (a) done: the diagnostic counting of let-go-then-remade targets, main before and with #1462 (ordinary runs; the result is in the comment of 18 Nov); (b) the paired exclusive timing, now split over two holds (main then head, head then main, so each side runs twice; 225 s windows on the field walk; the quiet rule: mean other work under 3 cores, highest 5 s under 6, same-arm repeats within 5 %), reading the frame trace's tex_frame_ms and the p99 of each window. A run that is not quiet is kept and said, not averaged away.

Testing

Tested: on my own PC. On this head 761394e7d (on main @ 310e7c9df): the five focused tests and a 9-minute walk in the game at a simulated 6 GB allowance (Measurements). On its first form 5f83ff7c7 (on main @ 93bc8a7fb; git range-diff: the same six patches): the three red-first tests and their fixes, the four neighbouring tests, the whole suite by name against main, the Windows-target syntax check, the Linux build, and the 16-minute walk.

Not tested: the cost of the texture pass (the night's timings were invalid; queued again); whether the Windows field p99 of the Test Farm's 4070 report is real (the review's reading is noise; the Linux diagnostic of the comment of 18 Nov fits that reading, and the paired timing is queued again); the whole suite on this head itself (it ran on the first form); Windows execution of the changed C++ fixtures; a real 8 GB card and a 20-minute walk on it; AMD and Intel GPUs.

Must be tested:

  • Windows, any GPU: the Test Farm's field-retention plan with at least 3 game starts a side on the RTX 4070 (the review suggests runs: 3), expecting field p99 within 20 % of main (Test Farm: field-retention on windows).
  • An 8 GB or smaller card, any OS: walk Hyrule Field for 20 minutes and return to Kokiri Forest, expecting no empty or striped ground tiles and the "image blocks (render targets)" images not climbing (Test Farm: vram8gb, or by hand: look at the ground and read the log lines).

Risks

What could break: the rule now lets go of less than #1462's did (a one-level or over-1 MB target needs all of its storage rewritten), so it can only keep a texture longer, not drop one earlier; the terrain tiles still go at three quarters. The log line has one more field at its end, so a script that matched the whole line, not its first three columns, would need the new column.

Cost: the check reads a texture's written ranges once per pass now (it was up to four times), and returns before reading for anything that is not a released, GPU-drawn pool texture of 32 KB or more; the memo adds two fields to Texture. Measured: not yet. The night's paired timings were invalid (no measuring window), so the cost of the pass is still unmeasured; the diagnostic runs show 0.16 to 0.19 ms a frame for the whole pass on both sides (ordinary runs, no speed claim) and the same upload and destroy mix in the slowest 1 % of frames, which is why I expect the difference to be small, but that is an expectation, not a measurement.

Turning it off: revert the commits.

Compatibility: the "textures retired" log line has one more field; nothing else changes.

Issues

Follows #1462. Refs #1443.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks. Not ticked yet: the texture pass's own time (tex_frame_ms) is not measured; the night's paired timings were invalid (no measuring window) and are queued again.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main (main @ 310e7c9df; merges with main @ a6c8ed570 without a conflict).
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named): 38 tests fail, all of them failures of main: test_bug_report_defaults.py, test_cpu_report.py, test_crt_options.py, test_damage_debug_menu.py, test_display_startup_failure.py, test_dlss_feature_size.py, test_failed_compile_keeps_objects.py, test_framegen_preset.py, test_fsr_uniform_ownership.py, test_guest_imported.py, test_hud_layout_row.py, test_import_reach.py, test_invalidate_vcore.py, test_linux_preflight.py, test_linux_pressure.py, test_linux_update.py, test_log_open_failure.py, test_mirror_budget.py, test_missing_nup.py, test_mods_size_table.py, test_nonuniform_image_arrays.py, test_parallel_init_order.py, test_pending_guest_import.py, test_pipeline_play_cache.py, test_present_thread.py, test_profiling_mode.py, test_readback_timeout_source.py, test_replay_write_order.py, test_rumble_menu.py, test_run_all_changed.py, test_slow_frames.py, test_staging_burst.py, test_target_image_pool.py, test_upscaler_round_trip.py, test_upscaler_rows.py, test_vcore_escape.py, test_vk_occlusion_queries.py, test_walk_key.py.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A check under tests/ that reads changed source updated in this PR, not weakened (tests/test_evict_reason.py follows the new classify call; nothing removed).
  • A game-free test added for the fix, failing on main and passing here.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths (the Windows-target syntax check of the changed fixtures passed; the renderer change is plain C++ the Linux build compiled).

New on this forge; not opened on GitHub.

**Type:** fix · **Risk:** low · **Tested on:** Linux, RTX 4090 (a 6 GB card's allowance by switch); game-free checks · **Needs:** Windows, any GPU; an 8 GB card ## TL;DR Follows #1462, which lets go of a finalized terrain tile once the game has rewritten its memory. HumanBean's review of it (1687, 1690) made three suggestions that were not blocking: apply the three-quarters rule only where the untouched quarter is known to be in memory, name these textures in the "textures retired" line instead of calling them "drawn over", and run the check once per texture per pass. This PR does all three, each with a test that failed first. A 16-minute walk at a simulated 6 GB allowance on this head kept the render-target images in a band; the cost of the texture pass is not measured yet (the night's timings were invalid; queued again). ## Breakdown - **Who it helps:** players on small cards (the leak of #1443) get the same fix with less risk of a wrong texture; whoever reads a log gets a retire reason that says what happened. - **What was wrong:** the rule let a one-level target, or one over 1 MB, go at three quarters rewritten, though the renderer never put its texels into the game's memory, so the untouched quarter would come back from memory that never held it. The retired line counted these textures as drawn over. The check walked a tile's page generations up to four times a pass. - **What changes:** three quarters only for a texture the write-back covers (`written_back_for == last_written`), all of the storage otherwise; a fourth retire reason, "rewritten by the game N"; the answer kept in the texture for the pass. - **What does not change:** the terrain tiles still go at three quarters; the cap on kept tiles; the other cleanup passes; no switch, no setting. - **How it was checked:** three red-first tests; the whole suite (same failing names as main); the Windows compile check; a walk of 16 minutes in the game at a simulated 6 GB allowance, with pictures looked at. The paired cost of the pass is not measured yet (the night's timings were invalid; queued again). - **What is still open:** the cost (`tex_frame_ms`, not measured yet: the night's timings were invalid and are queued again), a real 8 GB card, Windows execution. - **Risk:** low. The rule frees less than #1462's, never more; the one visible change is a field added to a log line. ## Why #1462 (merged) stops the render-target images of #1443 from climbing, by letting go of finalized terrain tiles the game has rewritten. Its review found three things to improve and left them to the author. The first is a correctness one on a narrow path: a target that the write-back never covers has the part the game did not rewrite only in its image, which the first form of the rule did not take into account. The others are a log reason and a repeated computation. Follows #1462. Refs #1443. ## How to reproduce **Seen on:** Linux, Arch, RTX 4090, NVIDIA 615.78.08, main @ 93bc8a7fb (the merge of #1462) **Settings and switches:** defaults **Steps:** the three are shown by the new game-free test, `python -I -B tests/test_target_retention.py`, run on main @ 93bc8a7fb with this PR's test copied in; in the game, read the "textures retired" line of a walk through Hyrule Field **Expected:** a one-level or over-1 MB target rewritten by three quarters stays; the retired line has a column for the textures the game rewrote; a tile's written runs are read once a pass **Actual:** on main the first two cases fail ("one level, three quarters written over: stays" and "over 1 MB, three quarters written over: stays"), the line counts the textures as drawn over, and a tile's runs are read up to four times a pass ## What changed Three review points of #1462, each as a test commit that fails on the commit before it and its fix. - **Three quarters only where the rest is in memory** (`finalized_obsolete()` in `gpu/vk/vk_texture.cpp`, HumanBean's first suggestion): a finalized texture the GPU drew, of 32 KB or more, goes at three quarters of its storage rewritten only if `t.written_back_for == t.last_written` (a mip chain up to 1 MB, which `drawn_writeback.h` writes back: the terrain tiles); any other needs all of its storage rewritten. The fixture models the write-back with `drawn_writeback.h`'s own `noted` and `kFrames`. - **A retire reason of its own** (`gpu/vk/evict_reason.h`, the second suggestion): `OBSOLETE`; `classify` takes whether the texture is obsolete; the line reads `budget N, drawn over N, dead targets N, rewritten by the game N` (the first three unchanged); the `Evict` record carries the flag instead of the or; the line's buffer grows from 160 to 192 bytes. - **Once per texture per pass** (`Texture::obsolete_pass` and `Texture::obsolete` in `gpu/vk/vk_texture.h`, the third suggestion): the answer is kept in the texture with the `frame_no` the pass runs under, so the page generations are walked once. HumanBean put the cost at tens of microseconds a pass; the timing, queued again, is the measurement. | Commit | What | |---|---| | `fd954e25d` | test, red: a single-level or over-1 MB target rewritten by three quarters must stay | | `337f9cdf1` | fix: three quarters only where the write-back put the texels into memory; all of the storage otherwise | | `1bcb62b92` | test, red: the retired line names the reason | | `a1022ad7b` | fix: the reason `OBSOLETE`, "rewritten by the game N" | | `750dffe9a` | test, red: a texture's written runs are read once per pass | | `761394e7d` | perf: `finalized_obsolete` answers once per texture per pass | The branch is on main @ 310e7c9df and merges with current main @ a6c8ed570 without a conflict. It was first made on main @ 93bc8a7fb, the merge of #1462 (the six commits had been prepared on #1462's own branch before it merged), and rebased; `git range-diff` of the two ranges shows all six patches identical. Main's changes in between add 225 lines to `gpu/vk/vk_texture.cpp`; in `texture_frame` there are two single lines (`ahead_budget_bytes = size_budget;` before the budget rules and `rendered_forget(gone);` after the eviction loop), neither in a line this PR changes. The 16-minute walk below ran on the first form (`5f83ff7c7`, on 93bc8a7fb); a 9-minute walk on this head follows it. ## Measurements **Verdict:** the walk below is the in-game run of this change: over 16 minutes at a simulated 6 GB allowance the render-target images stay in a band (no steady rise from minute to minute) and the new retire reason fires. The cost of the texture pass is not measured yet. The two paired exclusive timings of the night (17 Nov, 22:37 to 22:41) each ended after their first run with no measuring window (the walk driver teleported at the first play state and the arrival never came; details in the comment of 18 Nov), so there is no number and no quiet verdict, not a result of the machine being loud. A repaired driver is being rehearsed; the timing is queued again and this table is filled in a dated update. A first look from the diagnostic runs is in the comment of 18 Nov (the texture pass's own time per frame, 0.19 ms before #1462 and 0.16 ms with it, ordinary runs, no speed claim). Hardware: Linux, RTX 4090, NVIDIA 615.78.08, i9-13900K, 96 GB; the walk is an ordinary run, the timing runs are exclusive holds under the quiet rule Scene: Hyrule Field (child) for the timing, Kokiri Forest and Hyrule Field with area changes for the walk; DLAA 2048x1152 Method: the frame trace (`RX_VK_FRAME_TRACE=1`): `tex_frame_ms` (the texture pass's own time) and the frame times of the window, main, head, main, head in one hold, two holds in all; the walk samples the game's own log lines How to reproduce: the workbench's paired timing hold with the field-walk scenario and its lap script; the commands are under How it was tested | | Before: main @ 93bc8a7fb | After: this PR @ 5f83ff7c7 | |---|---|---| | `tex_frame_ms`, mean and p99 of the window | not measured yet (the night's timings were invalid: no window) | not measured yet (the night's timings were invalid: no window) | | frame time, mean and p99 of the window | not measured yet (the night's timings were invalid: no window) | not measured yet (the night's timings were invalid: no window) | | what #1462 itself cost: main @ 415a8944c (before) against main @ 93bc8a7fb (with it), same two rows | not measured yet (the night's timings were invalid: no window) | not measured yet (the night's timings were invalid: no window) | ### A walk of 16 minutes at a simulated 6 GB allowance (a 24 GB card, not an 8 GB card) The game is the build of this change's first form (`5f83ff7c7`: main @ 93bc8a7fb and the six commits), `RX_VK_TEST_ALLOWED_MB=6144` (the renderer sees a 6144 MB allowance on the 24 GB RTX 4090), windowless, a child-Link save in Kokiri Forest. The lap script's laps: teleport to Hyrule Field, walk a planned route for 6000 game presents, teleport back, with a lap's end sampled; it ran 989.7 s of wall time and 44,708 presents (6 laps; the machine was busy at the start, load 69 falling to 12, so the game ran at about 20 to 45 frames a second: an ordinary run, no speed claim). Exit 0, fatal 0, crash 0, device lost 0, kernel Xid/NVRM lines 0 (journal coverage complete), no "ran without a core" lines. | minute | render-target images | kept finalized (n) | VRAM used by the renderer, MB (of 6,144) | process RSS, MB | |---|---|---|---|---| | 2 (arrival, Kokiri Forest) | 93 | 3 | 4,628 | 13,428 | | 3 | 150 | 37 | 4,984 | 14,520 | | 4 | 180 | 41 | 5,314 | 13,283 | | 5 | 163 | 31 | 5,410 | 13,053 | | 6 | 151 | 54 | 4,866 | 12,025 | | 7 | 181 | 52 | 5,376 | 7,847 | | 8 | 142 | 66 | 5,226 | 7,553 | | 9 | 179 | 71 | 5,198 | 7,174 | | 10 | 155 | 63 | 5,418 | 7,358 | | 11 | 164 | 64 | 5,194 | 8,137 | | 12 | 201 | 52 | 5,504 | 6,536 | | 13 | 151 | 61 | 5,514 | 6,350 | | 14 | 142 | 70 | 5,134 | 6,554 | | 15 | 146 | 64 | 5,130 | 6,353 | | 16 | 142 | 64 | 5,450 | 6,247 | | 17 | 208 | 54 | 5,312 | 6,125 | At the lap ends (0 to 6): render-target images 93, 126, 140, 165, 138, 142, 208; kept finalized targets 3, 51, 63, 77, 70, 70, 54. So after the first laps the images move between 126 and 208 and the kept targets between 51 and 77, with no steady rise; the renderer's VRAM stays between 4.6 and 5.5 GB (one lap-end sample reads 6,226 MB, 82 MB over the 6,144 MB allowed) and the process's RSS falls from 13.4 GB to 6.1 GB. The last sample (208 images, minute 17) is the highest of the series: I do not know whether that is the start of a rise or a one-off, and there is no main beside this walk, so this is "no growth beyond a band in 16 minutes", not a proof of a plateau and not a comparison with main (that comparison is #1462's, on its laps). The retired lines of the walk sum to 32,093 textures: budget 25,318, drawn over 1,962, dead targets 4,403, rewritten by the game 410, so the new reason shows and the terrain tiles are still let go under the narrowed rule. Pictures: 10 taken while walking and 11 at the ends of laps and legs, looked at as contact sheets (320 x 180 tiles): the ground, grass, rock faces, a path and a cliff draw normally; no streaks along edges, black patches or missing tiles at that size. The last lap ended with the teleport back refused ("an event is playing": a character's text box was on screen in the last walking picture), so lap 6 ends in Hyrule Field. A subtle streak would not show at this size; a closer look by a person is under Must be tested. In the dark passage out of Kokiri Forest a row of small white flecks shows on the ground; a walk on main before #1462 (`415a8944c`, with counters only) shows the same flecks at the same spot, so they do not come from this change. ![Four of the walk's pictures on this head at the 6 GB allowance, from lap 2 to the last minutes: grass, rock faces, the fence and the far field draw normally.](https://git.magicbean.dev/attachments/77ad37f5-81b5-4352-912a-761321231bba) What an earlier pair on the pre-rebase twin of #1462's review head (`4cd44a7a3`: #1462 and these six patches over main @ 645d58e68) showed for the retired line: a 375 s walk summed to budget 12,187, drawn over 434, dead targets 990, rewritten by the game 144, against main's 9,898, 1,147 and 538 with no such column; that pair was not route-matched (229 m against 92 m in lap 1) and is not used for the leak, which #1462's own runs showed. ### A walk of 9 minutes on this head, at the same allowance The same route and setting on `761394e7d` itself (the game logs `v3.0.0-rc.7-67-g761394e7d`), a full build over main @ 310e7c9df: 555 s, 22,578 presents, 3 laps; exit 0, no fatal, crash, device-lost, kernel or NVRM line. Render-target images moved between 98 and 170 by minute and read 107, 143 and 156 at the lap ends; kept finalized targets rose from 22 to 87 by minute 10, the same shape as the first 10 minutes of the 16-minute walk (3 to 77); the new retire reason fired 180 times in 13,339 retirements. The walk and lap pictures, looked at as a contact sheet, draw normally (ground, grass, rock faces, caves); the white flecks in the dark passage are the ones main shows. Ten minutes say nothing about a plateau either way: this is the game run of this head, not a leak measurement. ### The Test Farm's three reports on #1462 and the review's reading The Test Farm ran field-retention on #1462's head (1c09f9d12) against its base: one game start a side, a 20 s field window, the 60 fps cap. RTX 4070: field p99 18.27 to 23.19 ms (+26.9 %, over the 20 % rule, failed). RX 9070 XT: 19.93 to 20.63 (+3.5 %, passed). RTX 3070 8 GB: 19.88 to 19.89 (+0 %, passed). The sticky's median over the two Windows reports it counted was +15 %, and the farm marked the 4070's report as disagreeing with its peers. HumanBean's reading (review 1690) is that this is noise, not the change: main's side of the 4070 run was unusually smooth (field max 20.7 ms against 47 to 88 ms on main for the other PCs), p50 did not move (16.67 to 16.62), there were no stutters or hitches on either side, the other two PCs do not show it, field VRAM is flat on all three (+0 % to +1.7 %), and the work added per pass is tens of microseconds. I find that consistent with what the three reports show, and I am not using it as a measurement: the direct checks are the paired `tex_frame_ms` above and a diagnostic run on my PC (not part of this PR; running now) that counts rendered textures let go and made again within 30, 120 and 600 frames on the same field walk, main before and with #1462, next to the frame trace. Their numbers go into this description as a dated update. ### Flags and settings None. ## How it was tested Everything here was run by an AI agent (Claude Sonnet 5.5) working for me; commands are given so anyone can rerun them. The tools are the repository's own game-free tests and, for the game runs, the workbench's (https://github.com/mooki000/ls-workbench: the run wrapper with its GPU gate, the scripted-play drivers over the control bridge described in https://git.magicbean.dev/MagicBeanDev/Longshot/src/branch/main/docs/control.md, the regression worker's paired timing hold and the idle-class test gate). 1. **Red first, three times.** `python -I -B tests/test_target_retention.py` cuts, by their text, `texture_frame`'s choice of which textures go and `finalized_obsolete()` out of `gpu/vk/vk_texture.cpp` (`tests/srccut.py`), compiles them with stand-ins for the Texture fields they read, and runs 30 laps of 60 render targets the size of the terrain tiles (260 x 260 RG8, nine levels, 176 KB of texels, 325 KB as the allocator gives it), each drawn once, finalized, never used again, with the game writing over a lap's storage two laps on (all of it, a quarter, half, three quarters, or a 16 KB texture); the write-back is `drawn_writeback.h`'s own `noted` and `kFrames`. Each test commit was run on the commit before it: | Point | Test commit | Result before its fix | Fix commit | Result after | |---|---|---|---|---| | three quarters only where the rest is in memory | `fd954e25d` | two cases fail: one level, and over 1 MB, three quarters written over: must stay | `337f9cdf1` | pass | | a reason of its own | `1bcb62b92` | `test_evict_reason.py` no longer finds the new `classify` call; the fixture does not compile (no `obsolete` member of `Evict`) | `a1022ad7b` | both pass | | once per texture per pass | `750dffe9a` | a texture's written runs are read at most 4 times in a pass, within the budget and over it: 2 cases fail | `761394e7d` | pass: at most 1 time | Each fix was also broken on purpose in a copy of the tree and the test failed every time: the first with the old rule (always three quarters), with always all of the storage ("three quarters is" fails) and with the condition inverted; the second with the pass handing the flag back as drawn over ("each went as obsolete" fails); the third without the memo (the read count is four) and with a memo that never expires (five cases fail). 2. **The neighbours.** `test_evict_reason.py`, `test_readback_timeout_reuse.py`, `test_vram_compact.py` and `test_drawn_writeback.py`, which also cut `texture_frame`, pass on the rebased head. 3. **Whole suite and Windows syntax**, on the build of the first form (`5f83ff7c7`, over main @ 93bc8a7fb). `python -I -B tests/run_all.py --jobs 6 --strict` through the workbench's idle-class gate (the idle wrapper, three slots, core dumps off, a fresh HOME): 675 passed, 38 failed, 17 skipped. Compared by name with main: 37 of the 38 are in the list of the earlier whole-suite run of main @ 645d58e68, and the 38th, `test_log_open_failure.py`, is a test main added since; run alone on main @ 93bc8a7fb it fails the same way (its C fixture does not compile with this PC's gcc and `-Werror`). `test_crash_record.py`, which failed on main @ 645d58e68, passed in this run. I did not run the whole suite on main @ 93bc8a7fb. The workbench's Windows fixture check (llvm-mingw `ucrt-x86_64`) compiles the changed C++ fixtures for the Windows target: PASS, 2 translation units, 0 failures, 0 unjudged. It is a syntax check, not a Windows run. 4. **The walk.** The game was driven over the control bridge by the lap script of the workbench's scripted-play drivers: it starts the game through the run wrapper with a save and the allowance switch, teleports to Hyrule Field, follows a planned route with the left stick (the position and camera from the bridge's status give the stick's angle), teleports back, and samples every 4 s the process's memory from `/proc`, the card's memory from `nvidia-smi` and the newest values of the renderer's own log lines (image blocks of the render targets, finalized textures kept, VRAM, textures, the retired line), with a picture of the game's frame every 90 s of walking. The table takes the last value of each line before a minute's mark; the numbers come from the run's `samples.csv` through a small script, nothing is averaged. 5. **Still to run on my PC:** (a) done: the diagnostic counting of let-go-then-remade targets, main before and with #1462 (ordinary runs; the result is in the comment of 18 Nov); (b) the paired exclusive timing, now split over two holds (main then head, head then main, so each side runs twice; 225 s windows on the field walk; the quiet rule: mean other work under 3 cores, highest 5 s under 6, same-arm repeats within 5 %), reading the frame trace's `tex_frame_ms` and the p99 of each window. A run that is not quiet is kept and said, not averaged away. ## Testing **Tested:** on my own PC. On this head `761394e7d` (on main @ 310e7c9df): the five focused tests and a 9-minute walk in the game at a simulated 6 GB allowance (Measurements). On its first form `5f83ff7c7` (on main @ 93bc8a7fb; `git range-diff`: the same six patches): the three red-first tests and their fixes, the four neighbouring tests, the whole suite by name against main, the Windows-target syntax check, the Linux build, and the 16-minute walk. **Not tested:** the cost of the texture pass (the night's timings were invalid; queued again); whether the Windows field p99 of the Test Farm's 4070 report is real (the review's reading is noise; the Linux diagnostic of the comment of 18 Nov fits that reading, and the paired timing is queued again); the whole suite on this head itself (it ran on the first form); Windows execution of the changed C++ fixtures; a real 8 GB card and a 20-minute walk on it; AMD and Intel GPUs. **Must be tested:** - Windows, any GPU: the Test Farm's field-retention plan with at least 3 game starts a side on the RTX 4070 (the review suggests `runs: 3`), expecting field p99 within 20 % of main (Test Farm: field-retention on windows). - An 8 GB or smaller card, any OS: walk Hyrule Field for 20 minutes and return to Kokiri Forest, expecting no empty or striped ground tiles and the "image blocks (render targets)" images not climbing (Test Farm: vram8gb, or by hand: look at the ground and read the log lines). ## Risks **What could break:** the rule now lets go of less than #1462's did (a one-level or over-1 MB target needs all of its storage rewritten), so it can only keep a texture longer, not drop one earlier; the terrain tiles still go at three quarters. The log line has one more field at its end, so a script that matched the whole line, not its first three columns, would need the new column. **Cost:** the check reads a texture's written ranges once per pass now (it was up to four times), and returns before reading for anything that is not a released, GPU-drawn pool texture of 32 KB or more; the memo adds two fields to `Texture`. Measured: not yet. The night's paired timings were invalid (no measuring window), so the cost of the pass is still unmeasured; the diagnostic runs show 0.16 to 0.19 ms a frame for the whole pass on both sides (ordinary runs, no speed claim) and the same upload and destroy mix in the slowest 1 % of frames, which is why I expect the difference to be small, but that is an expectation, not a measurement. **Turning it off:** revert the commits. **Compatibility:** the "textures retired" log line has one more field; nothing else changes. ## Issues Follows #1462. Refs #1443. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [ ] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. Not ticked yet: the texture pass's own time (`tex_frame_ms`) is not measured; the night's paired timings were invalid (no measuring window) and are queued again. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main` (main @ 310e7c9df; merges with main @ a6c8ed570 without a conflict). - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named): 38 tests fail, all of them failures of main: test_bug_report_defaults.py, test_cpu_report.py, test_crt_options.py, test_damage_debug_menu.py, test_display_startup_failure.py, test_dlss_feature_size.py, test_failed_compile_keeps_objects.py, test_framegen_preset.py, test_fsr_uniform_ownership.py, test_guest_imported.py, test_hud_layout_row.py, test_import_reach.py, test_invalidate_vcore.py, test_linux_preflight.py, test_linux_pressure.py, test_linux_update.py, test_log_open_failure.py, test_mirror_budget.py, test_missing_nup.py, test_mods_size_table.py, test_nonuniform_image_arrays.py, test_parallel_init_order.py, test_pending_guest_import.py, test_pipeline_play_cache.py, test_present_thread.py, test_profiling_mode.py, test_readback_timeout_source.py, test_replay_write_order.py, test_rumble_menu.py, test_run_all_changed.py, test_slow_frames.py, test_staging_burst.py, test_target_image_pool.py, test_upscaler_round_trip.py, test_upscaler_rows.py, test_vcore_escape.py, test_vk_occlusion_queries.py, test_walk_key.py. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened (`tests/test_evict_reason.py` follows the new `classify` call; nothing removed). - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths (the Windows-target syntax check of the changed fixtures passed; the renderer change is plain C++ the Linux build compiled). --- New on this forge; not opened on GitHub.
Review of #1462: drawn_writeback.h puts only a texture with a mip chain and up to 1 MB into guest memory after the GPU drew it. A finalized
single-level target, or one over 1 MB, whose storage the game wrote over by three quarters has its remaining quarter only in its image;
made again over that storage it would come from memory that never held its texels. The fixture now models the write-back with the header's
own `noted` and `kFrames` (written_back_for) and runs both kinds: three quarters must keep them, all of the storage must let them go.
Red on the previous commit: the two "stays" cases fail.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Review of #1462: finalized_obsolete let a finalized target go once the game wrote over three quarters of its storage. Only a texture
drawn_writeback.h covers (a mip chain, up to 1 MB) has the rest in memory (written_back_for == last_written). A single-level target or one
over 1 MB had the quarter only in its image: made again it would be filled from memory that never held its texels, where before #1462
it stayed in the kept image within the budget. Those now go once all of their storage is written over. The terrain tiles the rule was
measured on are covered by the write-back and keep the three quarters line.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Review of #1462: the pass passed `overwritten || obsolete` as one flag, so evict_reason::classify counted these textures as DRAWN_OVER
in the "textures retired" line though nothing drew over them. The tests now expect a fourth reason, OBSOLETE, classify taking whether the
texture is obsolete, the line's "rewritten by the game N" after the existing three, and the retention fixture's pass to mark each tile it
lets go of within the budget as obsolete. Red on the previous commit: the pass has no such flag and evict_reason.h no such reason.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Review of #1462: texture_frame handed `overwritten || obsolete` to evict_reason::classify, so the "textures retired" line counted these
textures as DRAWN_OVER, a drawing that never happened. evict_reason has a fourth reason, OBSOLETE, classify takes whether the texture is
obsolete, and the line reads "budget N, drawn over N, dead targets N, rewritten by the game N" (the first three unchanged, so a reader
keyed on that prefix still works; the buffer for the line grows from 160 to 192 bytes). The Evict record carries the flag; the lost-texels
rule still treats an obsolete texture as one with nothing left to keep.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Review of #1462: finalized_obsolete walks a texture's page generations; the kept count's keep_finalized, the choice's own `obsolete`
and the keep_finalized call after it (and the log line every 600 presents) each ran it again for the same texture in the same pass. The
fixture's memory_written_runs now counts the calls per storage and pass, and a pass with nothing to let go of (half of every tile's
storage written over, within the budget and over it) must make one. Red on the previous commit: the most any one tile's runs are read in
a pass is four.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
perf(vk): finalized_obsolete answers once per texture per pass
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
PR description / Description follows the template (pull_request_target) Successful in 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 20s
5f83ff7c72
Review of #1462: when `obsolete` was false in the choice, keep_finalized ran finalized_obsolete again, and the kept count and its log
line ran it once more for every kept finalized texture on every pass: each a walk of the texture's page generations (about 50 lookups for
a terrain tile), up to four per tile and pass. The answer is now kept in the texture with the pass it was made for (obsolete_pass, the
frame_no the pass runs under), so it is asked once; the cheap checks stay in front of the memo, so a texture that is not finalized or is
small is not written to. keep_finalized takes the texture non-const for it. The fixture's stand-in has the two fields and the test's
marker no longer names the parameter.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Member

Pushed the rebased head, 761394e7d on main @ 310e7c9df (it merges with today's main @ a6c8ed570 without a conflict). git range-diff against the earlier head 5f83ff7c7 (on 93bc8a7fb) shows all six patches identical; only the base moved.

This head had its own game run before the push: a 9-minute walk on the same route and setting as the 16-minute one (a simulated 6 GB allowance on a 24 GB card), a full build over 310e7c9df. Exit 0, no fatal, crash, device-lost, kernel or NVRM line; render-target images between 98 and 170 by minute; the new retire reason fired 180 times; the pictures draw normally. The details are in the description's new "A walk of 9 minutes on this head" section, and the Rebased box is now ticked.

Still open, as before: the cost of the texture pass (paired timing tonight, after 22:00, under the quiet rule) and the "Nothing gets worse" box that waits on it. The guide-screenshot check is red on main itself; #1501 fixes main, and once it merges I add a docs-only commit here with the review line for gpu/vk/vk_texture.h (two data members the Graphics view never draws). A docs-only commit leaves the built game identical, so this walk stays the run of the code.

New on this forge; not opened on GitHub.

Pushed the rebased head, `761394e7d` on main @ 310e7c9df (it merges with today's main @ a6c8ed570 without a conflict). `git range-diff` against the earlier head `5f83ff7c7` (on 93bc8a7fb) shows all six patches identical; only the base moved. This head had its own game run before the push: a 9-minute walk on the same route and setting as the 16-minute one (a simulated 6 GB allowance on a 24 GB card), a full build over 310e7c9df. Exit 0, no fatal, crash, device-lost, kernel or NVRM line; render-target images between 98 and 170 by minute; the new retire reason fired 180 times; the pictures draw normally. The details are in the description's new "A walk of 9 minutes on this head" section, and the Rebased box is now ticked. Still open, as before: the cost of the texture pass (paired timing tonight, after 22:00, under the quiet rule) and the "Nothing gets worse" box that waits on it. The guide-screenshot check is red on main itself; #1501 fixes main, and once it merges I add a docs-only commit here with the review line for `gpu/vk/vk_texture.h` (two data members the Graphics view never draws). A docs-only commit leaves the built game identical, so this walk stays the run of the code. New on this forge; not opened on GitHub.
mooki force-pushed fix/finalized-target-review from 5f83ff7c72
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
PR description / Description follows the template (pull_request_target) Successful in 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 20s
to 761394e7d9
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 16s
Third-party parts / As their notes say (pull_request) Successful in 18s
PR description / Description follows the template (pull_request_target) Successful in 5s
2026-11-18 01:40:33 +00:00
Compare
Author
Member

Cost of the texture pass and the Test Farm's 4070 report: what I have, and what I do not

No timing number yet, and the box "Nothing gets worse" stays unticked. The two paired exclusive timings of the night (17 Nov, 22:37 to 22:41: main with #1462 against this PR's head, and main before #1462 against main with it) each ended after their first run with no measuring window. That is a fault of my walk driver, not a loud machine: no quiet verdict was computed for either, and no frame time exists. The driver teleported to Hyrule Field at the first play state; the game reported the teleport as sent, kept rendering Kokiri Forest at about 97 fps, and the arrival never came in the 48 s the run had left. All three runs that failed this way (a rehearsal and the two holds) were the first start of a game copy that had never been run, with a 62 s boot where a warm copy boots in 20 s; I also skipped the usual unmeasured warm-up. A rehearsal after a repair (12 s of walking in the save's own place before the teleport, none of it counted toward the window) on a warm copy arrived in 6 s and opened a window of 144 s with 10,014 frames. I cannot tell from these runs whether the settle walk or the warm copy did it; the next runs have both.

What the rehearsal shows (ordinary run, not a timing: the quiet rule flagged it, other work peaked at 6.1 cores). The texture pass's own time (the frame trace's tex_frame_ms) over the window: mean 0.162 ms, median 0.130 ms, p99 0.79 ms, longest 4.5 ms, against a mean frame of 14.4 ms: about 1 % of the frame. That says how big the thing I am measuring is, not what this PR changed.

The diagnostic runs (main before #1462 against main with it, two laps each, ordinary runs at load 10 to 30, a diagnostic build that is not part of this PR). The class the new rule adds to ("drawn over or obsolete") was let go 1,325 times before and 1,361 times with #1462 in runs of about 16,700 frames, and 795 against 841 of them came back as a new texture within 600 frames: the same 60 to 62 %. The slowest 1 % of frames spent the same mix (frames with an upload over 1 ms: 51 of 170 and 60 of 167; frames with textures destroyed: 51 and 52). The pass's mean time per frame was 0.190 ms and 0.159 ms. I find no sign that targets let go as obsolete are made again soon in numbers that could move a field p99. That fits the reading of the review that the 4070 report is noise; it is Linux and one run a side, so it does not measure that Windows PC.

What would let me tick the box. Two exclusive holds under the quiet rule, 225 s runs, main with #1462 (93bc8a7fb) and this PR's head (the timed build is 5f83ff7c7, six patches identical to the pushed 761394e7d by git range-diff, on the same base 93bc8a7fb): one hold main then head, the other head then main, so each side runs twice and the order is balanced over the two holds (a 480 s hold cannot hold four runs of this length; the quiet rule's usual one-hold A B A B does not fit). I will tick the box only if both holds are valid and quiet and the difference in tex_frame_ms and in p99 is within the spread between the two runs of the same side; if a hold is not quiet I will say so here and give no number. A warm-up of the main copy is queued before them; the holds wait for the machine's night window (22:00). The numbers, valid or not, go here as a dated update.

### Cost of the texture pass and the Test Farm's 4070 report: what I have, and what I do not **No timing number yet, and the box "Nothing gets worse" stays unticked.** The two paired exclusive timings of the night (17 Nov, 22:37 to 22:41: main with #1462 against this PR's head, and main before #1462 against main with it) each ended after their first run with no measuring window. That is a fault of my walk driver, not a loud machine: no quiet verdict was computed for either, and no frame time exists. The driver teleported to Hyrule Field at the first play state; the game reported the teleport as sent, kept rendering Kokiri Forest at about 97 fps, and the arrival never came in the 48 s the run had left. All three runs that failed this way (a rehearsal and the two holds) were the first start of a game copy that had never been run, with a 62 s boot where a warm copy boots in 20 s; I also skipped the usual unmeasured warm-up. A rehearsal after a repair (12 s of walking in the save's own place before the teleport, none of it counted toward the window) on a warm copy arrived in 6 s and opened a window of 144 s with 10,014 frames. I cannot tell from these runs whether the settle walk or the warm copy did it; the next runs have both. **What the rehearsal shows (ordinary run, not a timing: the quiet rule flagged it, other work peaked at 6.1 cores).** The texture pass's own time (the frame trace's `tex_frame_ms`) over the window: mean 0.162 ms, median 0.130 ms, p99 0.79 ms, longest 4.5 ms, against a mean frame of 14.4 ms: about 1 % of the frame. That says how big the thing I am measuring is, not what this PR changed. **The diagnostic runs (main before #1462 against main with it, two laps each, ordinary runs at load 10 to 30, a diagnostic build that is not part of this PR).** The class the new rule adds to ("drawn over or obsolete") was let go 1,325 times before and 1,361 times with #1462 in runs of about 16,700 frames, and 795 against 841 of them came back as a new texture within 600 frames: the same 60 to 62 %. The slowest 1 % of frames spent the same mix (frames with an upload over 1 ms: 51 of 170 and 60 of 167; frames with textures destroyed: 51 and 52). The pass's mean time per frame was 0.190 ms and 0.159 ms. I find no sign that targets let go as obsolete are made again soon in numbers that could move a field p99. That fits the reading of the review that the 4070 report is noise; it is Linux and one run a side, so it does not measure that Windows PC. **What would let me tick the box.** Two exclusive holds under the quiet rule, 225 s runs, main with #1462 (93bc8a7fb) and this PR's head (the timed build is 5f83ff7c7, six patches identical to the pushed 761394e7d by `git range-diff`, on the same base 93bc8a7fb): one hold main then head, the other head then main, so each side runs twice and the order is balanced over the two holds (a 480 s hold cannot hold four runs of this length; the quiet rule's usual one-hold A B A B does not fit). I will tick the box only if both holds are valid and quiet and the difference in `tex_frame_ms` and in p99 is within the spread between the two runs of the same side; if a hold is not quiet I will say so here and give no number. A warm-up of the main copy is queued before them; the holds wait for the machine's night window (22:00). The numbers, valid or not, go here as a dated update.
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 16s
Third-party parts / As their notes say (pull_request) Successful in 18s
PR description / Description follows the template (pull_request_target) Successful in 5s
This pull request has changes conflicting with the target branch.
  • gpu/vk/vk_texture.h
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/finalized-target-review:mooki-fix/finalized-target-review'
git switch 'mooki-fix/finalized-target-review'
Sign in to join this conversation.
No reviewers
No milestone
No project
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.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1489
No description provided.