WIP: perf(vk): cache Task/Mesh c2/c0 banks by stage gen and pointer_table per stage #2339
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2339
Loading…
Reference in a new issue
No description provided.
Delete branch "GrimVisage/Longshot:perf/task-mesh-bank-cache"
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
Task and mesh stages (NVN2 stages 6 & 7) currently bypass
tex_gen/ssbo_genbank caching inuniform_range()and fall back tos.bind_gen, causing theirc2andc0driver banks to refill whenever any uniform buffer is bound (nearly every draw). In addition,pointer_table()keeps a singlethread_localslot across stages, so Task (stage 6) and Mesh (stage 7) evict each other on every draw.This WIP PR:
c2ons.tex_gen[bank_stage](safe:driver_bank_fillforbank == 2only readss.tex,s.img,s.samp) and Task/Meshc0whenn <= 0x880ons.ssbo_gen[bank_stage](safe: only readss.ssbo). Task/Meshc0past0x880(which includespointer_table) and computec0(stage 5) stay ons.bind_gen.pointer_table()'sthread_localcache per-stage (PointerCache cache[kNvnStages]) keyed on(s.bind_gen, memory_capture_view(), &s), stopping Task/Mesh stage eviction while invalidating whenever submitted memory captures change.tests/test_bank_gen.pyto enforce both invariants.Files to read first:
gpu/vk/vk_draw.cpp(uniform_range)gpu/vk/vk_bank.cpp(pointer_table)tests/test_bank_gen.pySee #1285.
Testing
Tested:
longshot_vk.socleanly on Fedora 45 Linux (scripts/dev.py vk).python3 -I -B tests/test_bank_gen.py: PASS.pre-commit(includingruff) on all 3 changed files: PASS.Still to test:
mainvs this PR alone) on Linux AMD RX 9070 XT withRX_VK_MESH_FALLBACK=0(castle-gateandkokiri-forest) to measure isolated FPS/CPU impact before marking ready (by hand).@Beanstalk build and run native mesh smoke test).Measurements
WIP: dedicated
main-vs-PR paired A/B benchmark pending before marking ready for review.Risks
c2andc0(n <= 0x880) only depend ons.tex/s.img/s.sampands.ssborespectively (enforced bytests/test_bank_gen.py);c0past0x880keepss.bind_geninvalidation, andpointer_table()addsmemory_capture_view()to its cache key.main's behavior cleanly.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
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Assisted-by: Antigravity
Co-Authored-By: Antigravity [email protected]
Tested in game: WIP: compiled longshot_vk.so cleanly on Fedora 45 Linux (RX 9070 XT, RADV Mesa 26.3.1) and passed test_bank_gen.py + test_tls_objects.py; dedicated solo main-vs-PR in-game A/B pending before marking ready.
Possibly related, for context:
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.