vkback: flatten ListRec roots and remove per-op stack/pass allocations #14
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory!14
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-14"
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?
@olafix52 on GitHub · 2026-11-30 17:45 UTC · original
olafix52:perf/listrec-draw-hotpath→main· +369 −125 · 7 files · 2 commits · merged 2026-11-30 22:11 UTCSummary
Flattens per-command-list root state in
ListRecand removes repeated per-draw and per-call heap allocations on the renderer thread (live: run_list/rec: draw/dispatch).Changes
listrec.rs: replace per-stageHashMaproot tables/views/constants with flat[0..64]arrays +u64presence bitmasks (spilling slots>= 64to overflow maps), inline up to 16u32root constants per slot (ConstSlot), cachecbv_heap_startonset_heaps, and replaceVec<u32>vb_slotswith a compactCopyVbSlots([u8; 16],len).lib.rs,viewdesc.rs: return stack([u32; 64], usize)frompush_block, build color attachments on a stack[vk::RenderingAttachmentInfo; 8]indraw_call_inner, cachevk::Extent2Dinpass_opento skip attachment construction when continuing an open pass (same_pass(), preserving existing render-pass invalidation rules), and reuseListRecVecbuffers inset_heaps/set_targets/set_viewports/set_scissors.live.rs: decodeComputeConstants/GraphicsConstants(<= 64dwords) andTargets(<= 8RTVs) through stack buffers.dump.rs,rtcheck.rs: update readers toListRecaccessors.greenfield/tools/policy/oversize.txt: lowergreenfield/vkback/src/lib.rscount from 4378 to 4368.AGENTS.mdrule 24): removes per-draw allocator churn cleanly on the renderer critical path, helping both now on renderer-heavy windows and as upstream bottlenecks shrink.Measurements
experimental-11.0-20261123b).0..140world s, warm shader store,VKTORY_LOCK=1 MEASURE=1,VKB_LAT+greenfield/tools/frec/frames.py 0 140 --no-perf), interleavedA B B A(measured pre-rebase59bfca1vsmain7403bee; rebased cleanly onto8a3cb80with identical code diff):draw/dispatch(ms/f, ns/draw)run_list(ms/f)main(7403bee)listrec-hotpathlistrec-hotpathmain(7403bee)rec: draw/dispatch5.45 -> 4.23 ms/f (634.5 -> 510.5 ns/draw, -19.5%),live: run_list12.43 -> 10.84 ms/f (-12.8%), and settledlast 240 framesrenderer busy 29.15 -> 27.20 ms/f (-1.95 ms/f). Whole-frame FPS stayed within run-to-run variance becausetitle waitabsorbed part of the slack (7.55 -> 9.00 ms/f) alongside26.1-26.3 msGPU busy.Verification (rebased
3d70e70on8a3cb80)cargo test -p vkback --lib -j 6: 146 passed, 0 failed, 3 ignored.cargo test -p vkback --test policy -j 6: 6 passed, 0 failed.cargo xtask policy:asset policy: 533 files ok.3d70e7045eto4e6182f05a@olafix52 on GitHub · 2026-11-30 21:09 UTC · original
Rebased onto
main(74587c3, after #13) and updatedgreenfield/tools/policy/oversize.txt(greenfield/vkback/src/lib.rsat4366). New commit:4e6182f.Re-verification
cargo test -p vkback --lib -j 6:148 passed; 0 failed; 3 ignoredcargo test -p vkback --test policy -j 6:6 passed; 0 failedcargo xtask policy:533 files okVulkan validation run (AGENTS.md rule 30)
Run under
VK_LAYER_KHRONOS_validation(1.4.363,VK_KHRONOS_VALIDATION_REPORT_FLAGS=error,VK_KHRONOS_VALIDATION_DUPLICATE_MESSAGE_LIMIT=3) on the available world save (94.0 sstartup +65.8 sin the world):docs/ROADMAP.md(Vulkan validation errors).UNASSIGNED-Threading-MultipleThreads-ReadUNASSIGNED-Threading-MultipleThreads-WriteVUID-RuntimeSpirv-None-06288VUID-VkBufferCreateInfo-size-06409VUID-VkComputePipelineCreateInfo-layout-01687VUID-VkDescriptorAddressInfoEXT-nullDescriptor-08938VUID-VkDescriptorAddressInfoEXT-range-08940VUID-VkDescriptorGetInfoEXT-type-12222VUID-VkDescriptorGetInfoEXT-type-12223VUID-VkExportMemoryAllocateInfo-handleTypes-09860VUID-VkGraphicsPipelineCreateInfo-layout-01688VUID-VkPipelineLayoutCreateInfo-descriptorType-03018VUID-VkPipelineLayoutCreateInfo-descriptorType-03024VUID-VkPipelineLayoutCreateInfo-descriptorType-03031VUID-VkPipelineLayoutCreateInfo-pSetLayouts-03039VUID-VkQueryPoolCreateInfo-meshShaderQueries-07069VUID-VkRayTracingPipelineCreateInfoKHR-layout-03428VUID-VkRenderingInfo-None-08994VUID-VkShaderModuleCreateInfo-pCode-08740VUID-VkShaderModuleCreateInfo-pCode-08742VUID-vkBindImageMemory-memory-02728VUID-vkCmdClearColorImage-image-00007VUID-vkCmdCopyBuffer-srcBuffer-00118VUID-vkCmdCopyBufferToImage-dstImage-00177VUID-vkCmdCopyImage-srcImage-01548VUID-vkCmdFillBuffer-dstBuffer-00029VUID-vkCmdPushConstants-size-arraylength@vktory6 on GitHub · 2026-11-30 22:11 UTC · original
Thanks, this is a clean win: −19.5 % per recorded draw, and fixed arrays are the natural shape for D3D12's root state. I pushed one commit on top (
a991679) and will squash-merge with it:Vecper stage and slot, kept across resets (a reset clears only the set bits; a slot is emptied when it is next set, its memory kept). It replaces the 16-word inline part plus spill list: one code path, and no allocation once the slots have been used.listrec::beyond_d3d12, whose message says the path is missing on purpose and names the limit.VbSlots: a vertex buffer slot past the 16 we keep is reported instead of silently left out.Checks:
cargo test -p vkback --lib(148) and--test policypass,cargo xtask policyOK; validation run (rule 30) on current main: no new errors, and none of the new limit reports fired.