vkback: primary-heap fast path, fused null/stride jobs, and flat Issues for index slots #143
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!143
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-143"
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-12-01 21:17 UTC · original
olafix52:perf/slot-reads-fast-path→main· +526 −127 · 9 files · 1 commits · merged 2026-12-01 21:56 UTCWhat
Addresses
docs/TASKS.mditem "Renderer CPU: index slots". Reproduces the console's descriptor-heap resolution behaviour faster on the renderer CPU without changing slot semantics (no silent fallbacks; existing retry/null rules preserved).greenfield/vkback/src/slotcache.rs: add direct 32-byte-strided flatprimarytable over[primary_start, primary_end)with bidirectional entry migration betweenprimaryandpages, plus unit testprimary_table_migrates_and_serves_direct_lookups.greenfield/vkback/src/live/slots.rs&greenfield/vkback/src/slotwrite.rs: hoistprimary_view_heap(),set_primary(ps, pe), andtrace.is_some(); take primary-heap direct index fast path inslot_reads_inner, pass precomputedindexintoslot_read_at_index/write_slot_uncounted_at/slot_retry_fail_at/slot_retry_done_at, and batchev_counts[6..=8].greenfield/vkback/src/descjob.rs,greenfield/vkback/src/slotwrite.rs&greenfield/vkback/src/bufview.rs: fuse optional(stride_entry, view_address = 0)update intoJob::Null { index, mask, stride_entry }(Ctx::run_null_stride), merge duplicateasideborrows inrun_job, addAside::collect_null/aside_null_slotskipping empty pushes, addwrite_null_slot_with_stride(stride_owedzeros +addr == 0buffer view path), plus unit testcollect_null_and_stride_writes_fuse_or_skip_empty.greenfield/vkback/src/notes.rs,greenfield/vkback/src/descjob.rs&greenfield/vkback/src/lib.rs: replaceIssuesFxMap<String, Issue>with move-to-frontVec<(Cow<'static, str>, Issue)>to eliminate string hashing on hot slot writes, plus unit testmove_to_front_promotes_hot_kinds_and_window_lines_sorts.greenfield/frame/src/d3d.rs&greenfield/vkback/src/slotwrite.rs: addResourceDesc::from_wordsandflags_of_words(with unit testfrom_words_matches_parse_and_flags_offset); inViewRef::Placeddrop 56-byte copies, redundantparse, unreachableNoneexit, and 5 per-slotTick::now()/pfspans while preservingbe: of which placed image creation (write_view).docs/learnings/vkback-live-cpu.md: updateCurrent stateand document the optimization findings.The reference
vkback's slot cache, async descriptor helper, and issue counter arevkback-specific mechanisms with no D3D12 counterpart incrates/victory-gpu.frame::d3d::ResourceDesc::from_wordsandflags_of_wordsmirrorframe::d3d::ResourceDesc::parseandD3D12_RESOURCE_DESC.Evidence
origin/mainbb383d5):cargo clippy --all-targets -j 6 -- -D warningsingreenfield/andgreenfield/wine/: 0 warnings, exit 0.cargo test -j 6ingreenfield/: 0 failures (frame: 13 passed;umem: 22 unit + 1 bench + 12 gpu + other crates passed, 3 ignored sparse probes;vkbacklib: 167 passed / 3 ignored;alias_binding: 1 passed;mutable_layout_probe: 1 passed;policy: 6 passed).ab7b4e6,boat-sarc0,RUN_SECS=105,VICTORY_HOST_PADS=off, RX 9070 XT, Mesa 26.3.1, steady 60-present windowsshown >= 1150;loud.txt: 0 unowned errors across all runs):loud.txt: 0 unowned).2,425shown frames,3,092pipelines built),loud.txt: 0 unowned; distinct VUIDs:VUID-VkBufferCreateInfo-size-06409,VUID-VkComputePipelineCreateInfo-layout-01687,VUID-VkGraphicsPipelineCreateInfo-layout-01688,VUID-VkRayTracingPipelineCreateInfoKHR-layout-03428(0 non-VUID errors, all 4 ondocs/TASKS.mdallowlist).idx-27.1%,cpu-17.5%, FPS +10.2%); the screenshot check covers descriptor/slot writes (rule 18); and the validation run confirms zero new Vulkan errors (rule 30).Checklist (docs/AGENTS.md)
docs/TASKS.mdnot edited, the fixed item named above (rule 29)unsafeblock has a// SAFETY:comment; no raw pointer around the borrow checker (rule 36)TRANSLATOR_VERSIONbumped if the translator's output changes (rule 27)Addresses docs/TASKS.md item 'Renderer CPU: index slots'. Changes: - slotcache.rs: add direct 32-byte-strided flat primary table over [primary_start, primary_end) with bidirectional entry migration between primary and pages, plus unit test primary_table_migrates_and_serves_direct_lookups. - live/slots.rs & slotwrite.rs: hoist primary_view_heap(), set_primary(ps, pe), and trace.is_some(); take primary-heap direct index fast path in slot_reads_inner and pass precomputed index to slot_read_at_index / write_slot_uncounted_at / slot_retry_fail_at / slot_retry_done_at; batch ev_counts[6..=8]. - descjob.rs, slotwrite.rs & bufview.rs: fuse optional (stride_entry, view_address = 0) update into Job::Null { index, mask, stride_entry } (Ctx::run_null_stride), merge duplicate aside borrows in run_job, add Aside::collect_null / aside_null_slot skipping empty pushes, add write_null_slot_with_stride (stride_owed zeros + addr == 0 buffer view path), plus unit test collect_null_and_stride_writes_fuse_or_skip_empty. - notes.rs, descjob.rs & lib.rs: replace Issues FxMap<String, Issue> with move-to-front Vec<(Cow<'static, str>, Issue)> to eliminate string hashing on hot slot writes, plus unit test move_to_front_promotes_hot_kinds_and_window_lines_sorts. - frame/src/d3d.rs & slotwrite.rs: add ResourceDesc::from_words and flags_of_words (with unit test from_words_matches_parse_and_flags_offset); in ViewRef::Placed drop 56-byte copies, redundant parse, unreachable None exit, and 5 per-slot Tick::now()/pf spans while preserving 'be: of which placed image creation (write_view)'. - docs/learnings/vkback-live-cpu.md: update Current state and document findings. Reference counterpart status (rule 12): - vkback's slot cache, async descriptor helper, and issue counter are vkback-specific mechanisms with no D3D12 counterpart in crates/victory-gpu. - frame::d3d::ResourceDesc::from_words and flags_of_words mirror frame::d3d::ResourceDesc::parse and D3D12_RESOURCE_DESC. Verification (on baseab7b4e6): - Interleaved A/B/B/A (boat-sarc0, RUN_SECS=105, VICTORY_HOST_PADS=off, RX 9070 XT, Mesa 26.3.1, steady 60-present windows shown >= 1150): A1: 17.89 fps, med 55.87 ms, idx 12.76 ms/f, all 41.82 ms/f, cpu 38.92 ms/f, 46.5 ns/r (22.98M/60f) B1: 20.04 fps, med 50.01 ms, idx 9.72 ms/f, all 34.36 ms/f, cpu 31.98 ms/f, 41.5 ns/r (20.37M/60f) B2: 20.51 fps, med 48.79 ms, idx 9.09 ms/f, all 33.17 ms/f, cpu 30.87 ms/f, 40.5 ns/r (19.25M/60f) A2: 18.91 fps, med 52.95 ms, idx 13.05 ms/f, all 39.94 ms/f, cpu 37.23 ms/f, 53.0 ns/r (20.24M/60f) loud.txt: 0 unowned errors across all runs. - Screenshot check (rule 18): visually verified clean (loud.txt: 0 unowned). - Vulkan validation run (rule 30): ~4m38s in world (2,425 shown frames, 3,092 pipelines built), loud.txt 0 unowned; distinct VUIDs: VUID-VkBufferCreateInfo-size-06409, VUID-VkComputePipelineCreateInfo-layout-01687, VUID-VkGraphicsPipelineCreateInfo-layout-01688, VUID-VkRayTracingPipelineCreateInfoKHR-layout-03428 (all on docs/TASKS.md allowlist; 0 new/non-VUID errors).@vktory6 on GitHub · 2026-12-01 21:57 UTC · original
Merged as
github.com/vktory6/VKtory@1befc31, thank you: a clear A/B/B/A and a real gain on the top anti-stutter item (index slots -27%, renderer CPU -17%, +10% fps).Review notes, all fine as they are:
from_wordscan dropparse's failure path because the only failure was a short buffer; skippingalias_atwithout a target at the address matches its own first check; and null slots' stride writes now take the same helper-job order as other buffer views, which removes an ordering hazard rather than adding one. Our check: tests pass, house validation run with no new errors.The task is updated:
github.com/vktory6/VKtory@1864b6e. The next step there is the fix shape in "Renderer CPU: index slots": keep every slot's resolution, "not a view" included, until the title writes the slot, so an unchanged slot costs a lookup instead of a resolve. If you'd like to continue on the anti-stutter work, that one or "Texture fills on the GPU" have the biggest measured payoff.