perf(vk): add RX_VK_REPLAY_FAST fast replay dispatch, scan, and epoch resets #2981
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
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2981
Loading…
Reference in a new issue
No description provided.
Delete branch "siantm/Longshot:perf/vk-replay-fast"
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 per-frame and per-command overheads on the Vulkan command replay path slowed down crowded CPU-bound scenes:
gpu/vk/vk_draw.cpp(draw_begin_recording()andRecordingRes) destroyed and reallocatedBankCachebyte buffers,c1_atbuckets, andPass::sampledvectors on every recording.gpu/vk/mesh_conv.h::scan()did redundant per-op header loads, branchy indirect offset reads, repeated*atwrites, and unconditionally dispatched emptymesh_conv_batch(cmd, nullptr, 0)barriers ingpu/vk/vk_replay.cpp::mesh_conv_at_barrier().gpu/vk/vk_replay.cpp::replay()dispatch loop re-checked scattered cold diagnostic/readback flags on every op, calledop_is_work()repeatedly, lackedb.n == 1/ unpadded-record fast paths for common single-binding commands, and did not prefetch upcoming ring ops.This change adds
gpu/vk/replay_fast.h(behind switchRX_VK_REPLAY_FAST, default1, supporting0baseline andcheckparity mode) and wires:EpochMap+ epoch-basedBankCache/Pass::reset()reuse so capacities stay hot across recordings without per-recording heap frees (gpu/vk/vk_draw.cpp).mesh_conv::scan()withOps::scan_actdispatch and empty-batch skip inmesh_conv_at_barrier()(gpu/vk/mesh_conv.h,gpu/vk/vk_replay.cpp).replay()loop (prefetch_op()), collapsedcold_flagsguard,did_worktracking, branchlessbuf_unchanged()/handles_unchanged(), andb.n == 1fast paths (gpu/vk/vk_replay.cpp).Read first:
gpu/vk/replay_fast.h,gpu/vk/mesh_conv.h,gpu/vk/vk_replay.cpp, andgpu/vk/vk_draw.cpp.Testing
Tested: Windows 11 (x86_64), NVIDIA GeForce RTX 4060 (driver 621.40), Ocarina of Time (
market, child crowded) on local buildperf/vk-replay-fast @ 12822052e(off495ed9fe2,0shader parts rebuilt,lift: unchanged):clang++ -fsyntax-onlypassed ongpu/vk/vk_replay.cpp,gpu/vk/vk_draw.cpp, andgpu/vk/vk_main.cpp.python -I -B tests/test_vk_replay_fast.py --cxx clang++: passed (including 200 randomized streams and 6MUST_FAILbroken variants).python -I -B tests/test_mesh_conv.py --cxx clang++: passed (7 broken variants caught).python -I -B tests/test_hos_ab.py --cc clang: passed (RX_VK_REPLAY_FASTwired).python -I -B tests/test_recorder_parts.py,tests/test_recorder_sync.py,tests/test_saveload_warm_cache.py,tests/test_tls_objects.py: passed.=1smoke (RX_VK_REPLAY_FAST=1, 15 s):1184 frames,79.0 fps,RUN_ERROR=None.=checkparity (RX_VK_REPLAY_FAST=check, 30 s):2263 frames,75.4 fps,RUN_ERROR=None,[replay_fast] checks=72537615 mismatches=0 (close).main@0aeb6858(2026-12-03), with the checks that read the replay's source updated for this change's reshaping:tests/run_all.py --exactof 27 checks passed, among themtest_vk_replay_fast,test_mesh_convand the six updated (Windows 11, llvm-mingw clang++), andclang++ -fsyntax-onlyofgpu/vk/vk_replay.cpp,gpu/vk/vk_draw.cppandgpu/vk/vk_main.cpp. No game run on the rebased head.d1a3709: passed onwindows+nvidia,linux+radvandintel; failed onlinux+nvidia(Kokiri picture 0.37; its Market pictures show the same texture white-out on main and the PR, more surfaces on the PR's; one PR start at 45.8 FPS against about 118),windows+amd(Kokiri picture 0.22) andsteamdeck(Market 1% low 47.88 -> 56.00 ms on one Deck; Kokiri picture 0.32 on that Deck, the other Deck's Market pictures both correct and differing by capture timing).=0vs=1): -2.28% median FPS, inconclusive. AMD Lab, Linux RX 580 (3 pairs): -1.00% median FPS, within the spread; p99 25.11 -> 38.51 ms, 1% low 39.83 -> 25.97 FPS.Still to test:
RX_VK_REPLAY_FAST=0against=1again, to see whether the tail regression in the AMD Lab and Steam Deck results repeats; if it does, the switch goes off (by hand/@Beanstalk).mainagainst this head at player settings, in the Market and a heavy area (by hand).Measurements
Verdict: faster: +0.73% FPS (
79.71 vs 79.14 FPS, mean frame time -0.092 ms, median -0.08 ms, 95% CI +0.31% to +1.15%, strictly excludes0; 5/5 runs won).1% Low FPSimproved +0.38% (63.45 vs 63.21) and0.1% Low FPSimproved +7.24% (53.19 vs 49.60).Setup: Windows 11, Market (
child (crowded)), 1280x720 output at 50% internal res (768x432), V-Sync off, frame generation off,HOS_FPS_MAX=1000; 5×90 s queued in-runHOS_ABruns togglingRX_VK_REPLAY_FASTbetween unset (=1, side 0) and0(side 1) every 3 s after warm-up (147pooled periods;16,141ON frames vs16,029OFF frames).RX_VK_REPLAY_FASTships ON (1).Baseline: both columns are one build,
perf/vk-replay-fast @ 12822052(offmain @ 495ed9fe2, notmaindirectly): in-runHOS_ABtogglesRX_VK_REPLAY_FAST=0(baseline fast-path off) againstRX_VK_REPLAY_FASTunset (1, fast-path on) on the same binary.1282205212822052draw_msdesc_mscmds_mswait_gpu_msmain_cpu_msPer-run paired FPS:
AB1: 79.5 vs 79.3 (-0.57%),AB2: 79.6 vs 79.1 (-0.61%),AB3: 81.3 vs 80.4 (-1.08%),AB4: 78.8 vs 78.4 (-0.50%),AB5: 79.6 vs 78.9 (-0.89%).Risks
Runtime switch
RX_VK_REPLAY_FAST=0disables all replay/scan/epoch fast paths immediately and restores baseline behavior;RX_VK_REPLAY_FAST=checkvalidates runtime parity (0mismatches across72.5Mlive checks). No save, cache, config, orDevice::stateABI/layout changes.Checklist
Ready for review
main(0aeb6858); 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
RX_VK_REPLAY_FASTships on (1), added ingpu/vk/switches.defand wired intests/test_hos_ab.py.tests/(test_hos_ab.py,test_vk_replay_fast.py) updated/added without weakening assertions.Ready to merge
Tested in game: Windows 11 x86_64, Ocarina of Time market child crowded (768x432 -> 1280x720, HOS_FPS_MAX=1000): =1 smoke (1184 frames, 79.0 fps), =check parity (72,537,615 checks, 0 mismatches), and 5x90s HOS_AB (79.71 vs 79.14 fps, +0.73%, 95% CI +0.31%..+1.15%, 1% Low 63.45 vs 63.21, 0.1% Low 53.19 vs 49.60).
Possibly related, for context:
@review
Recommendation: Approve. The reported 0.73% gain compares two modes of the changed binary, so it does not establish a gain over main. Tier 1 coverage and a complete code review are still needed. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change reuses recording allocations and adds faster Vulkan replay and mesh-scan paths. It adds substantial dispatch and parity-checking code for a reported gain smaller than 1%, whose benefit over the actual base remains unproven.
Should fix (1): not blocking, but worth doing before merging.
tests/test_vk_replay_fast.py:264: The binding tests exercise a handwritten copy of the fast paths rather than the replay implementation. (more on the line) Do: Exercise the actual replay binding code through a game-free harness, or extract the implementation into helpers used by both replay and the tests, and add a broken variant for the state update.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
495ed9fe2aand HEAD with the default, reporting frame times and lows as well as FPS.@fixcan do L3.Questions (1) (not confirmed from the code; they don't hold the recommendation)
Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. The PR reports 79.71 versus 79.14 FPS across five Windows runs, with 1% lows of 63.45 versus 63.21 FPS, but both sides use the PR binary and the off side retains changes such as the new map. No direct measurement against base
495ed9fe2ais supplied.Other systems: Replay and recording run across Vulkan vendors, Windows and Linux, including Steam Deck and the mesh-shader fallback. The supplied live run covers one Windows PC; its GPU and driver are not identified, and the other Tier 1 systems have not been reported tested.
Switches: RX_VK_REPLAY_FAST is added, default on; 0 selects baseline paths and check enables parity telemetry. Its table row is present, but the default's benefit across supported systems is not yet established.
Reviewed:
12822052eeagainst495ed9fe2a: Read AGENTS.md, CONTRIBUTING.md, the PR template, relevant standards sections, the full diff, replay_fast.h, mesh_conv.h, and test_vk_replay_fast.py. Read changed regions and selected surrounding callers in vk_draw.cpp, vk_replay.cpp, vk_draw.h, vk_main.cpp and test_hos_ab.py; those large files were not read in full. The requested review checklist and adjacent Tooling AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project, builds, or tests were run during this read-only review. CI is still running.
Overlaps and merge order: Not checked; network unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -0,0 +261,4 @@{nvn_p_bind_bufs b{};std::memcpy(&b, rec.data(), std::min(sizeof b, rec.size()));for (int i = 0; i < b.n && i < 16; i++) {L3 (should fix): The binding tests exercise a handwritten copy of the fast paths rather than the replay implementation.
When: For example, removing the fast NOP_BIND_VSTREAM state copy from vk_replay.cpp leaves this harness and its source checks passing, although vertex stream state would no longer update.
Do: Exercise the actual replay binding code through a game-free harness, or extract the implementation into helpers used by both replay and the tests, and add a broken variant for the state update.
12822052eed1a37097ccAddressed review #3043 feedback in
d1a37097c:tests/test_vk_replay_fast.py, binding fast paths): Extracted the replay binding fast-path state updates (apply_viewports_fast,apply_bind_vattr_fast,apply_bind_vstream_fast,apply_bind_vbuf_fast,apply_bind_bufs_fast, andapply_bind_handles_fast) intogpu/vk/replay_fast.hso bothgpu/vk/vk_replay.cppandtests/test_vk_replay_fast.pyexercise the exact same production helpers. Removed the handwritten duplicate fast-path copies intests/test_vk_replay_fast.py, added source wiring checks for all six helpers inreplay(), added 4MUST_FAILstate-update broken variants (vstream_skip_copy,vbuf_skip_copy,bind_bufs_skip_update,bind_handles_skip_copy), and added compiler fallback discovery (--cxx/CXX->clang++/g++/c++) and Windows DLLPATHhandling.Verified after the final edit:
clang++andg++-std=c++20 -Wall -Wextra -Werror -fsyntax-onlyongpu/vk/replay_fast.hpython -I -B tests/test_vk_replay_fast.pywith--cxx clang++,--cxx g++, and default discovery (10/10 broken variants caught)python -I -B tests/test_hos_ab.py --cc clang,python -I -B tests/test_tls_objects.py, andpython -I -B tests/test_vk_braces.py@beanstalk
Beanstalk test farm · an earlier run: commit
d1a3709(the newer results are in a comment below)Commit
d1a3709· approved by HumanBean (reviewed) · dashboard⚠️ Note: The farm's separate-start comparisons cannot reproduce the author's in-run switch-toggle confidence interval or reliably resolve the claimed 0.73% gain.
⚠️ Note: The default path is compared directly with main; switch-off and parity-check modes are omitted to keep the run within the time limit.
Done (started 2026-12-02 15:34 UTC, last report 11:02 UTC). Comment
@Beanstalkto run it again.windows+nvidialinux+nvidiawindows+amdlinux+radvintelsteamdeckWhy it failed
linux+nvidia:replay-scenesscreenshot.max_diff:0.3 → 0.4; limit 0.2windows+amd:replay-scenesscreenshot.max_diff:0.1 → 0.2; limit 0.2steamdeck:replay-scenesscreenshot.max_diff:0.2 → 0.3; limit 0.2steamdeck:replay-scenesmarket.frametime_1pct_low_ms.max_delta_pct:47.9 → 56.0 (+17.0%); limit 15.0steamdeck:replay-scenesscreenshot.max_diff:0.3 → 0.3; limit 0.2Couldn'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.
intel, report 1:Insufficient frame-time evidence for 7 required comparison(s). See rule results.What was tested
What will be tested · AI plan (
gpt-6.1-terra)Compare the shipped replay path against main on Windows and Linux GPUs and Steam Deck, using three alternating starts per side. Each start measures 30 seconds in the crowded child Market and 30 seconds in Kokiri Forest at a fixed, uncapped 720p output, with still-scene screenshots. A crash, a screenshot difference above 0.2, or a frame-time regression above 15% fails the run. Results show performance by target, but the reported sub-1% gain may be smaller than run-to-run noise. No tester online now matches linux+nvidia: that target waits for one.
market-entrance(settings vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0; switchesHOS_OUTPUT_RES=1280x720,RX_VK_AUTO_TUNE=0), then teleport to Market, take the picture market to compare with main, measure market for 30 s (after 10 s warm-up), teleport to Kokiri Forest, take the picture kokiri to compare with main, measure kokiri for 30 s (after 10 s warm-up); 3 runs on each side.Measurements on `windows+nvidia`, for the PR description
Verdict: pass on windows+nvidia (2 reports): no rule failed and no PR run crashed.
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window
NVIDIA GeForce RTX 3090, 621.1.0AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+windowNVIDIA GeForce RTX 4070, 621.24.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAMScene: replay-scenes, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); 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); replay-scenes: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 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)495ed9fd1a3709Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `linux+nvidia`, for the PR description
Verdict: fail on linux+nvidia (2 reports):
replay-scenes screenshot.max_difffailed.Hardware: 1: linux+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce GTX 1660 Ti, 620.73.4Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, 16 GB RAM; 2: linux+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 5070, 620.73.4AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAMScene: replay-scenes, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); 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); replay-scenes: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 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)495ed9fd1a3709Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `windows+amd`, for the PR description
Verdict: fail on windows+amd (2 reports):
replay-scenes screenshot.max_difffailed.Hardware: 1: windows+amd+amd-proprietary+dgpu+window+fsr4
AMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM; 2: windows+amd+amd-proprietary+igpu+window+xessAMD Radeon(TM) Graphics, 2.0.279AMD Ryzen 5 5600G with Radeon Graphics, 28 GB RAMScene: replay-scenes, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); 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); replay-scenes: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 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)495ed9fd1a3709Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `linux+radv`, for the PR description
Verdict: pass on linux+radv (2 reports): no rule failed and no PR run crashed.
Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM; 2: linux+amd+radv+igpuAMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAMScene: replay-scenes, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); 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); replay-scenes: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 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)495ed9fd1a3709Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `intel`, for the PR description
Verdict: pass on intel (2 reports): no rule failed and no PR run crashed.
Hardware: 1: windows+intel+intel-proprietary+igpu+window
Intel(R) UHD Graphics 630, 0.404.2115Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM; 2: linux+intel+anv+igpuIntel(R) Graphics (RKL GT1), 26.2.411th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz, 128 GB RAMScene: replay-scenes, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); 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); replay-scenes: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 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)495ed9fd1a3709Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `steamdeck`, for the PR description
Verdict: fail on steamdeck (2 reports):
replay-scenes screenshot.max_diff;replay-scenes market.frametime_1pct_low_ms.max_delta_pct (+17.0%)failed.Hardware: 1: linux+amd+radv+igpu+handheld
AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAM; 2: linux+amd+radv+igpu+handheldAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAMScene: replay-scenes, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); 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); replay-scenes: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 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)495ed9fd1a3709Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
The testers' hardware
windows+nvidiaNVIDIA GeForce RTX 3090, 621.1.0AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAMwindows+nvidiaNVIDIA GeForce RTX 4070, 621.24.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAMlinux+nvidiaNVIDIA GeForce GTX 1660 Ti, 620.73.4Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, 16 GB RAMlinux+nvidiaNVIDIA GeForce RTX 5070, 620.73.4AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAMwindows+amdAMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAMwindows+amdAMD Radeon(TM) Graphics, 2.0.279AMD Ryzen 5 5600G with Radeon Graphics, 28 GB RAMlinux+radvAMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAMlinux+radvAMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAMintelIntel(R) UHD Graphics 630, 0.404.2115Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAMintelIntel(R) Graphics (RKL GT1), 26.2.411th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz, 128 GB RAMsteamdeckAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAMsteamdeckAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAMIndependent Linux Market A/B on PR head
d1a37097ccfb.RX_VK_REPLAY_FASTdefaults to on in this revision.Inconclusive in this short capture. Median average FPS changed by -2.28%.
0)1)Market (child), Linux 7.3.3-1-cachyos, RTX 3090, NVIDIA 620.70.06, 1280x720, 50% (640x360), uncapped with V-Sync and frame generation off. Two interleaved 30-second captures per side on the same PR binary, each after pipeline warm-up. Frame-time and 1% low rows report the median across the two captures.
The repeats on at least one side differ by more than 10%, so the average FPS delta is sensitive to the run chosen.
AMD Lab Market A/B on PR head
d1a37097ccfb, usingRX_VK_REPLAY_FAST=0andRX_VK_REPLAY_FAST=1on the same build.Within the run-to-run spread. Median average FPS changed by -1.00%.
0)1)Market (child), headless Linux 7.3.3-1-cachyos, Core i7-9700K, Radeon RX 580 with Mesa RADV 3:26.2.6-1, 1280x720 output and 50% (640x360) render scale, uncapped with V-Sync and frame generation off. Three alternating pairs, 40 seconds per capture after warm-up.
After warm-up, the harness still flagged pipeline or shader activity in 18 / 62 / 20 frames on side A and 58 / 20 / 33 on side B across the three captures. The FPS and tail numbers include those frames.
d1a37097cce696e89bc7Beanstalk test farm
Commit
e696e89· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.Rebased onto
main@0aeb6858(heade696e89b). The default stays on. The description's Testing is updated.Rebase conflicts, resolved keeping both sides:
gpu/vk/vk_replay.cpp:main'sreadback_early_gapsetting is kept, andPasskeeps bothmain'srt_serialand this PR'sreset().gpu/vk/switches.def: the oldRX_VK_RETIRE_*rows are dropped, sincemainmoved them to settings.Checks this PR broke, fixed in
e696e89b. On the rebased head, six checks that read the replay's source failed, because of this PR's reshaping rather than the rebase:test_draw_stream_visibility,test_fsr_uniform_ownershipandtest_recording_admissioncompiledraw_begin_recordingandbegin_recordingcut from the source. Their fixtures now includereplay_fast.hand stub its epoch bank cache (bank_cache_epoch,bank_cache_check,BankCache::epoch),Pass::resetandmesh_batch_maybe_live.test_split_before_draw: with the switch on, the part's end thatmaybe_splitasks for is made inside the three plain draws' cases (if (rf_mode != 0 && part_end_wanted && …) split_part(cmd);) instead of before the switch on the op. The check now requires that line first inNOP_DRAW,NOP_DRAW_IDXandNOP_DRAW_INDIRECT, and nowhere else in the switch, so a part still never begins with a mesh draw or a dispatch.test_early_split_before_drawruns its streams of draws, mesh draws and dispatches both ways (RX_VK_REPLAY_FAST=0and1), with the in-case end and the reshaped early-end condition cut from the source.test_replay_copieschecks that the c1 map is thereplay_fast::EpochMap(open addressing, no map node per upload) instead ofFlatMap.Farm results (
d1a3709):linux+nvidia(RTX 5070), Market pictures (diff 0.35, main against itself 0.13): main's and the PR's both show the same white-out of textures at the Market gate. The PR's picture whites out more surfaces (the gate walls as well). One of the three PR starts there also ran at 45.8 FPS against about 118 for the others (p99 40.5 ms). One start out of three isn't enough to call it a PR fault, but it needs another run. The failing rule itself was the Kokiri picture (0.37 against 0.25), and the report has no Kokiri pictures to download.steamdeck, second Deck: main's and the PR's Market pictures both render correctly. The 0.30 difference comes from the place-name title and the speech bubble being at different points of their fade, i.e. capture timing.steamdeck1% low: one Deck's median rose 47.88 → 56.00 ms (+17%; PR starts 77.55 / 56.00 / 51.99 against main's 55.70 / 47.88 / 47.69). The other Deck moved 55.65 → 59.82 ms and passed.windows+amd(5600G) and the first Deck failed on the Kokiri picture (0.22 against main's own 0.12; 0.32 against 0.21). Those reports have only main's Kokiri picture, so I couldn't compare them.Measurements by people:
None of these shows it faster, and the AMD Lab and Steam Deck tails lean slower. The measurers called the averages inconclusive or within the spread, so I've left the default on. A repeat of the AMD Lab pairs, or the farm on this head, should settle whether the tail regression is real; if it repeats, the switch goes off.
L1 / L2 (base against head at player settings, other Tier 1 systems): still open. I can't run the game here (one Windows RTX 4060 PC, a shared queue).
Question (GPU of the Windows run): NVIDIA GeForce RTX 4060, driver 621.40, Windows 11. It's now in the description.
Tested on the rebased head (Windows 11, llvm-mingw clang++):
tests/run_all.py --exactof 27 checks: 27 passed, 0 failed. They are the six fixed above,test_vk_replay_fast,test_mesh_conv,test_mesh_fallback,test_hos_ab,test_switch_table,test_dlssg_hudless,test_draw_binds,test_dummy_views,test_flat_map,test_fsr3fi_hud_mask,test_mem_trim,test_push_state,test_same_bind,test_sampler_admission,test_target_layouts,test_tex_desc_memo,test_vk_cmd_fast,test_vk_desc_span_fast,test_vk_pipe_fast,test_vk_ubo_ssbo_fast,test_vram_held_idle.clang++ -fsyntax-onlyofgpu/vk/vk_draw.cpp,gpu/vk/vk_replay.cppandgpu/vk/vk_main.cpp, with the build plan's own compile commands: no errors.test_readback_earlyandtest_recorder_own_idletimed out only while 8 checks ran at once. Run one at a time, they passed on this PR and onmain(checked before the last rebase, onmain@1c91b18f).No game run on the rebased head.
Recommendation: Request changes. A perf change that ships on by default with no measured gain over
main, and with worse frame-time tails in every run againstmainor from another tester since (Steam Deck, AMD, and Windows NVIDIA on the farm). It also conflicts withmain. The code itself looks correct where I checked it.For a player, this would make the Vulkan replay of each frame's commands a little cheaper on the CPU in crowded scenes (Market). It does that with a second copy of the replay's bind cases behind
RX_VK_REPLAY_FAST, plus a capacity-keeping reset for the per-recording caches and a quicker mesh-draw scan. That is +1,548 lines (a 332-line header, a 737-line test) for a 0.73% gain measured inside one binary.Does it help: No, as measured so far. The only gain is
=1against=0in one binary, on one PC (RTX 4060): +0.73% FPS. Againstmain, the farm atd1a3709gave Windows NVIDIA Market median 9.7 -> 9.8 ms, p99 12.7 -> 13.5 ms (+7%), worst 1% 14.5 -> 16.0 ms (+11%), and Steam Deck Market 1% low 47.9 -> 56.0 ms (+17%, a fail). Other testers on the same binary: HumanBean, Linux RTX 3090, -2.28% (inconclusive); AMD Lab, RX 580, -1.00% with p99 25.1 -> 38.5 ms and 1% low 39.8 -> 26.0 FPS. A perf change with no measured gain doesn't merge, and an average gain with worse 1% lows is not a gain (standards, Measurements).Other systems: this is the replay loop, so every vendor, OS and the Deck run it. The farm failed it on
linux+nvidia,windows+amdandsteamdeck(picture rule, plus the Deck's 1% low), and nothing since shows those failures were noise.Switches:
RX_VK_REPLAY_FAST(kill, default on). The default isn't backed by a measurement againstmainon any platform, and the tails lean worse on AMD and the Deck. On is the wrong default until that changes.Reviewed:
e696e89bcagainst its merge base0aeb68589. I read the whole diff ofgpu/vk/replay_fast.h,mesh_conv.h,vk_replay.cpp,vk_draw.cpp,vk_draw.h,vk_main.cppandswitches.def, plus the code it relies on: the record structs ingpu/render/rx_nvn.h,mesh_conv_batch, the baseline bind cases,op_is_work, and bothreplay()call sites. I only skimmedtests/test_vk_replay_fast.pyand the six updated checks: those weren't read in full. Nothing was run.Fixed in this review: nothing.
Checked and fine:
rx_nvn.hlays them out:{first, n}for viewports, vattr, vstream and vbuf (vattr and vstream ignorefirst, as the baseline does); handles at +24 after{stage, first, n, pad_, src}; ranges at +24 innvn_p_bind_bufs.tex_genis bumped for tex, samp and img, as before.NOP_BIND_PROGRAMandNOP_BIND_UBO/SSBOwhen nothing changed loses no state: the comparison covers the whole record (nvn_p_bind_bufis exactly stage, index, addr, size).mesh_conv_batch(cmd, nullptr, 0)only clears the thread'smesh_batch, so the empty-batch skip guarded bymesh_batch_maybe_liveis safe, and the flag is reset at each recording.replay(): both call sites followbegin_recordingon the same thread, so aHOS_ABflip switches whole recordings.EpochMapprobes always end (load at most 3/4), and an empty map never indexes with a shift of 64.vbuf[first + i]for a negativefirst; the baseline would write out of bounds there.Blocking
gpu/vk/switches.def:613: the switch ships on without a gain overmain, and with worse tails (numbers above). BeanBot's L1/L2 still stand, and the data that came in since leans the wrong way. Fix: measuremainagainst this head, interleaved, at least 4 runs a side, on a CPU-bound PC and on AMD or the Deck. Ship it on only where it is faster with tails no worse; otherwise default it off, or drop the parts that don't pay.gpu/vk/vk_draw.cpp:780:=0isn'tmain.c1_atis anEpochMapin both modes (FlatMapis gone),mesh_conv::Opsgains a 256-bytescan_acttable, andreplay()carries the per-oprf_modebranches in both modes. So the in-run A/B doesn't measure the change, and the kill switch doesn't bring the old code back. Fix: the measurement againstmainfrom point 1.linux+nvidia, 0.12 -> 0.22 onwindows+amd, 0.21 -> 0.32 on a Deck. Your own note says the PR's Market picture on the RTX 5070 whites out more surfaces thanmain's. Nothing has run on the farm ate696e89. Fix: a farm run on the rebased head, with the picture difference either resolved or shown to happen withmainagainst itself.main(be4942212), and the description still says "on currentmain(0aeb6858)". Your description also says there was no game run on the rebased head, and Ready for review's "Measured againstmain" is ticked when no measurement againstmainexists. Fix: rebase, run the head in the game, and untick that box until the measurement exists.Suggestions
gpu/vk/vk_replay.cpp:2251and:2364: check mode compares the fast helper forNOP_BIND_BUFSandNOP_BIND_TEX/SAMP/IMGwith a second hand-written copy inside the check branch, not with the baseline code path. Viewports, vattr, vstream, vbuf andNOP_BIND_PROGRAMaren't checked at all. So "72.5M checks, 0 mismatches" covers the scan, the bank cache and the c1 map well, and the binds much less. If check mode stays, run the real baseline case into a shadowNvnStateand compare.gpu/vk/replay_fast.h:69:buf_unchangedduplicatesvk_replay.cpp:1862's. An==chain on four fields is already branch-free at -O2, so keep one.RX_VK_LOG_DEFERRED/RX_VK_LOG_MESH_BINDSstatics out of the per-op paths, the empty mesh-batch skip, and keepingPass::sampled's andBankCache::bytes' capacity. That would land as a small PR. The per-op dual paths throughreplay()are where the maintenance cost is: every later change to a bind case has to be made twice and kept in step.Testing: By the author: 27 checks (
run_all.py --exact) andclang++ -fsyntax-onlyon the rebased head; a game smoke, a check-mode run and the in-run A/B at12822052(Windows 11, RTX 4060). The farm ran atd1a3709(failed on 3 targets) and two human A/Bs atd1a3709showed no gain. Missing, and each holds the merge:mainagainst this head, a game run of the rebased head, and the farm on the head.Overlaps and merge order: listed as overlapping, not read in this review: #3080, #2692, #2515, #3116, #2989 and #2948. This PR reshapes the replay loop's bind and draw cases, so whichever of those lands first, this one will need another rebase over it.
@ -610,6 +610,7 @@ SW(RX_VK_REFLEX, player, enum, "the menu's NVIDIA Reflex row", "Sets NVIDIA ReflSW(RX_VK_REFLEX_LOG, diag, bool, "off", "Logs Reflex's latency timings every 300 frames.")SW(RX_VK_REJECT_KEYS, diag, string, "empty: no program rejected", "Comma list of program key prefixes taken as untranslatable, for bisecting a bad translation.")SW(RX_VK_REJECT_STAGES, diag, string, "empty: no stage rejected", "Comma list of NVN stage numbers whose programs are taken as untranslatable, for bisecting a bad translation.")SW(RX_VK_REPLAY_FAST, kill, enum, "on (1): fast replay dispatch, tighter mesh_conv::scan / empty-batch skip, and capacity-preserving per-recording resets", "=0 (or off, false, no): baseline paths; =check: parity verification and telemetry; any other value: on (HOS_AB may flip).")Ships on with no gain measured against main, and with worse tails since (Deck 1% low +17%, AMD Lab p99 25 -> 38 ms, farm Windows NVIDIA Market p99 +7%). On only where it measures faster against main with tails no worse.
@ -777,3 +778,3 @@uint32_t idle = 0; // (recordings of the slot that stayed in the first stream)// (flat (flat_map.h): an unordered_map put a malloc into every c1 upload kept, and a free into the next recording's clear)FlatMap<uintptr_t, std::pair<VkBuffer, uint64_t>> c1_at; // (c1 of a stage, by the stage's address: uploaded once a recording)replay_fast::EpochMap<uintptr_t, std::pair<VkBuffer, uint64_t>> c1_at; // (c1 of a stage, by the stage's address: uploaded once a recording)c1_at is an EpochMap in both modes, so RX_VK_REPLAY_FAST=0 isn't main: the in-run A/B leaves this change (and the scan table, and the per-op rf_mode branches) out of the comparison.
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.