perf(vk): precompile per-program descriptor plans (RX_VK_DESC_PLAN_FAST) #2989
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!2989
Loading…
Reference in a new issue
No description provided.
Delete branch "siantm/Longshot:perf/vk-desc-plan-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
build_descriptorspreviously re-walkedProgram::stagesand every descriptor declaration's constant-buffer bindings on every draw call even though each(Program*, key, variant)executes the exact same sequence of descriptor writes.This adds
gpu/vk/desc_plan_fast.h(RX_VK_DESC_PLAN_FAST, default1):DescPlanbytecode (PlanOplist): flattens stage loops, descriptor slot offsets,cbuf_index/cbuf_offsetarithmetic, handle decoding (C2Sourcedirect register classification + shift combining), SSBO table offsets, view types, and image formats into a contiguous flat op stream per(Program*, key, variant).256 x 2-way cache-line aligned (64BL1Set) MRU lookup: keyed withProgram*,key, andvariant(ABA-safe against pointer reuse) before falling back toFlatMap<uint64_t, uint32_t> by_prog.writes_tpl+WritePatch+ubo_entries_tpl): bulk-copies prebuiltVkWriteDescriptorSetstructs and UBO metadata templates intoDescWriterand patchespBufferInfo/pImageInfo/pTexelBufferViewbase pointers only whenDescWritervector capacities reallocate.b4d56f5): the plan executor stamps theRX_VK_DESC_SPAN_FASTunchanged-UBO skip fields (addr,size,ub_gen,bind_stamp,cap_view,cached) for UBO slots 3..18 asbuild_descriptorsdoes. It binds depth-compare textures throughguard_depth_comparisonand a depth dummy view (#3032), and stores a texture memo entry only when the slot version didn't move while the slot was resolved. It also re-reads the SSBO memo's bind stamp at each stage's storage buffers, binds read-only storage buffers throughfast_read_bind, and takes the bare-read cap from thebare_read_mbsetting.RX_VK_DESC_PLAN_FAST=0restores the baseline path at runtime (also flips inside a frame viaHOS_AB);RX_VK_DESC_PLAN_FAST=checkexecutes both paths and logs descriptor, UBO entry, depth sample, fingerprint, anddraw_sampledparity mismatches.Files to read first:
gpu/vk/desc_plan_fast.h,gpu/vk/vk_draw.cpp(execute_desc_plan,check_desc_plan_parity,build_descriptors), andtests/test_vk_desc_plan_fast.py.Testing
Tested:
market(RX_VK_DESC_PLAN_FAST=check, 30 s,RUN_ERROR=None):1734 frames(57.8 fps),[desc_plan_fast] checks=2595163 plan_hits=2594144 tpl_reuses=956956 mismatches=0.python -I tests/test_vk_desc_plan_fast.py --cxx clang++: PASS (all 6 descriptor types, L1256x2MRU, ABA safety, template pointer reuse,ubo_entries_tpl,depth_samples,desc_fp, 400-draw trace oracle match, and 9 broken variants caught; 14 after the rebase).python -I tests/test_hos_ab.py --cc clang: PASS (12 broken variants caught).python -I tests/test_tls_objects.py: PASS (21TLS_OBJECTs;46other namespace-scopethread_locals, none with ctor/dtor).python -I tests/test_vk_braces.py: PASS (618renderer sources balance).python -I scripts/dev.py pack && python -I scripts/dev.py rt(0shader parts rebuilt,lift: unchanged).b4d56f5(head1681d8c1cb):tests/test_vk_desc_plan_fast.py(clang++ and g++, 14 of 14 broken variants caught),tests/test_hos_ab.py,tests/test_tls_objects.pyandtests/test_vk_braces.pypass, and a syntax-only clang++ compile ofvk_draw.cppandvk_memory.cpphas no errors. Nothing was run in the game.Tested by others:
32bb108, main @495ed9fagainst the PR, 12 reports on 6 targets. Frame time p99 was within ±4% of main on every PC. The farm flagged four things:RX_VK_DESC_PLAN_FAST=0against=1(Measurements): Linux RTX 3090 −1.80% (within the spread), AMD Lab RX 580 +2.58%.Still to test:
RX_VK_DESC_PLAN_FAST=checkin Market, Hyrule Field and the Water Temple on every Tier 1 target: do the Intel/RADV parity mismatches remain after the per-stage bind stamp re-read?Measurements
Verdict: faster:
+2.02%fps (-0.254 mspooled mean frame time, 95% CI+1.56%to+2.57%across 147 pairedHOS_ABperiods; 5/5 runs won). Descriptor build timedesc_msdropped-11.02%(-0.3023 ms),draw_msdropped-4.28%(-0.3134 ms), andwait_gpu_msdropped-19.10%(-0.3517 ms).Setup: Windows 11; Market, child (crowded) (
window 804x581); quality preset Custom, resolution 50% (768x432), output res1280x720, frame generation Off, vsync Off; uncapped (HOS_FPS_MAX=1000),RX_VK_FRAME_TRACE=1, 5 runs of 90 s each after warm-up,HOS_AB=RX_VK_DESC_PLAN_FAST=0,3,0flipped every 3 s within each run (dev.py queue run --mode timing).Baseline: both columns are one build,
v3.2.0-194-gf4d9fbe07(f4d9fbe07):RX_VK_DESC_PLAN_FAST=0againstRX_VK_DESC_PLAN_FASTunset (1, default) on it.f4d9fbe07f4d9fbe07SIDE_1vsSIDE_0)79.70)81.31)-0.192to-0.316 ms)-2.06%)P50)81.43fps)83.06fps)SIDE_1vsSIDE_0)desc_ms/draw_ms(SUBSYSTEM_DELTAS)Individual runs (
AB1–AB5, side 0 ON vs side 1 OFF):AB1: side 081.6fps vs side 179.7fps (-2.31%)AB2: side 081.9fps vs side 180.6fps (-1.60%)AB3: side 081.3fps vs side 179.3fps (-2.52%)AB4: side 080.4fps vs side 178.6fps (-2.21%)AB5: side 081.3fps vs side 180.1fps (-1.40%)An earlier 3x90 s
HOS_ABrun (87periods) on the same build also won 3/3 (81.44vs79.76fps,+2.14%, 95% CI+1.50%to+2.83%,1% Low 64.89 vs 63.29,0.1% Low 53.82 vs 48.85,desc_ms -10.94%).Others' same-build A/Bs (
RX_VK_DESC_PLAN_FAST=0against=1, PR head32bb108)Both at Market (child), 1280x720 output, 50% render scale, uncapped. The RTX 3090 used two interleaved 30 s captures per side; the RX 580 three alternating 40 s pairs, which still had pipeline or shader activity after warm-up (51/36/41 against 28/7/3 frames).
Test farm (Beanstalk, main @
495ed9fagainst32bb108), frame time p99 (ms)Worst 1% frame time: Steam Deck Market 51.0 → 102.4 ms (+101%), nvidia Water Temple 24.2 → 26.7 ms (+10%). Check mode (
RX_VK_DESC_PLAN_FAST=check): 11 mismatches on Intel RKL GT1 (ANV) and 1 on the Radeon 8060S (RADV). Every other PC logged 0.Risks
PlanOpassumptions (e.g. a newly added descriptor flag),desc_plan_fastcould emit a stale write or skip a diagnostic side effect. Diagnostic modes (dump_on,watch_prog,stats_frame_now,slow_desc_timing,tex_desc_memo_mode == 2,RX_VK_TRACE_TEX,RX_VK_LOG_IMG, etc.) automatically bypass the fast path, andRX_VK_DESC_PLAN_FAST=0disables it completely at runtime.RX_VK_DESC_PLAN_FAST=checkcompares against baseline (0mismatches in2,595,163live checks).256 x 2cache (256 * 64 = 16 KiBper worker thread) plus precompiledDescPlantemplates add modest host RAM proportional to active shaders.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
gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Windows 11, market (1280x720, 50% res 768x432, V-Sync off, framegen off, HOS_FPS_MAX=1000): RX_VK_DESC_PLAN_FAST=check ran 1734 frames (57.8 fps, RUN_ERROR=None) with 2595163 checks, 2594144 plan_hits, 956956 tpl_reuses, 0 mismatches; 5x90s queued HOS_AB won 5/5 (+2.02% fps, 81.31 vs 79.70 fps, 95% CI +1.56% to +2.57%, desc_ms -11.02%).
Possibly related, for context:
@review
Recommendation: Approve. The new game-free test does not exercise the descriptor executor used by the game, and check mode can suppress real buffer mismatches. The reported speedup also compares two modes of the PR build rather than the PR against its base. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change precompiles descriptor work per program and reuses write templates to reduce per-draw CPU work. It adds per-thread caches and a second descriptor implementation that must stay consistent with the baseline.
Should fix (2): not blocking, but worth doing before merging.
gpu/vk/vk_draw.cpp:5617: The parity check treats any two non-null buffers with equal ranges as equal whenever the binding stamp changed, even if they refer to unrelated buffers or offsets. (more on the line) Do: Compare the resolved guest ranges or contents and suppress a difference only when the two bindings are proven to represent the same data.tests/test_vk_desc_plan_fast.py:636: The parity harness executes its own copy of the plan interpreter instead of the production execute_desc_plan function. (more on the line) Do: Exercise the production executor with test stand-ins, or extract a shared executor that both the renderer and the test call; include a mutation of an actual executor operation that the test catches.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1 and L2.Questions (2) (not confirmed from the code; they don't hold the recommendation)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven against the base. The PR reports 81.31 versus 79.70 fps, a 2.02% gain over five interleaved runs, but both sides use
f4d9fbe07and differ only in the switch value. The comparison does not include costs common to both PR modes, and the GPU and driver are not identified.Other systems: The path handles graphics and compute descriptors, storage buffers and images, texture sampling, descriptor reuse, and recording threads on Windows and Linux. The reported live parity run covers Windows Market only; AMD, Intel, NVIDIA, Linux, Steam Deck, alternate scenes, first-use costs and memory growth remain unmeasured.
Switches: RX_VK_DESC_PLAN_FAST is added, defaults to 1, accepts 0 and check, and has a switches.def row. Its default has not been measured against the base across the supported systems it affects.
Reviewed:
f4d9fbe07bagainst495ed9fe2a: Read the repository rules, contribution guide, standards and PR template; the commit and changed-file diffs; desc_plan_fast.h and the changed descriptor-building regions and surrounding callers in vk_draw.cpp; and relevant bank, shader, test and switch code. Skimmed the long test harness rather than reading every line, and did not read the whole of vk_draw.cpp or every changed test file in full. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no build, tests or project scripts were run. The supplied CI checks are still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -5067,0 +5614,4 @@if (std::memcmp(p1, p2, (size_t)b1.range) == 0) continue;}}if (pool_changed && b1.range == b2.range && b1.buffer != VK_NULL_HANDLE &&L1 (should fix): The parity check treats any two non-null buffers with equal ranges as equal whenever the binding stamp changed, even if they refer to unrelated buffers or offsets.
When: If either descriptor build changes the GPU binding stamp and the fast path selects the wrong storage buffer with the same range, this branch skips the mismatch and check mode reports parity.
Do: Compare the resolved guest ranges or contents and suppress a difference only when the two bindings are proven to represent the same data.
@ -0,0 +633,4 @@}}static bool run_plan_exec(desc_plan_fast::State& st_state, const NvnState& s, const Program& p, WriterOut& out) {L2 (should fix): The parity harness executes its own copy of the plan interpreter instead of the production execute_desc_plan function.
When: Changing or removing a descriptor write in gpu/vk/vk_draw.cpp leaves run_plan_exec unchanged, so the advertised six-type and 400-draw parity checks still pass while the game binds incorrect descriptors.
Do: Exercise the production executor with test stand-ins, or extract a shared executor that both the renderer and the test call; include a mutation of an actual executor operation that the test catches.
f4d9fbe07b32bb1080ccAddressed BeanBot L1 and L2 and added the
Assisted-by: Antigravity (Google DeepMind)trailer in commit32bb1080c:gpu/vk/vk_draw.cpp,gpu/vk/vk_memory.cpp,gpu/vk/vk_internal.h):check_desc_plan_parityno longer suppresses buffer mismatches solely onpool_changed && b1.range == b2.range. Instead,gpu_binding_same_guest_range(b1, b2)resolves both(buffer, offset, range)bindings against live and retired pools underpools_muand suppresses the difference only when both prove to map to the exact same guest address range (e.g. a poolbuffervsmirrortransition).gpu/vk/desc_plan_fast.h,gpu/vk/vk_draw.cpp,tests/test_vk_desc_plan_fast.py): Factored the production descriptor plan executor intodesc_plan_fast::execute_planingpu/vk/desc_plan_fast.h(templated over a lightweightOpsinterface) so bothexecute_desc_planingpu/vk/vk_draw.cppandrun_plan_execintests/test_vk_desc_plan_fast.pyexecute the exact same production bytecode loop and write-template setup. Added asource_checksassertion thatexecute_desc_plancallsdesc_plan_fast::execute_plan(, switched compiler discovery totests/compiler_command.py, and added twoMUST_FAILvariants targeting actual executor operations (broken_exec_ubo,broken_exec_depth_samples; 11 variants total).Checks run after final edits:
python -I tests/test_vk_desc_plan_fast.py(clang++,-std=c++20 -Wall -Wextra -Werror): PASS (all 11MUST_FAILbroken variants caught)python -I tests/test_vk_desc_plan_fast.py --cxx C:\msys64\mingw64\bin\g++.exe(-std=c++20 -Wall -Wextra -Werror): PASS (all 11MUST_FAILbroken variants caught)python -I tests/test_hos_ab.py --cc clang: PASSpython -I tests/test_tls_objects.py: PASS (21 TLS_OBJECTs; 46 other namespace-scope thread_locals, none with a constructor or destructor)python -I tests/test_vk_braces.py: PASS (618renderer sources balance)clang++ -std=c++20 -fsyntax-only -Wall -Wextraongpu/vk/vk_memory.cppandgpu/vk/vk_draw.cpp: exit 0@review
@beanstalk
Beanstalk test farm · an earlier run: commit
32bb108(the newer results are in a comment below)Commit
32bb108· approved by HumanBean (reviewed) · dashboard⚠️ Note: Fixed 720p Custom settings emphasize CPU descriptor work; they do not reproduce device-specific Auto quality or establish the reported 2% gain and descriptor-time reduction at that precision.
⚠️ Note: Parity mismatch logs are forbidden, but the plan cannot require a positive check count only in the check scenario; the farm also cannot run the requested standalone unit tests.
⚠️ Note: The scenes exercise representative rendering but do not guarantee coverage of every descriptor type or compute program.
Done (started 2026-12-02 15:27 UTC, last report 06:52 UTC). Comment
@Beanstalkto run it again.nvidiaamdintelwindowslinux+radvsteamdeckWhy it failed
nvidia:default-performancescreenshot.max_diff:0.5 → 0.2; limit 0.2nvidia:default-performancetemple.frametime_1pct_low_ms.max_delta_pct:18.2 → 27.7 (+52.5%); limit 15.0amd:default-performancescreenshot.max_diff:0.1 → 0.8; limit 0.2intel:parity-check · RX_VK_DESC_PLAN_FAST=check (PR only)log_forbidden_hits.max:0.0 → 11.0; limit 0.0windows:default-performancescreenshot.max_diff:0.2 → 0.2; limit 0.2linux+radv:parity-check · RX_VK_DESC_PLAN_FAST=check (PR only)log_forbidden_hits.max:0.0 → 1.0; limit 0.0steamdeck:default-performancescreenshot.max_diff:0.3 → 0.8; limit 0.2steamdeck:default-performancemarket.frametime_1pct_low_ms.max_delta_pct:51.8 → 144.6 (+179.3%); limit 15.0Couldn'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 11 required comparison(s). See rule results.What was tested
What will be tested · AI plan (
gpt-6.1-terra)The farm will compare main and the PR in Market, Hyrule Field and the Water Temple across NVIDIA, AMD, Intel, Windows, RADV and Steam Deck targets. Three interleaved starts per side measure 30 seconds per location at fixed 720p, uncapped, with screenshots taken before movement; one further start per side exercises descriptor parity checking. The PR fails for a crash, a parity-mismatch log, excessive picture differences, or a frame-time regression over the plan’s limits.
check(PR only).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 Hyrule Field, take the picture field to compare with main, measure field for 30 s (after 10 s warm-up), teleport to Water Temple, take the picture temple to compare with main, measure temple 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), then teleport to Market, teleport to Hyrule Field, teleport to Water Temple; 1 run on each side.Measurements on `nvidia`, for the PR description
Verdict: fail on nvidia (2 reports):
default-performance screenshot.max_diff;default-performance temple.frametime_1pct_low_ms.max_delta_pct (+52.5%)failed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window
NVIDIA GeForce RTX 4070 Ti SUPER, 621.14.0AMD Ryzen 7 7800X3D 8-Core Processor, 32 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xessNVIDIA GeForce RTX 3070, 621.35.0AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAMScene: default-performance, 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); parity-check, 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); default-performance: 3 game starts a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up, temple 30 s after 10 s warm-up; parity-check: 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)495ed9f32bb108RX_VK_DESC_PLAN_FAST=check (PR only)· forbidden log linesFlags and settings
RX_VK_DESC_PLAN_FASTcheckAs Markdown for the PR description:
Measurements on `amd`, for the PR description
Verdict: fail on amd (2 reports):
default-performance screenshot.max_difffailed.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 7 5700X3D 8-Core Processor, 32 GB RAMScene: default-performance, 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); parity-check, 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); default-performance: 3 game starts a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up, temple 30 s after 10 s warm-up; parity-check: 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)495ed9f32bb108RX_VK_DESC_PLAN_FAST=check (PR only)· forbidden log linesFlags and settings
RX_VK_DESC_PLAN_FASTcheckAs Markdown for the PR description:
Measurements on `intel`, for the PR description
Verdict: fail on intel (2 reports):
parity-check log_forbidden_hits.maxfailed.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: default-performance, 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); parity-check, 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); default-performance: 3 game starts a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up, temple 30 s after 10 s warm-up; parity-check: 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)495ed9f32bb108RX_VK_DESC_PLAN_FAST=check (PR only)· forbidden log linesFlags and settings
RX_VK_DESC_PLAN_FASTcheckAs Markdown for the PR description:
Measurements on `windows`, for the PR description
Verdict: fail on windows (2 reports):
default-performance screenshot.max_difffailed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window
NVIDIA GeForce RTX 4070, 621.24.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xessNVIDIA GeForce RTX 4090, 621.40.013th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAMScene: default-performance, 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); parity-check, 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); default-performance: 3 game starts a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up, temple 30 s after 10 s warm-up; parity-check: 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)495ed9f32bb108RX_VK_DESC_PLAN_FAST=check (PR only)· forbidden log linesFlags and settings
RX_VK_DESC_PLAN_FASTcheckAs Markdown for the PR description:
Measurements on `linux+radv`, for the PR description
Verdict: fail on linux+radv (2 reports):
parity-check log_forbidden_hits.maxfailed.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 7 5700X3D 8-Core Processor, 32 GB RAMScene: default-performance, 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); parity-check, 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); default-performance: 3 game starts a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up, temple 30 s after 10 s warm-up; parity-check: 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)495ed9f32bb108RX_VK_DESC_PLAN_FAST=check (PR only)· forbidden log linesFlags and settings
RX_VK_DESC_PLAN_FASTcheckAs Markdown for the PR description:
Measurements on `steamdeck`, for the PR description
Verdict: fail on steamdeck (2 reports):
default-performance screenshot.max_diff;default-performance market.frametime_1pct_low_ms.max_delta_pct (+179.3%);default-performance market.frametime_p99_ms.max_delta_pct (+19.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: default-performance, 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); parity-check, 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); default-performance: 3 game starts a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up, temple 30 s after 10 s warm-up; parity-check: 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)495ed9f32bb108RX_VK_DESC_PLAN_FAST=check (PR only)· forbidden log linesFlags and settings
RX_VK_DESC_PLAN_FASTcheckAs Markdown for the PR description:
The testers' hardware
nvidiaNVIDIA GeForce RTX 4070 Ti SUPER, 621.14.0AMD Ryzen 7 7800X3D 8-Core Processor, 32 GB RAMnvidiaNVIDIA GeForce RTX 3070, 621.35.0AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAMamdAMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAMamdAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 7 5700X3D 8-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 RAMwindowsNVIDIA GeForce RTX 4070, 621.24.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAMwindowsNVIDIA GeForce RTX 4090, 621.40.013th Gen Intel(R) Core(TM) i7-13700K, 32 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 7 5700X3D 8-Core Processor, 32 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 shared executor and buffer comparison address the two code items, but the claimed gain still needs a base-versus-HEAD measurement at player settings, and the default path needs Tier 1 hardware runs. Recommend approval; not approved on the forge.
The change precompiles descriptor work to reduce per-draw CPU time, at the cost of per-thread cache and plan memory and a more complex renderer path. The fix shares the executor with the test harness and makes parity checking more selective.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
f4d9fbe07b)Resolved: L1 (The parity check treats any two non-null buffers with equal ranges as equal whenever the b…); L2 (The parity harness executes its own copy of the plan interpreter instead of the production…)
Still open: L3 (The claimed gain has not been measured against the merge base at settings players use.); L4 (The new default descriptor path has not been exercised across the Tier 1 systems it affect…)
Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven against the merge base. The author's five same-build switch comparisons report 81.31 versus 79.70 fps (+2.02%) and a 0.25 ms lower mean frame time in Market, but they do not measure the total change against main at normal player settings.
Other systems: The descriptor path affects Vulkan rendering on Windows and Linux across GPU vendors and Steam Deck. A Windows Market check reported zero mismatches in 2,595,163 checks; Tier 1 hardware coverage remains pending.
Switches: RX_VK_DESC_PLAN_FAST is added with default 1; 0 selects the baseline and check compares paths. The default's total benefit and cross-system behavior remain to be established.
Reviewed:
32bb1080ccagainst495ed9fe2a: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the ledger-related parity and pool code, and the executor and test wiring. Skimmed the reported diff and runs; the remaining changed files and their surrounding code were not read in full. docs/review-checklist.md is absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports a Windows in-game parity run and game-free checks; CI is still running. The maintainer's Test Farm request cannot be submitted under the read-only, closed-network rules.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Independent Linux Market A/B on PR head
32bb1080cc5c.RX_VK_DESC_PLAN_FASTdefaults to on in this revision.Within the run-to-run spread. Median average FPS changed by -1.80%.
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.
AMD Lab Market A/B on PR head
32bb1080cc5c, usingRX_VK_DESC_PLAN_FAST=0andRX_VK_DESC_PLAN_FAST=1on the same build.Faster in these captures. Median average FPS changed by +2.58%.
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 51 / 36 / 41 frames on side A and 28 / 7 / 3 on side B across the three captures. The FPS and tail numbers include those frames.
32bb1080cc1681d8c1cbBeanstalk test farm
Commit
1681d8c· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.Rebased onto main (
b4d56f5) and force-pushed: the new head is1681d8c1cb.The rebase. The textual conflicts were small: both sides' rows in
switches.def,vk_draw.h,vk_internal.h,vk_main.cppandtest_hos_ab.pyare kept. Main removedRX_VK_DESC_POOL_DIV'sSWrow (now a setting), and the old row is not brought back. The bigger part was semantic. Main changedbuild_descriptorsin five ways since495ed9f, and the plan path (desc_plan_fast.hand the executor's ops) would have silently differed from it, so the same commit ports each change:RX_VK_DESC_SPAN_FAST: UBO entries now carryaddr,size,ub_gen,bind_stamp,cap_viewandcachedfor slots 3..18 only, whichupdate_ubo_descriptorsuses to skip unchanged UBOs.desc_plan_fast::UboEntryis that struct, andexecute_planstamps each entry as its uniform buffer is resolved (ops.stamp_ubo_entry). Without this, the skip compares zeroed fields. Check mode now also comparesaddrandsize.lookuptakes the slot-version function,sync_generationstakesdesc_span_fast_on(), andstore_tex_memostores only when the slot version read before resolving still holds (pre_slot_ver). Otherwise the memo could keep an entry naming the slot's old texture.guard_depth_comparison, which replaces the old table-onlyis_depth_formatcheck, and a depth descriptor that resolves to nothing bindsdummies.depth_view.RX_VK_UBO_SSBO_FAST: read-only, non-bare storage buffers bind throughfast_read_bind, as main does.bare_read_mbsetting, notRX_VK_BARE_READ_MB.Farm: check-mode mismatches (Intel RKL GT1 ANV: 11 in about 0.4M checks; Radeon 8060S RADV: 1 in 5.3M; 0 on the other 10 reports). The report keeps only the log's tail, so the
desc_plan_fast mismatch (<reason>)lines aren't available. Comparing the two paths line by line, I found one real difference that fits rare mismatches.build_descriptorsreads the SSBO memo'sgpu_bind_stamp()again at each stage, after that stage's UBOs are bound. The plan read it once per draw. A pool import during an earlier stage's binds moves the stamp, and the plan then looked up storage-buffer memo entries under the old stamp: a hit main would have missed, binding a buffer from before the pool change. That also matters outside check mode. The plan now re-reads the stamp at each stage's first storage buffer (ops.ssbo_sync_stage). I can't prove from the data that this was the cause of all 12. It needs a new farm run with check mode on the new head.Farm: other failures.
@HumanBean's A/Bs (same build,
=0against=1), thanks:Together with my Windows +2.02%, that's one gain, one neutral result and one gain with noisy tails. I'm keeping the default at on until the re-run on the rebased head, since its tails on the Deck matter most.
Tested after the rebase (this PC, Windows; game-free, nothing run in the game):
python -I -B tests/test_vk_desc_plan_fast.py(clang++ and--cxx g++): pass. The oracle now mirrors main's build (UBO skip fields, depth dummy, depth guard), and all 14 broken variants are caught, including the 3 new ones:skip_ubo_entry_stamp,broken_depth_dummyandskip_depth_guard.tests/test_hos_ab.py,tests/test_tls_objects.py(23TLS_OBJECTs) andtests/test_vk_braces.py(556 sources): pass.clang++ --target=x86_64-w64-mingw32 -fms-extensions -std=c++20 -fsyntax-onlywith the renderer's include and define flags, ongpu/vk/vk_draw.cppandgpu/vk/vk_memory.cpp: no errors.tests/run_all.py(this PC's queue was about 18 jobs deep), a renderer build, and the game.Still open: BeanBot L3 (base-vs-head at player settings) and L4 (Tier 1 runs). The farm covered most Tier 1 targets on
32bb108, and the new head needs a farm run (@Beanstalk) with check mode. I updated the description's Summary, Testing and Measurements.@siantm only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.Recommendation: Request changes. This turns on a second descriptor builder for everyone by default. On the last farm run it disagreed with the real builder on two Tier 1 drivers and doubled the Steam Deck's worst-1% frame time in Market. The rebased head (
1681d8c1c) has not run in the game, and the branch conflicts withmainagain.For a player, this makes building each draw's descriptors cheaper on the CPU. It precompiles each program's descriptor walk into a flat op list and reuses the write templates. On the author's Windows PC that gave about +2% fps at 50% resolution. The code is careful and the switch is well wired: per recording,
HOS_AB, acheckmode, and diagnostics bypass it. The cost is thatdesc_plan_fast.his a second implementation ofbuild_descriptorsthat has to be kept in step by hand. The last rebase alone needed five semantic ports (#2952 twice, #3032, #2976, the settings move).Does it help: Unproven. The numbers are mixed, and no run compares
mainwith this PR at player settings.+2.02% fps (95% CI +1.56% to +2.57%, 5/5 runs): author, Windows, Market, custom 50% resolution, same build
=0against=1.−1.80%, within the spread: RTX 3090, Linux.
+2.58% with noisy tails (shader activity after warm-up on both sides): RX 580, RADV.
Farm, at
32bb108,mainagainst the PR:Everything else was within ±4% on p99.
BeanBot's L3 (base against head at each device's normal resolution and Auto quality) is still open.
Other systems: Every Vulkan draw and dispatch on every GPU, driver and OS goes through this path. At
32bb108, check mode logged mismatches on Intel RKL GT1 / ANV (11 in about 0.4M checks) and Radeon 8060S / RADV (1 in 5.3M). The reasons weren't captured. The per-stage SSBO bind-stamp re-read in1681d8c1cis a plausible fix but unverified. The Deck's tails are unexplained.Switches:
RX_VK_DESC_PLAN_FAST(kill, enum, default on everywhere). The measurements don't support on for the Steam Deck, and nothing measures it againstmainat player settings.Reviewed:
1681d8c1cagainstb4d56f526.gpu/vk/desc_plan_fast.h; thevk_draw.cpphunks (DescPlanExecOps,execute_ssbo_slow,execute_desc_plan,check_desc_plan_parity, thebuild_descriptorswiring,desc_plan_fast_begin_recordinganddesc_plan_fast_close);switches.def.DescWriter,program_ubo_delta_safe, the descriptor-set path that writesdstSet.build_descriptorsbody, not line by line.tests/test_vk_desc_plan_fast.py(about 1,300 lines), thevk_memory.cppgpu_binding_same_guest_rangehunk, and the smallvk_main.cpp,vk_internal.h,vk_draw.handtest_hos_ab.pyhunks.Nothing was run.
Fixed in this review: nothing. It needs a rebase that changes code, so that's left to the author.
Checked and fine:
prepare_writes) only happens for push programs. The descriptor-set path overwritesdstSeton every write anyway, and push descriptors ignore it, so a reused write can't carry a stale set.last_plan_idbefore it rewritesdw().writes.get_plan_slowrecompiles in place when a pointer is reused for another program.thread_localand is read indraw_begin_recording, the same pattern asRX_VK_PIPE_FAST,RX_VK_UBO_SSBO_FASTandRX_VK_TEX_DESC_MEMO.build_descriptorsstamps them, andubo_entries_tplfollowsprogram_ubo_delta_safe, which depends only on the program.dump_on,watch_prog,stats_frame_now,slow_desc_timing, memo mode 2 and the env list) bypass the plan.Blocking
gpu/vk/switches.def(RX_VK_DESC_PLAN_FASTrow): default on for the Steam Deck against a measured regression there (Market worst 1% +101%, p99 +13% at32bb108). Either find and fix the cause (for example, plan compiles on first use landing in play) and show it on a Deck re-run, or ship the default off where it isn't measured to help.gpu/vk/vk_draw.cpp(check_desc_plan_parity): check mode found 12 descriptor mismatches on ANV and RADV at the previous head, so the plan bound something different frommainthere. The fix in1681d8c1cneeds a farm run of this head with=checkin all three scenes on every Tier 1 target, showing 0. If any remain, keep the mismatch lines: the farm keeps only the log's tail, so log them at once or count them per reason in the close line.maininto the plan path and changed the SSBO stamp timing, so the game must run it before this is reviewable as tested (AGENTS.md: a change the game runs has run in the game). The branch also conflicts withmainagain: rebase, then re-run check mode, because everybuild_descriptorschange onmainmust be mirrored indesc_plan_fast.h.mainagainst the PR at each device's normal settings and Auto quality (BeanBot L3). That should include a heavy scene, with 1% lows and descriptor time.Suggestions
check_desc_plan_parity). The plan runs right after the dynamic build has filled the same per-thread texture and SSBO memos. So most sampled textures and read-only SSBOs in the plan run come back fromtry_tex_memo/try_ssbo_memo, from entries the dynamic build just stored. The plan's own resolution code (sample_tex_view,guard_depth_comparison,sampler_for,ssbo_slow) is only compared on memo misses. One fix: for one draw in N, run the checking pass withsm_mode = tm_mode = 0.gpu_buffer_bind,memory_protect_gpu,memory_note_gpu_write,memory_stamp_gpu,texture_written, memo stores). That's fine for a diagnostic, but say so in the switch row, so nobody times=check.desc_plan_fast::State::plans/by_progare never pruned. A Program freed and made again at a new address leaves its plan behind for the life of the thread. Risks says the RAM is "proportional to active shaders", but it grows with every program address ever seen. Drop entries when a program is destroyed, or cap the table.build_descriptorswrites by default (table_track_open: "a table entry bound one frame and not the next", 60 lines) and theubo_ssbo_fastsummary. Either mention that in Risks or keep it.Testing:
=checkrun and HOS_AB timing atf4d9fbe07;32bb108;test_vk_desc_plan_fast.py, 14 of 14 broken variants caught;test_hos_ab,test_tls_objects,test_vk_braces; a syntax-only compile).1681d8c1c;=check, which waits on a BigBean's 👍;mainagainst the head at player settings;run_all.All of these hold the merge.
Overlaps and merge order: #3080, #2515, #3116, #2948, #2816, #1334, and BeanBot's #2045 and #2210 touch the same descriptor build. If any of them merges first, this one has to port its changes into the plan executor and run check mode again. Merging this one first puts that cost on each of them instead. Whichever goes first, each one's description should say so.
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.