perf(vk): add L1 PipeMemo and pipeline-masked sparse vertex binding (RX_VK_PIPE_VB_FAST) #2959
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
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2959
Loading…
Reference in a new issue
No description provided.
Delete branch "siantm/Longshot:perf/vk-pipe-vb-memo"
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
Cuts graphics pipeline lookup and vertex-stream binding overhead on the single-threaded replay hot path (
draw_ms/cmds_ms/pipelines_ms).Before this change, every draw hashed/scanned pipeline inputs across
pipe_fast+pipeline_keyand unconditionally scanned and bound all 16 vertex buffer slots (even unused slots or draws whose bound streams did not change, such as mesh/task or subset-attribute draws). WithRX_VK_PIPE_VB_FAST(default on,1),gpu/vk/pipe_vb_memo.hadds:PipeMemokeyed by compact sidecar generations (state_vinput_gen,Targets::rt_pipe_sig,non_eds3_sig, packedtopo_and_meta, andvs_loads_mask_of/vinput_sig_of64-slot TLS caches) ingpu/vk/vk_draw.cppandgpu/vk/vk_replay.cpp. It sits indraw()in front ofgraphics_pipeline(), whose own per-thread cache is main'sRX_VK_PIPE_FAST: a memo hit skips both, a miss goes throughgraphics_pipeline()unchanged.PipeEntry::stream_mask,PipeEntry::zero_used,state_vb_dirty_take, andCmdBound::vb_bound_mask/vb_known_mask), resolving and callingvkCmdBindVertexBuffers2(...)only for streams actually read by the active pipeline whose state or bind stamp changed.First read pipe_vb_memo.h, vk_draw.cpp, vk_replay.cpp, and vk_internal.h.
Testing
Tested: Windows 11, NVIDIA GeForce RTX 4060 (driver 621.40, Vulkan 1.4).
python -X utf8 -I tests/test_vk_pipe_vb_fast.py --headers ...passed (0mismatches on randomized 2000-op A/B trace + source wiring checks + 7 broken variants caught).python -X utf8 -I tests/test_hos_ab.py,tests/test_flat_map.py,tests/test_same_draw.py,tests/test_saveload_warm_cache.py,tests/test_notes_format.pypassed.RX_VK_PIPE_VB_FAST=1, 25 s): 1447 frames,RUN_ERROR=None.RX_VK_PIPE_VB_FAST=check, 25 s): 11,200,000+ draws (81.7%PipeMemohits), 10,989,178+ VB checks,0mismatches,RUN_ERROR=None.HOS_AB(HOS_AB=RX_VK_PIPE_VB_FAST=0,3,0, 5×90 s, 145 paired periods in Market): 5/5 runs won, zero crashes/errors.main @ a98cf28a. Main'sRX_VK_PIPE_FASTmovedgraphics_pipeline()'s thread map intopipe_fast::StateT::mine, so this PR'sTLS_OBJECT(pipe_mine, ...)is gone andgraphics_pipeline()is main's as it is;Targetskeeps main'srt_serialbesidert_pipe_sig;reset_keeping_index()anddraw_begin_recording()keep both sides' lines.tests/test_vertex_bind_range.pyfailed on this PR before the rebase too (the fast path'svkCmdBindVertexBuffers2was a second bind site); it now admits that one site and checks thatbind_vertex_streams_fastbinds only the runs that changed. The fixtures that copydraw_begin_recording()stubpipe_vb_fast_begin_recording(), andtest_draw_side_effectsruns the draw's readiness block with the switch on and a memo that never hits.dev.py queue):vk_draw.cpp,vk_replay.cpp) passclang++ -fsyntax-onlywith the build's flags.tests/run_all.py --changed origin/mainon main1c91b18f: 325 passed, 1 failed, 14 skipped.test_switch_tablefails here, and the same way on main1c91b18fanda98cf28a:LONGSHOT_SANDBOX_PROGRAMDATA(host/sandbox_win_plan.h:41) has no row ingpu/vk/switches.def.a98cf28a, which changed none of this PR's files,test_intel_quick_compute(the one check main changed among those that read this PR's files) passes.Tested by others:
RX_VK_PIPE_VB_FAST=0against1one5cac07, three alternating pairs of 40 s: within the run-to-run spread. Median average FPS 55.15 → 55.18 (+0.05 %), p99 frame time 46.17 → 45.60 ms, frames of 50 ms or more 9 / 19 / 6 against 0 / 17 / 8.e5cac07against main55773e3, Market and Kokiri Forest: failed on windows+nvidia and linux+nvidia. One PR start crashed or hung on each (RTX 3050 Ti laptop, Windows: the second PR start, 0.7 s into the run; RTX 5070, Linux: the first PR start, 0.3 s into the run); none of main's starts did. The 0.87 picture difference is that stuck start's black frame. The reports keep no log of the crashed start. The same PCs'RX_VK_PIPE_VB_FAST=checklive-parity runs passed (the 3050 Ti: 1,400,104 draws, 1,237,642 VB checks, 0 mismatches). p99 frame time windows+nvidia 19.9 → 18.4 ms, linux+nvidia 11.5 → 11.9, windows+amd 39.5 → 39.3, linux+radv 10.6 → 10.9, intel 200.7 → 203.2, steamdeck 38.2 → 35.6; those four could not be judged (an expected log line was missing on both sides, and the Intel PC crashed on both sides).Still to test:
RX_VK_PIPE_FAST, which makes thegraphics_pipeline()lookup the memo skips cheaper. They have not been taken again on current main.Measurements
Verdict: faster: +1.62% fps, the mean frame time -0.211 ms (95% interval +0.88% to +2.37% faster vs
RX_VK_PIPE_VB_FAST=0).Setup: Windows 11, NVIDIA GeForce RTX 4060 (driver 621.40, Vulkan 1.4); Market, child (crowded), 50% res (768x432), output res 1280x720, frame generation Off, vsync Off, uncapped (
HOS_FPS_MAX=1000), queued in-runHOS_AB=RX_VK_PIPE_VB_FAST=0,3,0across 5×90 s runs (145 paired periods; 15,792 ON frames vs 15,551 OFF frames).Baseline: both columns are one build,
e5cac072fonperf/vk-pipe-vb-memo(main@55773e361):RX_VK_PIPE_VB_FAST=0(Before) againstRX_VK_PIPE_VB_FASTunset (After).e5cac072e5cac072cmds_msdraw_mspipelines_msRisks
Set
RX_VK_PIPE_VB_FAST=0to revert to the un-memoizedgraphics_pipeline()lookup and full 16-slotvertex_bind_range()path, orRX_VK_PIPE_VB_FAST=checkto cross-check live parity.NvnStateandkNotesFormatare unchanged (generation counters live inStateExtrasidecar invk_replay.cpp), so pipeline notes and saves are unaffected.Assisted-by: Antigravity
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (the whole suite has not run on this branch; Testing lists the checks that ran).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.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 11 RTX 4060 Market CPU-bound 5x90s HOS_AB (+1.62% FPS, 95% CI +0.88%..+2.37%, cmds_ms -8.39%) and =check 0 mismatches on 11.2M draws
Possibly related, for context:
@review
@beanstalk
Beanstalk test farm · an earlier run: commit
e5cac07(the newer results are in a comment below)Commit
e5cac07· approved by HumanBean (reviewed) · dashboard⚠️ Note: The farm cannot run the requested macOS comparison; its live parity check covers the available targets instead.
⚠️ Note: The plan compares the shipping default with main, not the PR's switch-off path; its noise-tolerant limits cannot establish the claimed 1.62% gain or isolate draw, command and pipeline timings.
Done (started 2026-12-02 16:09 UTC, last report 11:23 UTC). Comment
@Beanstalkto run it again.windows+nvidialinux+nvidiawindows+amdlinux+radvintelsteamdeckWhy it failed
windows+nvidia:performance-and-picturescrash:1 PR run crashedwindows+nvidia:performance-and-picturesscreenshot.max_diff:0.2 → 0.9; limit 0.2linux+nvidia:performance-and-picturescrash:1 PR run crashedCouldn'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.
windows+nvidia, report 1:Insufficient frame-time evidence for 1 required comparison(s). See rule results.linux+nvidia, report 1:Insufficient frame-time evidence for 1 required comparison(s). See rule results.windows+amd, report 1:Insufficient frame-time evidence for 1 required comparison(s). See rule results.windows+amd, report 2:Insufficient frame-time evidence for 1 required comparison(s). See rule results.linux+radv, report 1:Insufficient frame-time evidence for 1 required comparison(s). See rule results.linux+radv, report 2:Insufficient frame-time evidence for 1 required comparison(s). See rule results.intel, report 1:Insufficient frame-time evidence for 8 required comparison(s). See rule results.intel, report 2:Insufficient frame-time evidence for 1 required comparison(s). See rule results.What was tested
What will be tested · AI plan (
gpt-6.1-terra)The farm will compare the PR with main on NVIDIA, AMD, Intel and Steam Deck hardware, including Windows NVIDIA and Linux RADV paths. Three uncapped starts per side measure warmed frame times in Market and Kokiri Forest at 1280x720, with stationary picture comparisons at both places. A separate check-mode start exercises live pipeline and vertex-binding parity in both scenes. Crashes, substantial frame-time regressions, excessive picture differences or logged parity mismatches fail the PR; missing check-mode summaries are reported as unjudged. 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.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,RX_VK_PIPE_VB_FAST=check), then teleport to Market, teleport to Kokiri Forest; 1 run on each side.Measurements on `windows+nvidia`, for the PR description
Verdict: fail on windows+nvidia (2 reports):
performance-and-pictures crash;performance-and-pictures screenshot.max_difffailed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess
NVIDIA GeForce RTX 3070, 621.35.0AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+windowNVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAMScene: performance-and-pictures, 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); live-parity, 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, RX_VK_PIPE_VB_FAST=check); 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); performance-and-pictures: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 s warm-up; live-parity: 1 game start a side; 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)55773e3e5cac07Flags 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):
performance-and-pictures crashfailed.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: performance-and-pictures, 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); live-parity, 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, RX_VK_PIPE_VB_FAST=check); 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); performance-and-pictures: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 s warm-up; live-parity: 1 game start a side; 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)55773e3e5cac07Flags 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: could not be judged on windows+amd (2 reports): required frame-time comparison inconclusive (fewer than two usable starts per side).
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: performance-and-pictures, 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); live-parity, 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, RX_VK_PIPE_VB_FAST=check); 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); performance-and-pictures: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 s warm-up; live-parity: 1 game start a side; 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)55773e3e5cac07Flags 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: could not be judged on linux+radv (2 reports): required frame-time comparison inconclusive (fewer than two usable starts per side).
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+dgpuAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAMScene: performance-and-pictures, 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); live-parity, 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, RX_VK_PIPE_VB_FAST=check); 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); performance-and-pictures: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 s warm-up; live-parity: 1 game start a side; 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)55773e3e5cac07Flags 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: could not be judged on intel (2 reports): required frame-time comparison inconclusive (fewer than two usable starts per side).
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: performance-and-pictures, 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); live-parity, 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, RX_VK_PIPE_VB_FAST=check); 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); performance-and-pictures: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 s warm-up; live-parity: 1 game start a side; 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)55773e3e5cac07Flags 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: could not be judged on steamdeck (2 reports): required frame-time comparison inconclusive (fewer than two usable starts per side).
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: performance-and-pictures, 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); live-parity, 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, RX_VK_PIPE_VB_FAST=check); 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); performance-and-pictures: 3 game starts a side, market 30 s after 10 s warm-up, kokiri 30 s after 10 s warm-up; live-parity: 1 game start a side; 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)55773e3e5cac07Flags 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 3070, 621.35.0AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAMwindows+nvidiaNVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0AMD Ryzen 7 5800H with Radeon Graphics, 16 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 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAMlinux+radvAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 5 9600X 6-Core Processor, 32 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 RAMRecommendation: Approve. The code is ready: only testing is left. The reported 1.62% gain compares two modes of the PR build, so the gain over main remains unproven. The default-on renderer path also needs the Tier 1 hardware runs that the PR lists as outstanding. Recommend approval; not approved on the forge.
The change memoizes graphics-pipeline lookups and binds only vertex streams used by the active pipeline. It adds cache and invalidation logic to the replay hot path; the reported in-build comparison shows a small gain on one NVIDIA Windows system, but does not include the change’s overhead relative to main.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
e5cac072; both include the added replay state tracking and target-signature work, so the comparison cannot show the net gain over55773e3613. Do: Run interleaved, warmed-up base and PR builds in the same scene and settings, reporting FPS, 1% lows, median and p99 frame times and the targeted timings.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 against main. The PR reports +1.62% FPS and -0.20 ms mean frame time over five Windows RTX 4060 runs, but both sides used commit
e5cac072with the new switch on or off.Other systems: The changed replay path runs across Vulkan vendors and operating systems, including mesh and fallback draws. Windows NVIDIA Market play and check mode were reported; Linux, AMD, Intel and Steam Deck results were not provided. Pipeline notes and saves retain their existing formats.
Switches: RX_VK_PIPE_VB_FAST is added as a developer kill switch, default 1; 0 selects the legacy lookup and binding paths, and check runs parity checks. The switch table is updated. The default’s performance and correctness across supported hardware remain unverified.
Reviewed:
e5cac072f4against55773e3613: Read the repository’s AGENTS.md, CONTRIBUTING.md, pull request template, relevant standards and architecture excerpts, the commit, the changed renderer diff, pipe_vb_memo.h, and relevant pipeline, vertex binding and replay callers. Read the changed test diffs and portions of the new test and runner. The full large renderer files and new test were not read in full; recorded runs are represented by the PR description and comment. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: No code, tests or project scripts were run, as requested. CI checks were still running in the supplied status.
Overlaps and merge order: Not checked; the network was closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
AMD Lab Market A/B on PR head
e5cac072f4f8, usingRX_VK_PIPE_VB_FAST=0andRX_VK_PIPE_VB_FAST=1on the same build.Within the run-to-run spread. Median average FPS changed by +0.05%.
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 48 / 67 / 17 frames on side A and 7 / 50 / 42 on side B across the three captures. The FPS and tail numbers include those frames.
e5cac072f4b18af0e251Beanstalk test farm
Commit
b18af0e· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.Rebased onto main @
a98cf28a(the branch wasmergeable=False) and pushedb18af0e2.The rebase
RX_VK_PIPE_FAST, which movedgraphics_pipeline()'s per-thread map intopipe_fast::StateT::mine. This PR'sPipeMemonow sits indraw()in front ofgraphics_pipeline(): a memo hit skips both, a miss runs main'sgraphics_pipeline()unchanged. This PR's ownpipe_minechange is gone in favour of main's.Targetskeeps main'srt_serialbesidert_pipe_sig.reset_keeping_index()anddraw_begin_recording()keep both sides' lines.Checks that read the changed code
tests/test_vertex_bind_range.pyalready failed on this PR before the rebase, because the fast path'svkCmdBindVertexBuffers2is a second bind site. It now allows that one site and checks thatbind_vertex_streams_fastbinds only the streams that changed.test_draw_stream_visibility,test_fsr_uniform_ownershipandtest_recording_admissioncopydraw_begin_recording(). They now stubpipe_vb_fast_begin_recording().test_draw_side_effectscopies the draw's pipeline-readiness block, which now holds the memo lookup. Its fixture runs it with the switch on and a memo that never hits, so every case still goes throughgraphics_pipeline()and is checked as before.Results on Windows, through
dev.py queue:vk_draw.cpp,vk_replay.cpp) passclang++ -fsyntax-onlywith the build's flags.tests/run_all.py --changed origin/mainon main1c91b18f: 325 passed, 1 failed, 14 skipped.test_switch_tablefails here, and the same way on main1c91b18fanda98cf28a:LONGSHOT_SANDBOX_PROGRAMDATA(host/sandbox_win_plan.h:41) has no row ingpu/vk/switches.def.a98cf28a, which changed none of this PR's files,test_intel_quick_compute(the one check main changed among those that read this PR's files) passes.Beanstalk: the NVIDIA crashes are unexplained. One PR start crashed on each NVIDIA PC, and none of main's starts did:
The 0.87 picture difference on windows+nvidia is that crashed start's black frame. The reports keep no log of the crashed start, so I can't tell where it stopped. Here is what I checked, none of which explains it:
RX_VK_PIPE_VB_FAST=checkrun compared the memo and the sparse binding against the old path: 1,400,104 draws, 1,237,642 vertex-binding checks, 0 mismatches.PipeEntryobjects it points to are never erased frompipelines.Could a maintainer run the farm again on NVIDIA (
windows+nvidiaandlinux+nvidia) on this head? If a start crashes again, its log or dump would show where. This shouldn't merge until that run comes back clean.Other results
=0against=1: +0.05 % median FPS, within the run-to-run spread. Thanks.Still open (I can't run these here: one Windows RTX 4060, shared GPU queue)
RX_VK_PIPE_FAST. Main's cache makes thegraphics_pipeline()lookup that the memo skips cheaper, so the gain may be smaller now.Recommendation: Request changes. With the switch at its default (on), two NVIDIA farm PCs crashed or hung at start on this PR's side only (Windows RTX 3050 Ti, Linux RTX 5070; main's starts did not), and nothing explains it yet. The branch also conflicts with main, and the speed gain has not been measured on current main, where
RX_VK_PIPE_FASTalready made the lookup this skips cheaper. A crash on a common GPU outweighs a +1.6 % gain on one PC.For a player: a slightly cheaper replay thread in CPU-bound scenes (+1.62 % fps in Market on an RTX 4060 in the author's in-run A/B). It does this by memoizing the pipeline lookup per draw and binding only the vertex streams the pipeline reads that have changed. The code is careful and well commented, and
=checkgives a live parity check. It does add a second vertex-bind path and a second pipeline cache in front of main's own, so it needs to pay for itself.Does it help: Unproven on current main. The +1.62 % (95 % interval +0.88 to +2.37 %,
cmds_ms-8.4 %) is one build with the switch flipped (HOS_AB, 5×90 s, RTX 4060), taken ate5cac072fbefore main hadRX_VK_PIPE_FAST. AMD Lab (RX 580, Linux) measured +0.05 %, which is noise. The farm's p99 moved both ways (windows+nvidia -7 %, linux+nvidia +3 %, linux+radv +3 %, steamdeck -7 %), and four of its six targets couldn't be judged.Other systems: every draw on every GPU goes through it (default on). The parity check passed on NVIDIA only (RTX 4060 and 3050 Ti). The path where
non_eds3_sigis nonzero, on devices missing some EDS3 features, has no parity run. Neither do AMD Windows, RADV, Intel or the Deck.Switches:
RX_VK_PIPE_VB_FAST(kill, enum, default on,=0off,=checkparity). Its row is inswitches.defand it flips underHOS_ABper recording. Default on isn't right until the NVIDIA crashes are understood and a main-vs-head measurement supports it.Reviewed:
b18af0e25againsta98cf28a:gpu/vk/pipe_vb_memo.hin full; the diffs ofvk_draw.cpp,vk_replay.cpp,vk_internal.h,switches.defandtests/test_vertex_bind_range.py. Also main's code they rely on:CmdBound, the legacy vertex bind block, andgraphics_pipeline()'s key inputs. Not read:tests/test_vk_pipe_vb_fast.py(1,026 lines),test_draw_side_effects.py,test_hos_ab.py, the three fixture.cppedits. Nothing run.Fixed in this review: nothing.
Checked and fine:
PipeEntryobjects are never erased (pipelineshas no erase/clear), so memoized pointers stay valid.memo_storeruns only aftervb_mask_set, so a memo hit always has its stream mask.use_queue_stateresetsvinput_genand sets every stream dirty on a queue switch, and new queue states copy the extras.reset_keeping_index()and the pre-recorded-commands drop clear the new masks. The only otherNvnStaterewrite (*s = NvnState{}, pipeline notes) is a scratch state, not the replay's. Stream 15 stays the zero buffer, as in the legacy path. A failed resolve binds the zero buffer and retries next draw, as before.Blocking
e5cac07, windows+nvidia and linux+nvidia, one PR start each, 0.3-0.7 s in, no log kept). The PR's own Still to test says it is not ready to merge until this is explained. What's needed: a farm run of the rebased head on NVIDIA, with a crash log or dump if it recurs. If the crash is in the new path, it needs fixing, not retrying until a clean run. The=checkruns passing on the same PCs doesn't clear this, because check mode never takes the fast bind or memo-hit paths.gpu/vk/vk_draw.cpp,tests/draw_stream_visibility_test.cpp,tests/fsr_uniform_ownership_test.cppandtests/recording_admission_test.cppconflict with main. Rebase, then measure head against main (base runtime vs this PR's), not just the switch flip. Do it on at least one more vendor, and withRX_VK_PIPE_FASTon, as main ships it.Questions
pipe_vb_memo.hpack_topo_meta/memo_lookup: main's own L1 ingraphics_pipeline()compares&pandp.variant(pipe_same(&p, p.variant, ...)), and its comment says variants sharep.key. The memo keys on&pplus a 16-bit fold ofp.keyonly. If the sameProgramobject can ever carry another variant, a memo hit returns the other variant's pipeline, the bug that comment describes. Foldp.variantinto the key, or say why&pimplies it.gpu/vk/vk_replay.cpp:1572state_vb_dirty_take: the dirty mask belongs to a guest state, and taking it is destructive. The bound mask belongs to one recording thread'sCmdBound. That is correct only while exactly one thread draws from a givenNvnState. If a second consumer ever takes the bits, the first command buffer keeps a stale stream bound. Please state that invariant in a comment. A safer shape is a per-stream or per-state generation that eachCmdBoundremembers and compares, asvinput_genalready is, which needs no single-consumer assumption.Suggestions
gpu/vk/vk_draw.cpp:11612: thegoto vb_after_bindover the legacy block could be anelsearound it, or the legacy block moved into a function. That keeps the three modes readable.gpu/vk/vk_draw.cpp:11062:if (d.mesh) pipe_vb_fast_maybe_log_summary();logs only on mesh draws at that point. A comment saying why (mesh draws don't reach the vertex block) would help.Testing: present: the author's game-free A/B trace test (2000 random ops, 7 broken variants caught), the targeted checks,
run_all --changed(325 passed, 1 failure shared with main), live=checkparity on an RTX 4060 (11.2M draws, 0 mismatches), the in-run HOS_AB, and AMD Lab and farm runs ate5cac07. Missing, and it holds the merge: a farm run of the rebased head (the NVIDIA crashes), a main-vs-head measurement on current main, parity or runs on AMD Windows, RADV, Intel and the Deck, and the whole suite (mise run testis unticked).Overlaps and merge order: #3116, #3080, #2958, #2954, #2948 and #2946 touch the same draw/pipeline hot path. Whichever lands first means a rebase and a fresh measurement for the rest. #2132 (assembly draw compares) and #801 (dynamic vertex input) are related. #801 would make
PipeEntry::stream_maskwrong, since one pipeline would then serve several vertex layouts, so whichever lands second must recompute the mask per draw or per vertex layout.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.