perf(vk): branchless cmov wb_learn, SIEVE texture eviction, and size-class VRAM pools #2810
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2810
Loading…
Reference in a new issue
No description provided.
Delete branch "siantm/Longshot:perf/sieve-wblearn-vram-pools"
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?
Summary
Three targeted Vulkan renderer & VRAM performance improvements grounded in recent CS systems research:
cmovflat interval table forwb_learn(gpu/vk/wb_learn.h): Replacesstd::mapred-black tree nodes with sorted contiguousstd::vectors and an explicit x86-64cmovbe/cmovbbranchless binary search, cutting lookup latency 2.88× (61.97 ns→21.54 ns) insidevk_memory.cpp's hot mutex.gpu/vk/sieve_evict.h,gpu/vk/vk_texture.h,gpu/vk/vk_texture.cpp): Adds a 1-bytesieve_visitedflag perTexture(0 on initial upload, set to 1 on cross-frame reuse). Eviction passes order unvisited one-hit streaming textures ahead of revisited working-set textures, preventing transient streaming textures from evicting hot terrain/character textures.gpu/vk/vram_size_class.h,gpu/vk/vk_vma.cpp): Segregates small/medium sampled textures (≤ 512 KB) into a dedicated 32 MB-block VMA pool (texture_small_pool) separate from the large-texture pool (texture_pool), reducing internal fragmentation and keeping large blocks clean and reclaimable.Reviewers should read
gpu/vk/wb_learn.h,gpu/vk/sieve_evict.h,gpu/vk/vram_size_class.h, and the small call-site integrations ingpu/vk/vk_texture.cppandgpu/vk/vk_vma.cpp.Testing
Tested:
HOS_FPS_MAX=1000):A1..A3vsB1..B3) viadev.py ab --scene hyrule-field— ran cleanly with zero crashes, verifiedvk: textures from size-class pools: large 32 MB blocks (12 at start), small <=512 KB in 32 MB blocksin logs.A1..A2vsB1..B2) viadev.py ab --scene market— ran cleanly with zero crashes; per-framediagnostics/logs/longshot_frames.csvverified.clang++ -O3 -std=c++17 -march=native:tests/test_wb_learn.cpp:wb_learn: oktests/test_sieve_and_size_class.cpp:sieve_and_size_class: okmain @ b6d274d77(8c39108b8):tests/test_wb_learn.py,tests/test_vram_compact.py,tests/test_sieve_and_size_class.py,tests/test_memory_priority.py,tests/test_mem_account.py,tests/test_evict_reason.py,tests/test_keep_rendered.py,tests/byte_compile_tracked.pyall pass;clang++ -std=c++20 -fsyntax-onlyclean onvk_texture.cpp,vk_vma.cpp,vk_memory.cpp.Still to test:
@Beanstalkor by hand).mise run testsuite on Linux and Windows (CI / by hand).Measurements
Verdict: Clear positive in-game gain — +4.80 fps (+6.4%) median and +6.1 fps (+8.6%) warm min FPS in Hyrule Field, +3.27 fps (+6.7%) 1% lows in Market, and ~10 GB lower process private commit, plus 2.88× faster
wb_learn::covered()in microbenchmarks.Setup: Windows x86-64, NVIDIA 621.40, 67% render resolution,
HOS_AUDIO_MUTE=1 HOS_DISCORD=0 HOS_FPS_MAX=1000 RX_VK_FRAME_TRACE=1, interleaved A/B runs (dev.py ab).Hyrule Field (Child, 3 interleaved pairs, tail-15 steady-state samples)
main@01d6878b989bba4eA3vsB3)A2/A3)B1)Market (Child, per-frame
diagnostics/logs/longshot_frames.csv, last 2,000 steady-state frames)main@01d6878(A2)B2)A1vsB1)Microbenchmarks (x86-64,
clang++ -O3 -march=native)wb_learn::covered()(4,096 ranges, 2M queries)std::map)cmovbe)Risks
vram_size_classcreates one additional VMA pool (texture_small_pool, 0 blocks pre-allocated at start) using the same memory type astexture_pool;textures_pool_usage()sums both pools sovram_compact.handmem_account.hbudgets remain accurate.longshot_options.ini, or shader/pipeline caches.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Windows x86-64, NVIDIA 621.40, 67% render res: Hyrule Field (Child, 3 interleaved A/B pairs) +4.80 fps median (+6.4%, 80.10 vs 75.30 fps), +6.1 fps warm min (77.4 vs 71.3 fps), ~10 GB lower private commit (16.3 vs 25.9-26.8 GB); Market (Child, 2 interleaved A/B pairs) +3.27 fps 1% lows (+6.7%, 52.19 vs 48.92 fps); zero crashes.
Possibly related, for context:
@beanstalk
@review
Beanstalk test farm · an earlier run: commit
989bba4(the newer results are in a comment below)Commit
989bba4· approved by HumanBean (reviewed) · dashboard⚠️ Note: The farm measures peak VRAM and process memory, not allocator fragmentation, private commit, cache hit rate or the claimed microbenchmark speedups; the constrained budget does not guarantee eviction occurs.
⚠️ Note: The diff defines second-chance decay but does not show a call to it in the texture eviction integration; these gameplay measurements cannot establish that survivor decay works.
⚠️ Note: The full Linux and Windows test suite is outside this gameplay plan.
Started at 18:37 UTC.
Estimate: done in about 13 h 30 min, from the queue and the testers online now; some jobs can't start yet.
nvidiawindows+nvidiawindows+amdlinux+radvinteligpuvram4-8gb(4 to 8 GB VRAM)texture-streaming· frame time p99 (ms), main → PR at each levelvram_budget=0(reference)vram_budget=1nvidiawindows+nvidiawindows+amdlinux+radvinteligpuvram4-8gb(4 to 8 GB VRAM)Couldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
nvidia, report 1:no scenario could be judged: this PC's Insert menu has no vram_budget rownvidia, report 2:no scenario could be judged: this PC's Insert menu has no vram_budget rowwindows+nvidia, report 1:no scenario could be judged: this PC's Insert menu has no vram_budget rowlinux+radv, report 1:no scenario could be judged: this PC's Insert menu has no vram_budget rowlinux+radv, report 2:no scenario could be judged: this PC's Insert menu has no vram_budget rowigpu, report 1:no scenario could be judged: this PC's Insert menu has no vram_budget rowigpu, report 2:no scenario could be judged: this PC's Insert menu has no vram_budget rowWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)The plan compares the PR with main on NVIDIA, AMD, Intel, integrated and 4–8 GB GPUs, including Windows AMD and Linux RADV. Three starts per side visit Hyrule Field, Kokiri Forest and Market, with stationary screenshot comparisons and moving routes followed by 20-second frame-time and memory measurements. Automatic and 2.2 GB VRAM budgets exercise normal operation and increased eviction pressure; each tester’s run takes approximately 45 minutes. Crashes, substantial frame-time or VRAM regressions, or screenshot differences beyond the tolerance fail the PR.
0or1.castle-gate, then teleport to Hyrule Field, take the picture field to compare with main, move the stick, measure field for 20 s (after 5 s warm-up), teleport to Kokiri Forest, take the picture forest to compare with main, measure forest for 20 s (after 5 s warm-up), teleport to Market, take the picture market to compare with main, measure market for 20 s (after 5 s warm-up); 3 runs on each side for each of 2 cells (1 game start a run).Measurements on `nvidia`, for the PR description
Verdict: could not be judged on nvidia (2 reports).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess
NVIDIA GeForce RTX 4090, 621.40.013th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 4070 Ti SUPER, 621.14.0AMD Ryzen 7 7800X3D 8-Core Processor, 32 GB RAMScene: texture-streaming, from the repository's save castle-gate; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); texture-streaming: 3 game starts a side, field 20 s after 5 s warm-up, forest 20 s after 5 s warm-up, market 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
vram_budget0,1As Markdown for the PR description:
Measurements on `windows+nvidia`, for the PR description
Verdict: running on windows+nvidia (1 report).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 3090, 621.1.0AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAMScene: texture-streaming, from the repository's save castle-gate; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); texture-streaming: 3 game starts a side, field 20 s after 5 s warm-up, forest 20 s after 5 s warm-up, market 20 s after 5 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
vram_budget0,1As Markdown for the PR description:
Measurements on `linux+radv`, for the PR description
Verdict: could not be judged on linux+radv (2 reports).
Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAMScene: texture-streaming, from the repository's save castle-gate; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); texture-streaming: 3 game starts a side, field 20 s after 5 s warm-up, forest 20 s after 5 s warm-up, market 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
vram_budget0,1As Markdown for the PR description:
Measurements on `igpu`, for the PR description
Verdict: could not be judged on igpu (2 reports).
Hardware: 1: linux+amd+radv+igpu
AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM; 2: linux+amd+radv+igpuRadeon 8060S Graphics (RADV STRIX_HALO), 26.0.8AMD RYZEN AI MAX+ PRO 395 w/ Radeon 8060S, 128 GB RAMScene: texture-streaming, from the repository's save castle-gate; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); texture-streaming: 3 game starts a side, field 20 s after 5 s warm-up, forest 20 s after 5 s warm-up, market 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
vram_budget0,1As Markdown for the PR description:
The testers' hardware
nvidiaNVIDIA GeForce RTX 4090, 621.40.013th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAMnvidiaNVIDIA GeForce RTX 4070 Ti SUPER, 621.14.0AMD Ryzen 7 7800X3D 8-Core Processor, 32 GB RAMwindows+nvidiaNVIDIA GeForce RTX 3090, 621.1.0AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAMlinux+radvAMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAMlinux+radvAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAMigpuAMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAMigpuRadeon 8060S Graphics (RADV STRIX_HALO), 26.0.8AMD RYZEN AI MAX+ PRO 395 w/ Radeon 8060S, 128 GB RAM989bba4e228c39108b8eBeanstalk test farm
Commit
3397c60· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.WIP: perf(vk): branchless cmov wb_learn, SIEVE texture eviction, and size-class VRAM poolsto perf(vk): branchless cmov wb_learn, SIEVE texture eviction, and size-class VRAM poolsRebased onto
main @ b6d274d77->8c39108b8and taking out of WIP:tests/test_vram_compact.pyfortextures_pool_for(ci).tests/test_sieve_and_size_class.pysotests/run_all.pyrunstests/test_sieve_and_size_class.cpp.Post-rebase verification (Windows 11,
llvm-mingw clang 23):tests/test_wb_learn.py,tests/test_vram_compact.py,tests/test_sieve_and_size_class.py,tests/test_memory_priority.py,tests/test_mem_account.py,tests/test_evict_reason.py,tests/test_keep_rendered.py,tests/byte_compile_tracked.py: all passed.clang++ -std=c++20 -fsyntax-onlypassed ongpu/vk/vk_texture.cpp,gpu/vk/vk_vma.cpp, andgpu/vk/vk_memory.cpp.Local test of
989bba4e(this PR) on Linux, RTX 3090 (driver 620.70.06), Vulkan, 67% render resolution,main@01d6878bas the base.Passed
tests/test_wb_learn.py:wb_learn: oktests/test_sieve_and_size_class.cpp(g++ -O2 -std=c++17):sieve_and_size_class: oktests/test_menu_ini_keys.py: PASSvk: textures from size-class pools: large 32 MB blocks (24 at start), small <=512 KB in 32 MB blocks. 0 pipeline waits in the measured frames.Measurement: one pair only, so not a result.
dev.py ab --scene hyrule-fieldcould not read the frame trace of its four runs: this base writesdiagnostics/logs/longshot_frames.csvandscripts/devtools/ab.pylooks inlogs/. Each run overwrites the file, so only the last run (A2 and B2) was left to read by hand, last 2,000 frames:main(A2)The average and median are the same within noise (the scene is probably GPU-bound here). The lows are higher with the PR, but this is a single pair; the 5,000-frame window gives 1% low 104.3 vs 123.8. It needs interleaved repeats to call. I did not see the +6% fps the description reports on Windows.
Not tested: AMD and Intel, 4 to 8 GB cards under eviction pressure, Windows, the full
mise run test.Update: CPU-bound runs, 1080p native. Same
989bba4e, same machine (Linux, RTX 3090, driver 620.70.06). Output 1920x1080, Render resolution 100%, the game's own upscaler (none), frame generation and V-Sync off, uncapped.dev.py ab --scene hyrule-field, 2 interleaved pairs, 45 s measured each, after a warm-up. Basemain@01d6878b.B is above A in both pairs, on fps, 1% low and p99. Caveat: A1 (112.4) is 8% below A2 (121.7) with the same build, so the first pair carries start-up drift; pair 2 is the cleaner one (+2.1%). Two pairs is a small sample.
Aggregate with the earlier run (67% render resolution, GPU-heavier, one pair read by hand: 140.2 vs 140.9 fps, +0.5%): three pairs, deltas +5.2%, +2.1%, +0.5%, mean +2.6%, never negative. The gain grows as the scene gets more CPU-bound (at 67% it was flat), which fits a CPU-side change. It is smaller than the +6.4% in the description (Windows, NVIDIA 621.40).
dev.py abwould not write its summary for this batch: it reported four turf options (sim_turf_*) as differing between A1 and B1 (A1 read "Load an area"). Every run started from the same options file, so I read this as a snapshot-timing quirk of the tool and used its per-run lines. The setup line shows the 1080p / 100% / game's-own-upscaler settings.@review
Recommendation: Request changes. The new eviction ordering breaks an age-based early exit, and the visited flag is accessed concurrently without synchronization. The small pool also falls outside the compaction that its free space triggers.
The change replaces write-back interval maps with sorted vectors, prioritizes texture eviction by reuse, and separates small textures into another VRAM pool. The combined change has promising NVIDIA results, but its eviction and compaction regressions need correction.
Blocking (3): must change before merging.
gpu/vk/vk_texture.cpp:6487: The new ordering is no longer globally ordered by age, but both eviction walks still stop at the first texture younger than need_dead. (more on the line) Do: Make both walks examine all eligible ages under the new ordering, and add a test with a young unvisited texture before an old visited victim.gpu/vk/vk_texture.cpp:5033: The new visited flag is read and written without synchronization on the parallel recording fast path. (more on the line) Do: Synchronize the visited and age updates and their readers, or collect reuse information per recording thread and merge it safely.gpu/vk/vk_vma.cpp:223: The compaction trigger counts free space in both pools, but image_compact_begin compacts only texture_pool. (more on the line) Do: Compact each pool using its own statistics and context, or keep small textures in the pool that the existing compactor handles.Should fix (1): not blocking, but worth doing before merging.
gpu/vk/vk_texture.cpp:6488: Visited textures never receive the documented second-chance decay: decay_survivor is only called by the unit test. (more on the line) Do: Clear the visited state for surviving candidates at the appropriate eviction pass, and test the integrated multi-pass behavior.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1, L2, L3 and L4.Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven for the current head and merge base. The description reports Hyrule Field median FPS rising from 75.30 to 80.10 on Windows NVIDIA over three pairs, but those runs used earlier commits. A Linux NVIDIA report found a 2.1% gain in its cleaner CPU-bound pair, with substantial run-to-run drift; neither result establishes the separate eviction or VRAM-pool gains under pressure.
Other systems: The texture paths affect both Windows and Linux and all Vulkan vendors, including Steam Deck. NVIDIA runs saw no crash, but AMD, Intel, Steam Deck and low-VRAM eviction pressure remain untested. The pool accounting also feeds the existing compaction and memory-budget logic.
Switches: None added, changed or removed.
Reviewed:
8c39108b8eagainstb6d274d779: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the commit and diff, the new headers and tests, and the changed code and relevant callers. Skimmed the large renderer files and test runner around the affected paths; did not read those files in full. docs/review-checklist.md and the sibling Tooling checkout were absent. Read the supplied comments and CI status.; nothing run (a code review).Checked and fine:
Testing: Review only; no code, tests or project scripts were run. CI was still running in the supplied status.
Overlaps and merge order: Not checked; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -5030,3 +5031,3 @@bool texture_touch_quick(Texture* tex, bool for_sampling) {if (tex->freed_listed || tex->reuse_retire) return false; // (texture_touch takes it out of the reuse list)tex->last_frame = frame_no; // (the same values whichever thread stores them)sieve_evict::touch(tex->sieve_visited, tex->last_frame, frame_no); // (the same values whichever thread stores them)L2 (blocking): The new visited flag is read and written without synchronization on the parallel recording fast path.
When: Two recording threads can resolve the same cached texture and enter texture_touch_quick together. Both access sieve_visited, including a write on cross-frame reuse, which is a C++ data race even when they intend to store the same value.
Do: Synchronize the visited and age updates and their readers, or collect reuse information per recording thread and merge it safely.
@ -6484,2 +6485,3 @@for (auto& kv : textures) order.push_back({kv.second->last_frame, kv.second.get()});std::sort(order.begin(), order.end(), [](const auto& a, const auto& b) { return a.first < b.first; });// (longshot) SIEVE (NSDI 2024): unvisited one-hit textures are evicted ahead of revisited working-set texturesstd::sort(order.begin(), order.end(), [](const auto& a, const auto& b) {L1 (blocking): The new ordering is no longer globally ordered by age, but both eviction walks still stop at the first texture younger than need_dead.
When: A recently used unvisited texture sorts before an old visited texture. The break at the start of the eviction walk skips the old texture and everything after it, so dead targets and budget victims can remain allocated under pressure.
Do: Make both walks examine all eligible ages under the new ordering, and add a test with a young unvisited texture before an old visited victim.
@ -6485,1 +6486,3 @@std::sort(order.begin(), order.end(), [](const auto& a, const auto& b) { return a.first < b.first; });// (longshot) SIEVE (NSDI 2024): unvisited one-hit textures are evicted ahead of revisited working-set texturesstd::sort(order.begin(), order.end(), [](const auto& a, const auto& b) {return sieve_evict::evict_before(a.second->sieve_visited, a.first, b.second->sieve_visited, b.first);L4 (should fix): Visited textures never receive the documented second-chance decay: decay_survivor is only called by the unit test.
When: Once a texture has been used across frames, it stays visited for its entire lifetime even after it stops being used. Under later pressure, newly streamed textures are favored for eviction over that stale former working set.
Do: Clear the visited state for surviving candidates at the appropriate eviction pass, and test the integrated multi-pass behavior.
@ -201,0 +220,4 @@uint64_t fre = st.blockBytes - std::min(st.blockBytes, st.allocationBytes);if (texture_small_pool) {VmaStatistics sst{};vmaGetPoolStatistics(vma, texture_small_pool, &sst);L3 (blocking): The compaction trigger counts free space in both pools, but image_compact_begin compacts only texture_pool.
When: When small textures leave fragmented blocks, their free space can trigger repeated compactions of the large pool while the fragmented small blocks are never moved or returned. VRAM remains occupied and can force eviction or driver paging on constrained cards.
Do: Compact each pool using its own statistics and context, or keep small textures in the pool that the existing compactor handles.
Thanks @HumanBean for the Linux RTX 3090 verification (1% lows 104.83 → 126.29 fps, 0.1% lows 96.90 → 120.34 fps) and for catching the missing sieve_evict::decay_survivor call site!
Wired sieve_evict::decay_survivor(tex->sieve_visited, false) in gpu/vk/vk_texture.cpp at the end of budget-pressure eviction passes (!sweep && !evict.empty()) for surviving textures unused for at least min_unused frames, so textures from previous areas decay cleanly instead of staying permanently marked isited = 1. Verified est_wb_learn.cpp and est_sieve_and_size_class.cpp pass.
d2532f963c84db7c4878Addressed all blocking and should-fix items from BeanBot's review (L1, L2, L3, L4):
Verified ests/test_wb_learn.cpp and ests/test_sieve_and_size_class.cpp compile cleanly with -Wall -Wextra -Werror and pass. Ready for retest!
@review
Recommendation: Request changes. It conflicts with its base branch: bring it up to date (
@fixor@rebasetry first). (L6) The eviction and compaction fixes address the code items, but the performance gain and behavior under eviction pressure still need verification on the current base and head.The change replaces writeback interval lookups, prioritizes texture eviction using reuse history, and separates small texture allocations into another VRAM pool. It adds eviction and compaction complexity in pursuit of lower frame time and fragmentation.
Blocking (1): must change before merging.
@fixor@rebasetry first). (for the author)Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
8c39108b8e)Resolved: L1 (The new ordering is no longer globally ordered by age, but both eviction walks still stop…); L2 (The new visited flag is read and written without synchronization on the parallel recording…); L3 (The compaction trigger counts free space in both pools, but image_compact_begin compacts o…); L4 (Visited textures never receive the documented second-chance decay: decay_survivor is only…)
Still open: L5 (The renderer and memory changes need current-base, current-head measurements and eviction-…)
New: L6 (It conflicts with its base branch: bring it up to date (
@fixor@rebasetry first).)Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven on the current head and base. Earlier Windows runs reported +6.4% median FPS in Hyrule Field; Linux runs on an earlier head showed +2.1% to +5.2% across two CPU-bound pairs, with substantial run-to-run drift.
Other systems: The changes affect Vulkan texture eviction, memory compaction and writeback tracking on Windows and Linux across GPU vendors. Earlier NVIDIA runs completed without crashes; AMD, Intel and low-VRAM eviction-pressure behavior remain unverified.
Switches: No switches added, changed or removed.
Reviewed:
9078cf43ebagainstb6d274d779: Read the fix diff, ledger-related eviction and compaction paths, helper headers, regression test, repository guidance and supplied runs. The full changed renderer files and complete base diff were not read in full; other changed tests and generated material were skimmed.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run the project were executed. Earlier Windows and Linux NVIDIA game runs are reported; CI is still running.
Overlaps and merge order: Not checked; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@rebase
I rebased this pull request onto
main(4f21b844d1): the new head is3397c60527.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
9078cf43eb3397c60527Recommendation: Approve. The code is ready: only testing is left. The rebase resolves the conflict, but the performance gain and eviction behavior still need verification on the current base and head, including under VRAM pressure. Recommend approval; not approved on the forge.
The change replaces interval-tree lookups with flat tables, changes texture eviction priority, and separates small textures into a VRAM pool. It may improve frame time and reclamation, at the cost of additional pool and eviction complexity.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
9078cf43eb)Resolved: L6 (It conflicts with its base branch: bring it up to date (
@fixor@rebasetry first).)Still open: L5 (The renderer and memory changes need current-base, current-head measurements and eviction-…)
Checks: Still running:
PR description / Title and description (pull_request_target).Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven on the current base and head. Earlier Windows runs reported 75.30 to 80.10 median FPS in Hyrule Field; Linux runs on an earlier head showed a smaller gain with substantial run-to-run variation.
Other systems: Texture eviction and pool compaction affect Vulkan drivers and VRAM budgets on Windows and Linux. Earlier NVIDIA runs passed in game; AMD, Intel and lower-VRAM eviction-pressure behavior remain unverified.
Switches: No switches added, changed or removed.
Reviewed:
3397c60527against4f21b844d1: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the diff and the new helper headers and tests. Skimmed the larger changed renderer files and supporting code; they were not read in full. docs/review-checklist.md is absent.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The supplied CI reports the description check still running.
Overlaps and merge order: Unknown; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.
This merged as
3b18a4a9a minute after BeanBot's@rebase(head3397c605). BeanBot's rebase note says it built and ran nothing. Two things after the merge:texture_frame(gpu/vk/vk_texture.cpp), the two eviction walks nowcontinuepast textures younger thanneed_deadinstead ofbreaking. They have to, since SIEVE can put a young unvisited texture ahead of an older visited one in the order. The budget stop stillbreaks, and the retiring-texture check frommainis kept (tex->last_value > completed || tex->retiring). The second-chance decay after a budget pass is in place. I found nothing wrong in it by reading. I haven't run this PR's checks (test_wb_learn.py,test_vram_compact.py,test_sieve_and_size_class.py,test_memory_priority.py,test_mem_account.py,test_evict_reason.py,test_keep_rendered.py) onmainyet: that job is still waiting in the PC's queue.3397c605: CI reported failures in Rust, the game-free checks (both parts), the website build, and third-party/guide screenshots. I couldn't open those job logs, so I can't yet say whether they are this PR's ormain's of that day.vram_budgetrow that the farm's earlier plan wanted doesn't exist in the Insert menu, so its first run couldn't judge it.