perf(vk): inline pointer-bump DescWriter staging in build_descriptors (RX_VK_DESC_WRITER_INLINE) #3049
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!3049
Loading…
Reference in a new issue
No description provided.
Delete branch "siantm/Longshot:perf/vk-desc-writer-inline"
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
Eliminates per-binding
std::vectorgrowth/capacity checks and temporary descriptor staging allocations insidebuild_descriptors()anduniform_range()on the Vulkan replay thread without adding large TLS tables:gpu/vk/desc_writer_inline.h,gpu/vk/vk_draw.cpp): pre-computes tightPlanbounds fromProgram::stagesand unpackeddesc_counts, stages descriptor writes/buffers/images/views/UBO entries/depth samples into stack-inlineInlineCursorBuf<T, N>buffers (*cur_++ = vwith zero inner-loop reallocation checks and reusable TLS fallback scratch for rare overflow shaders), and commits in one slice viaStage::commit().DescWriter& persistentBankCachecapacity: preservesstruct DescWriterfields forupdate_ubo_descriptors(), replaces TLSstatic thread_local std::vector<uint8_t> tmpchurn inuniform_range()with stackuint8_t stack_tmp[0xA00], and clearsBankCache::bytesvia.clear()across recordings instead of reallocatingc = BankCache{}.gpu/vk/switches.def): addsRX_VK_DESC_WRITER_INLINE(1ON default,0OFF legacy,checklockstep shadow parity verification logging counts and mismatches every100000checks), sampled per recording viadraw_begin_recording().First files to read:
gpu/vk/desc_writer_inline.h,gpu/vk/vk_draw.cpp(build_descriptors,uniform_range,desc_writer_inline_begin_recording),tests/test_vk_desc_writer_inline.py.Testing
Tested:
RX_VK_DESC_WRITER_INLINE=checkparity run inmarket(Market_Child, pre-rebase commitc9c85be6e):2348frames at78.3fps (1% low 61.5 fps),3,300,000+checks,0mismatches,RUN_ERROR=None.7d96eed8f, rebased onto main7bc53f84; Windows 11, llvm-mingw clang++ and g++):tests/test_vk_desc_writer_inline.pypasses with both compilers and catches all 18 broken variants.vk_draw.cpppasses aclang++ -fsyntax-onlycompile with the renderer's own command from the build plan.tests/run_all.py --changed origin/mainon89d0e7fc8(224 checks): 210 passed, 3 failed, 11 skipped.test_vk_desc_writer_inlinefailed because its harness did not know #3048's code inbuild_descriptors; fixed in7d96eed8f.test_turf_budgetfails the same way on main7bc53f84on this PC (order_watch_onundeclared, fromvk_replay.cpp, which this PR does not touch), andtest_fallback_buffer_cleanuptimed out (it fails on main on this PC too).run_all.py --exactfor the checks that cutbuild_descriptorsordraw_begin_recording(test_vk_draw_overhead_lean,test_hos_ab,test_switch_table,test_dummy_views,test_handle_table_arrays,test_draw_binds,test_draw_stream_visibility,test_fsr_uniform_ownership,test_recording_admission): 9 passed. No renderer build or game run on this head.Still to test:
@Beanstalk). The=checkrun above is from before the check-mode pointer fix; a new=checkrun in the game should now report 0 mismatches.Measurements
Verdict: Faster with
RX_VK_DESC_WRITER_INLINEON (default) on the RTX 4060, no difference on an RX 580 (below):+1.19%fps (-0.150 msmean frame time, 95% CI+0.81%to+1.61%across 5/5 runs;desc_ms -9.20%(-0.2362 ms),draw_ms -3.40%(-0.2448 ms), higher1%and0.1%lows). Switch ships at default1(ON).Setup: Windows 11, NVIDIA GeForce RTX 4060;
market(Market, child (crowded)), 804x581, Custom preset, 50% internal res (768x432), 1280x720 output, uncapped (HOS_FPS_MAX=1000),RX_VK_FRAME_TRACE=1, 5×90 s interleaved in-run A/B (HOS_AB=RX_VK_DESC_WRITER_INLINE=0,3,0) onc9c85be6e(SIDE_0unset = ON vsSIDE_1=0= OFF). Both sides are this PR's build, and=0still runs the build's other changes, so this is ON vs OFF, not main vs this PR. It also used 50% internal resolution, not the normal preset. The PR is now on main7bc53f84; the rebase over #3048 (RX_VK_DRAW_OVERHEAD_LEAN) keeps itsunbindable_imagemarking andlean_bind_stamp()in the staged texture and uniform-buffer paths. The rebase and the check-mode fix leave the ON path's per-draw work as measured: check mode now builds the staged pointers the way ON does, and the bank cache's reset at a recording's start moves the copy's buffer instead of clearing fields one by one. The numbers have not been measured again.d53dbe94b(measured as this PR'sRX_VK_DESC_WRITER_INLINE=0path on c9c85be6e)RX_VK_DESC_WRITER_INLINE=1)79.3680.29+1.19%(CI+0.81%..+1.61%)81.2382.00+0.77fps60.9061.35+0.45fps45.7247.10+1.38fpsms)12.6015 ms12.4555 ms-0.1460 ms(-1.16%)desc_ms2.5660 ms2.3298 ms-0.2362 ms(-9.20%)draw_ms7.1899 ms6.9451 ms-0.2448 ms(-3.40%)0.000.000.00On a second system the gain does not show: HumanBean's AMD Lab (Linux, Mesa RADV, Radeon RX 580, Core i7-9700K; Market child, 1280x720 output at 33% render scale, uncapped, 3 alternating pairs of 60 s, PR head
f17d456a5merged onto mainee9e1ed76,=0vs=1in one build): average fps60.52→60.23(-0.48%, within the run-to-run spread), p9919.72→19.73 ms, renderer CPU thread9.43 / 9.66 / 9.62 ms(=0) vs9.64 / 9.50 / 9.56 ms(=1): no difference. That lab is GPU-bound at any scale, so the CPU thread is the row to read. An earlier run there at 50% (-0.88%) was superseded by this one.Risks
RX_VK_DESC_WRITER_INLINE(=0falls back immediately to legacystd::vector::push_backat any recording boundary), overflow-checked with reusable TLS scratch for programs exceeding inline capacity, and verified with an=checklockstep comparison (3.3M+checks,0mismatches). That run was before=checkcompared the inline path's own write pointers (e94116358). No API structs, persistent files, or shader formats change.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses:run_all.py --changed origin/main(the 206 checks that read the changed files) passes except 6 that also fail on mainb4d56f526on this PC, named in Testing.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
Tested in game: Windows 11, NVIDIA GeForce RTX 4060 (Vulkan 1.4), market (Market_Child): 30 s RX_VK_DESC_WRITER_INLINE=check (2348 frames, 78.3 fps, 3.3M+ checks, 0 mismatches); 5x90 s in-run A/B (80.29 ON vs 79.36 OFF fps, +1.19%, 95% CI +0.81%..+1.61%, desc_ms -9.20%); rebased head
3f811745bcompiled (0 failed) and passed 8/8 strict descriptor/switch tests.Possibly related, for context:
@review
Recommendation: Approve. The reported 1.19% FPS gain is from an older branch revision at reduced resolution, with the legacy switch as the comparison rather than the stated main commit. The default-on renderer change still needs measurements against the actual base at player settings and coverage on the affected Tier 1 systems. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
Descriptor builds stage writes in inline buffers and retain scratch capacity to reduce allocation and vector growth overhead. This adds a second assembly path, per-build planning and copying, and retained per-thread memory.
Should fix (1): not blocking, but worth doing before merging.
gpu/vk/vk_draw.cpp:5648: Check mode uses the legacy pointer calculation for both outputs, so its pointer comparison does not exercise the inline path's pointer calculation. (more on the line) Do: Construct the staged write pointers using the Mode-1 calculation in check mode and compare their offsets against the legacy pointers; add a check-mode test that corrupts that calculation.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven against the requested baseline. Five interleaved runs on an RTX 4060 reported 80.29 versus 79.36 FPS and improved lows, but compared switch modes on pre-rebase c9c85be6e at 50% internal resolution, not HEAD against its base at the normal preset and resolution.
Other systems: The changed path handles graphics and compute descriptors on Windows and Linux, including texture hazards and descriptor reuse. The supplied game run covers Windows and NVIDIA only; AMD, Linux and Steam Deck behavior and performance remain unverified. The host API and shaders do not change.
Switches: RX_VK_DESC_WRITER_INLINE is added, default 1; 0 uses the legacy path and check compares staged results. Its table row is present, but the default's benefit across supported systems is not yet established.
Reviewed:
3f811745bbagainst455b083738: Read the repository rules, PR template, commit and changed production paths, including descriptor consumers and the staging header. Reviewed the new test harness and mutations, and skimmed the remaining unchanged portions of vk_draw.cpp and test_hos_ab.py. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the change were run, as requested. The supplied Windows parity and A/B results were considered; CI is 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.
@ -5516,0 +5645,4 @@}if constexpr (Mode != 1) draw_sampled().push_back(tex);};auto buf_ptr_at = [&](size_t first) -> const VkDescriptorBufferInfo* {L1 (should fix): Check mode uses the legacy pointer calculation for both outputs, so its pointer comparison does not exercise the inline path's pointer calculation.
When: In mode 2, buf_ptr_at, img_ptr_at and view_ptr_at all take the non-Mode-1 branch; the same write is then emitted to both writers. A wrong Mode-1 backing pointer can therefore produce zero check mismatches while the default path supplies an invalid descriptor pointer.
Do: Construct the staged write pointers using the Mode-1 calculation in check mode and compare their offsets against the legacy pointers; add a check-mode test that corrupts that calculation.
3f811745bb78e7ccba4c- draw_begin_recording keeps the bank cache's copy capacity by moving its buffer across `c = BankCache{}` rather than resetting the other fields one by one: the same result, and a field added to BankCache is reset without anyone having to remember it here. - tests/draw_stream_visibility_test.cpp, fsr_uniform_ownership_test.cpp, recording_admission_test.cpp: stubs for desc_writer_inline_begin_recording and desc_writer_inline_mode (1, the shipped default), and the bank cache's `bytes` in the two stand-in BankCaches. tests/test_dummy_views.py: the emitters (emit_img, emit_sampled, emit_depth, cur_img_count) the cut texture loop now calls. All four failed to compile against this PR's vk_draw.cpp; test_vk_desc_writer_inline.py's source check follows the reset's new line. Co-Authored-By: Claude Opus 5.5 <[email protected]>Rebased onto main
b4d56f526because the PR could not be merged as it was. I also fixed L1 and five checks that this PR broke. The head is nowf17d456a5.Rebase:
gpu/vk/vk_draw.cppconflicted with #3032 (depth-comparison dummy views) and #2822 (which removedrec_grass_reach). The resolution keeps main'sdummy_view(the depth dummy for comparison samplers) and this PR'semit_sampled/emit_depth, in both texture loops, and leaves out therec_grass_reachline that main removed.L1 (check mode compared only the legacy pointer calculation): fixed in
e94116358.stage.out_*_base + first), in check mode too. The legacy write getsout.*.data() + first. This is done byemit_buf_write/emit_img_write/emit_view_writeinbuild_descriptors, which replaceemit_writeand the*_ptr_athelpers.verify_parity(gpu/vk/desc_writer_inline.h) first checks that the staged bases are the writer's own arrays, then that every write's buffer, image and texel-view pointer equals the legacy one. A mismatch names each side's index.tests/test_vk_desc_writer_inline.py:verify_parity, and so must a staged write pointer at a different index;verify_skip_staged_baseandcheck_wrong_staged_{buf,img,view}_ptr. The last three move the Mode-1 pointer by one element and run check mode alone, with no mode-1 build compared (-DDWI_CHECK_MODE_ONLY). Check mode has to count the mismatch.Checks this PR broke (none of them was in the 8 checks run before):
78e7ccba4:test_handle_table_arraysrequiredstage_handles(..., table.data(), p.key), which this PR changed totable_ptr. The check now requires the new call and that both tables are sized tod.count.f17d456a5: four fixtures that cut code fromvk_draw.cppno longer compiled:draw_stream_visibility_test.cpp,fsr_uniform_ownership_test.cpp,recording_admission_test.cpp: they were missingdesc_writer_inline_begin_recording/desc_writer_inline_mode, and two of them stubBankCachewithout the fields the reset wrote.test_dummy_views.py: it was missing the texture loop's emitters.bytesout, doesc = BankCache{}, and movesbytesback. That keeps the buffer's capacity as before, without listing every field, so a field added toBankCachelater is reset too. The stubs needed onlybytesafter that.Tested (Windows 11, llvm-mingw, through the PC's job queue):
python -I -B tests/test_vk_desc_writer_inline.py: PASS with clang++ and g++; all 18 broken variants caught.python -I -B tests/run_all.py --changed origin/mainon78e7ccba4(206 checks): 195 passed, 11 failed.b4d56f526on this PC:test_fallback_buffer_cleanup,test_jobs_wait_runs_queued,test_mesh_args_cleanup,test_pipeline_cache_save,test_prepare_stall,test_recorder_own_idle. I ran them with--exactin a checkout ofb4d56f526.test_mesh_fallback_capacityhit its 60 s timeout while the PC was loaded.run_all.py --exactonf17d456a5, covering those 4,test_mesh_fallback_capacity,test_handle_table_arrays,test_vk_desc_writer_inline,test_vk_ubo_ssbo_fast,test_desc_countsandtest_hos_ab: 10 passed, 0 failed.L2 (base vs head at player settings): still open, and you're right. The 1.19% compares
=1against=0inside the same build (c9c85be6e) at 50% internal resolution, so it is not main vs this PR. The description now says that, and the table header no longer says "main @d53dbe94b". An interleaved base-vs-head run at the normal preset and resolution, in the market and a heavy area, still needs the farm or a person; I have not run it.L3 (Tier 1 systems): still open. Only Windows with an RTX 4060 has a game run. AMD, Linux and Steam Deck need the farm (
@Beanstalk). The in-game=checkrun (3.3M+ checks, 0 mismatches) was before the L1 fix, so it did not test the inline pointers. A new=checkrun on this head is the useful one. Both are listed under Still to test.The description's Testing, Measurements, Risks and checklist are updated to match.
@siantm only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.@review
@beanstalk
Beanstalk test farm · an earlier run: commit
f17d456(the newer results are in a comment below)Commit
f17d456· approved by HumanBean (reviewed) · dashboard⚠️ Note: The fixed CPU-focused settings do not test each device's normal preset and resolution; the farm also cannot isolate descriptor or draw milliseconds or reliably establish the claimed 1.19% gain with these samples.
⚠️ Note: Check mode fails on a mismatch log, but the plan cannot guarantee that the periodic 100,000-check progress line is reached or that rare overflow shaders are exercised.
Done (started 06:39 UTC, last report 23:25 UTC). Comment
@Beanstalkto run it again.nvidiaamdintellinuxwindowssteamdeckCouldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
nvidia, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'snvidia, report 2:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'samd, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'samd, report 2:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'sintel, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'sintel, report 2:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'slinux, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'slinux, report 2:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'sWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)The farm will compare main and the PR in the Market and Kokiri Forest, using uncapped, CPU-focused gameplay with three starts per side and 30-second measurements at each location. A separate check-mode run will exercise descriptor parity, while still-scene screenshots test rendering against main. Crashes, descriptor mismatch logs, substantial frame-time regressions, or excessive screenshot differences fail the plan. NVIDIA, AMD, Intel, Linux, Windows and Steam Deck are covered; the Steam Deck target will wait for a tester to come online. No tester online now matches steamdeck: that target waits for one.
check(PR only).market-entrance(settings vsync=2, resolution=1, frame_rate_cap=6, quality_preset=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 forest to compare with main, measure forest 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; switchesHOS_OUTPUT_RES=1280x720,RX_VK_AUTO_TUNE=0), then teleport to Market, measure market-check for 30 s (after 10 s warm-up), teleport to Kokiri Forest, measure forest-check for 30 s (after 10 s warm-up); 1 run on each side.Measurements on `nvidia`, for the PR description
Verdict: could not be judged on nvidia (2 reports).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window+dlss
NVIDIA GeForce RTX 5090, 621.47.0AMD Ryzen 9 9950X3D 16-Core Processor, 48 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, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); descriptor-parity, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=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, forest 30 s after 10 s warm-up; descriptor-parity: 1 game start a side, market-check 30 s after 10 s warm-up, forest-check 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)Nothing was measured: no metric came back.
Flags and settings
RX_VK_DESC_WRITER_INLINEcheckAs Markdown for the PR description:
Measurements on `amd`, for the PR description
Verdict: could not be judged on amd (2 reports).
Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 9070 (RADV GFX1201), 26.3.1AMD Ryzen 5 7600X3D 6-Core Processor, 32 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: default-performance, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); descriptor-parity, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=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, forest 30 s after 10 s warm-up; descriptor-parity: 1 game start a side, market-check 30 s after 10 s warm-up, forest-check 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)Nothing was measured: no metric came back.
Flags and settings
RX_VK_DESC_WRITER_INLINEcheckAs Markdown for the PR description:
Measurements on `intel`, for the PR description
Verdict: could not be judged on intel (2 reports).
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, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); descriptor-parity, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=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, forest 30 s after 10 s warm-up; descriptor-parity: 1 game start a side, market-check 30 s after 10 s warm-up, forest-check 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)Nothing was measured: no metric came back.
Flags and settings
RX_VK_DESC_WRITER_INLINEcheckAs Markdown for the PR description:
Measurements on `linux`, for the PR description
Verdict: could not be judged on linux (2 reports).
Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 9070 (RADV GFX1201), 26.3.1AMD Ryzen 5 7600X3D 6-Core Processor, 32 GB RAM; 2: linux+amd+radv+igpuAMD Radeon 760M Graphics (RADV PHOENIX), 26.0.8AMD Ryzen 5 230 w/ Radeon 760M Graphics, 16 GB RAMScene: default-performance, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); descriptor-parity, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=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, forest 30 s after 10 s warm-up; descriptor-parity: 1 game start a side, market-check 30 s after 10 s warm-up, forest-check 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)Nothing was measured: no metric came back.
Flags and settings
RX_VK_DESC_WRITER_INLINEcheckAs Markdown for the PR description:
Measurements on `windows`, for the PR description
Verdict: could not be judged on windows (2 reports).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess
NVIDIA GeForce RTX 4090, 621.40.013th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+window+xessNVIDIA GeForce GTX 980, 582.78.0Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 32 GB RAMScene: default-performance, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); descriptor-parity, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=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, forest 30 s after 10 s warm-up; descriptor-parity: 1 game start a side, market-check 30 s after 10 s warm-up, forest-check 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)Nothing was measured: no metric came back.
Flags and settings
RX_VK_DESC_WRITER_INLINEcheckAs Markdown for the PR description:
Measurements on `steamdeck`, for the PR description
Verdict: could not be judged on steamdeck (2 reports).
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, 12 GB RAMScene: default-performance, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); descriptor-parity, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=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, forest 30 s after 10 s warm-up; descriptor-parity: 1 game start a side, market-check 30 s after 10 s warm-up, forest-check 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)Nothing was measured: no metric came back.
Flags and settings
RX_VK_DESC_WRITER_INLINEcheckAs Markdown for the PR description:
The testers' hardware
nvidiaNVIDIA GeForce RTX 5090, 621.47.0AMD Ryzen 9 9950X3D 16-Core Processor, 48 GB RAMnvidiaNVIDIA GeForce RTX 4090, 621.40.013th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAMamdAMD Radeon RX 9070 (RADV GFX1201), 26.3.1AMD Ryzen 5 7600X3D 6-Core Processor, 32 GB RAMamdAMD 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 RAMlinuxAMD Radeon RX 9070 (RADV GFX1201), 26.3.1AMD Ryzen 5 7600X3D 6-Core Processor, 32 GB RAMlinuxAMD Radeon 760M Graphics (RADV PHOENIX), 26.0.8AMD Ryzen 5 230 w/ Radeon 760M Graphics, 16 GB RAMwindowsNVIDIA GeForce RTX 4090, 621.40.013th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAMwindowsNVIDIA GeForce GTX 980, 582.78.0Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 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, 12 GB RAMRecommendation: Approve. The code is ready: only testing is left. The pointer-parity fix addresses the earlier code finding, but the performance gain against the base and behavior across affected Tier 1 systems remain unmeasured. CI is still running. Recommend approval; not approved on the forge.
The change stages Vulkan descriptor writes in inline buffers and retains scratch capacity to reduce allocation and per-binding overhead. It adds a check mode and substantial staging code; its gain against main has not yet been established.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
Questions (1) (not confirmed from the code; they don't hold the recommendation)
Since the last review (on
3f811745bb)Resolved: L1 (Check mode uses the legacy pointer calculation for both outputs, so its pointer comparison…)
Still open: L2 (The measured improvement does not establish the gain against the actual base at the settin…); L3 (The default-on descriptor path has not been exercised across the Tier 1 systems it affects…)
Checks: Still running: 10 checks.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven against the base: five interleaved runs on a Windows RTX 4060 reported 80.29 versus 79.36 fps, with higher lows, but compared ON and OFF in the same older PR build at 50% internal resolution. They do not measure the full change against main at normal player settings.
Other systems: The descriptor path affects Vulkan rendering across GPUs and operating systems, including Linux and Steam Deck. The recorded game parity run was on Windows NVIDIA and predates the pointer fix; AMD, Linux, Steam Deck and current-head game results are still needed.
Switches: RX_VK_DESC_WRITER_INLINE is added, default 1; 0 selects legacy staging and check enables parity comparison. The default's performance against main and across affected systems remains unproven.
Reviewed:
f17d456a59againstb4d56f5264: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the changed pointer emitters and parity verifier, the recording reset, and the fix diff. Skimmed the remaining diff and test harness; the complete changed code and all supporting callers were not read. docs/review-checklist.md and the adjacent Tooling checkout were unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands that build, execute tests or run the game were run. The author reports current-head game-free tests passing and an older Windows NVIDIA game run; CI is still running.
Overlaps and merge order: Not checked.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
AMD Lab Market A/B: PR head
f17d456a59ffmerged ontomainee9e1ed76, usingRX_VK_DESC_WRITER_INLINE=0(A) andRX_VK_DESC_WRITER_INLINE=1(B) on the same build.Slower in these captures. Median average FPS changed by -0.88%.
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, 60 seconds per capture after warm-up, each a timing job of the queue.
The two ranges only just separate (highest B 60.13, lowest A 60.15) and the gap is under 1%, so read this as no gain on this PC rather than a measurable loss.
AMD Lab Market A/B: PR head
f17d456a59ffmerged ontomainee9e1ed76, usingRX_VK_DESC_WRITER_INLINE=0(A) andRX_VK_DESC_WRITER_INLINE=1(B) on the same build.Within the run-to-run spread. Median average FPS changed by -0.48%.
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 at 33% render scale, uncapped with V-Sync and frame generation off. Three alternating pairs, 60 seconds per capture after warm-up, each a timing job of the queue.
This replaces my earlier lab run at 50% render scale: its -0.9% did not hold up. The RX 580 lab can't be made cleanly CPU-bound (neither scale nor scene takes the GPU out of the frame), so the CPU thread row is the one to read for this change: no difference there either.
f17d456a597d96eed8fbBeanstalk test farm
Commit
7d96eed· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.Rebased onto main
7bc53f84because the PR could not be merged. The head is now7d96eed8f.Rebase:
gpu/vk/vk_draw.cppconflicted with #3048 (RX_VK_DRAW_OVERHEAD_LEAN), which changed the same lines ofbuild_descriptors. The resolution keeps both sides:out.unbindable_imageas #3048 does, then stage the image with this PR'semit_img;emit_ubowith #3048'slean_bind_stamp();desc_fp()reserve stays, next to this PR's per-modedesc_fp()clear;*_begin_recording()calls are kept.7d96eed8fupdates this PR's own check for #3048: its harness stubsdraw_overhead_lean_mode,lean_bind_stamp()anddraw_overhead_lean::image_unbindable. Its copy of the legacy writer is now made withDescWriter(), which reserves since #3048, and then assigned. A copy-constructed empty vector has no storage, so the pointer of a count-0 write had become null in the copy only.Checks on this head (Windows 11, llvm-mingw clang++, each a job of the PC's queue):
tests/run_all.py --changed origin/mainon89d0e7fc8(224 checks): 210 passed, 3 failed, 11 skipped.test_vk_desc_writer_inlineis fixed in7d96eed8f(above).test_turf_budgetfails the same way on main7bc53f84on this PC (order_watch_onandsync_watch_event_onundeclared, fromvk_replay.cpp, which this PR doesn't touch).test_fallback_buffer_cleanuptimed out; it fails on main on this PC too.tests/run_all.py --exact tests/test_vk_desc_writer_inline.pyon7d96eed8f: passed (clang++ and g++, all 18 broken variants caught).--exactfor the checks that cutbuild_descriptorsordraw_begin_recording(test_vk_draw_overhead_lean,test_hos_ab,test_switch_table,test_dummy_views,test_handle_table_arrays,test_draw_binds,test_draw_stream_visibility,test_fsr_uniform_ownership,test_recording_admission): 9 passed.vk_draw.cppwithclang++ -fsyntax-onlyand the renderer's own command from the build plan: ok.HumanBean's AMD Lab runs (RX 580, Linux RADV): thank you. The 33% run (102412) replaces the 50% one (102278, -0.88%). Average fps moved by -0.48% (60.52 → 60.23), within the run-to-run spread. The renderer's CPU thread took 9.43 / 9.66 / 9.62 ms with the switch off and 9.64 / 9.50 / 9.56 ms with it on: no difference. So the gain measured on the RTX 4060 doesn't show on that PC. That is one system without a gain, and none measured slower, so the default stays
1. The description's Measurements now give these numbers next to the RTX 4060's.L2 (base vs head at the settings players use) and L3 (the other Tier 1 systems, Steam Deck included): still open. I can't run them here (one Windows RTX 4060 PC on a shared queue); they need the Test Farm or people. The farm run of 2026-12-04 couldn't be judged on any target: the testers' baseline setup stopped on SDL URLs in main's
tools.lock. It says nothing about this PR either way. A re-run needs a BigBeans member to start the farm again after this rebase.BeanBot's question, whether the farm can run current-head check-mode parity and base-vs-head at normal settings: its plan for this PR already has a
descriptor-paritycell withRX_VK_DESC_WRITER_INLINE=check. But it runs at fixed CPU-focused settings, not each device's normal preset, and the plan's own note says it can't isolate descriptor milliseconds. So L2 at normal settings still needs a person or a different farm plan.Recommendation: Wait (on a main-against-head measurement at players' settings, and a game run of the current head). The code reads correct and the switch is a clean kill switch. But the only gain is +1.2% ON against OFF inside one build on one RTX 4060 at 50% internal resolution, with no change on an RX 580. Head
7d96eed8f, rebased throughbuild_descriptorsover #3048, has not run in the game. That is not enough yet for ~500 lines of a second descriptor path that ships ON by default.For a player: slightly less CPU time building descriptors on the renderer's thread. On a CPU-bound NVIDIA PC that may be about 1% fps; the GPU-bound RX 580 showed nothing. Nothing else changes for players. The code is not simpler:
build_descriptorsbecomes a three-mode templated lambda with nine staging buffers.Does it help: Unproven against main. RTX 4060, Windows, Market child, 5x90 s in-run
HOS_ABonc9c85be6e(an older head), ON against OFF in the same build at 50% internal res: +1.19% fps (CI +0.81..+1.61),desc_ms-9.2%, lows a little higher. RX 580 / RADV (HumanBean, 3 pairs,f17d456a5): -0.48% fps, renderer CPU thread 9.43/9.66/9.62 ms against 9.64/9.50/9.56 ms, so no difference. There is no main-against-head run, none at the normal preset, and none on the current head. The 2026-12-04 farm run couldn't be judged on any target (the testers' setup stopped ontools.lock's SDL URLs), so it says nothing either way.Other systems: every Vulkan draw and dispatch on every GPU and OS goes through the new default path. The descriptor contents are checked to be identical by
=check, but that game run (3.3M checks, 0 mismatches) predates the L1 check-mode fix and the #3048 rebase. Nothing has run on AMD or Intel on Windows, or on the Steam Deck. Stack use on the replay thread grows by about 8 KB abuild_descriptorscall (theStage's inline arrays) plus 2.5 KB inuniform_range. That is fine on an 8 MB Linux stack and on a 1 MB Windows default unless the replay thread is made smaller; I didn't find where its size is set.Switches:
RX_VK_DESC_WRITER_INLINE, a kill switch (0legacy,checkboth paths and compare), default1, row present inswitches.def, read per recording withHOS_AB. The default rests on one PC's ON/OFF gain. If a main-against-head run shows nothing, the default should be0, or the PR closed in favour of #2989's plan.Reviewed:
7d96eed8f:gpu/vk/desc_writer_inline.hin full, the wholegpu/vk/vk_draw.cppdiff, the switch row, and the head'sbuild_descriptorschecked for writes toout.*outside the emitters (none). Also read the head's readers ofdesc_fp()(cb.desc.fp, guarded bydesc_fp_on) and ofdraw_sampled()(both after the build), anduniform_range's0xA00clamp. Skimmed the fixture updates (tests/*_test.cpp,test_dummy_views.py,test_handle_table_arrays.py,test_hos_ab.py). Not read in full:tests/test_vk_desc_writer_inline.py(1,089 lines). Nothing run.Fixed in this review: nothing.
Checked and fine:
out.bufs/imgs/viewsafterreserve(nbuf/nimg/nview), andcommit'sassignof at most the reserved count does not reallocate, so the pointers stay valid.verify_paritychecks the bases too.emit_fpand the miss path'snote_fpare exclusive); UBO entries come only from constant buffers. SoInlineCursorBuf::push, which has no bound check, cannot overrun as long asdesc_countsis right, which the legacy pointer stability already relied on.desc_fp()is left uncleared in mode 1 whendesc_fp_onis off, but its only reader (cb.desc.fp) is behindif (desc_fp_on).draw_sampled()is assigned by the commit before its readers.prepareis reused immediately. The overflow scratch is per-thread and reused.uniform_range's stack buffer is bounded byn = clamp(..., 16, 0xA00). Keeping theBankCache::bytescapacity across recordings resets every other field, and a field added later is reset too.draw_begin_recordingbefore the bank reset that reads it, like the other per-recording switches.Suggestions
gpu/vk/vk_draw.cpp:5453:desc_fp_noteis no longer called (thenote_fplambda copies it). Remove it, or havenote_fpcall it, so the two can't drift.scripts/profiling/cpu_functions.jsonstill lists it.GONE(...)of the losing path (and ofcheck), sobuild_descriptorsgoes back to one path.Questions
Testing: By the author: game-free checks on this head (
test_vk_desc_writer_inlinewith both compilers, 18 broken variants caught; 9 checks that cutbuild_descriptorspass;clang++ -fsyntax-only) and the RTX 4060 runs above on an older head. By HumanBean: the RX 580 A/B. The farm run couldn't be judged. CI not checked here. What holds the merge: (1) a game run of7d96eed8fwith=check(0 mismatches after the L1 fix), and (2) main against this head, interleaved, at the normal preset in the Market and a heavy area, on the RTX 4060 and one AMD or Steam Deck system (a farm re-run oncetools.lockis fixed would cover it).Overlaps and merge order: #2989 (
RX_VK_DESC_PLAN_FAST, per-program descriptor plans) does the same job in the same function. Only one of the two plans should land; measure them against each other before either merges. #3304, #3303, #3116, #3080 and #3046 also touchbuild_descriptors/vk_draw.cpp(not read here). Whichever lands second rebases.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.