fix(vk): release capture spares before large RADV imports under pressure #1933
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1933
Loading…
Reference in a new issue
No description provided.
Delete branch "futondestroyer/Longshot:codex/issue-1842-radv-headroom"
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
On the reported RX 6700 XT Linux setup, Longshot lost the Vulkan device immediately after the cutscene where Saria gives Link the ocarina. RADV refused a command submission after Longshot imported a larger guest-memory range. The reported system heap was nearly full, even though the device-local heap had room. The ordinary idle-import path queued an 8 MiB retirement, whose memory is freed after GPU completion.
This change makes room for large RADV dma-buf imports by releasing completed system-memory capture spares synchronously when the driver budget estimate is tight. It keeps the existing import fallback, mirror inheritance and retirement fences. Start with
radv_import_headroomand its call inimport_dma_bufingpu/vk/vk_memory.cpp.See #1842.
Testing
Tested: Windows game-free fixtures using LLVM-MinGW. The headroom fixture fails on the base at the missing reclaim hook and passes on this head. Import factory (43 cases), import reach, capture spare reuse, asynchronous capture free, retired-import, and memory-accounting checks passed.
test_linux_pressure.pyreports the same missingpool_pressed = true;source marker on both revisions. Fullmise run test, Linux renderer build and gameplay are pending.Still to test:
The issue reporter will run the manual check first. The Beanstalk smoke request was cancelled during planning.
Measurements
Verdict: The game-free check verifies the reclaim path. The workload's driver headroom and crash outcome still need measurement.
Setup uses the same save state, graphics settings, resolution and driver for both builds. Record the system-heap budget before the large import, completed spare bytes released, and whether gameplay continues. If the base and candidate differ, repeat the pair before interpreting the result. Check for a transition stall on the candidate.
3df5c13ed1ab7729Risks
Synchronously freeing capture spares may stall a large import and may cause later captures to allocate replacement buffers. The 64 MiB import threshold and 64 MiB reserve are provisional. Driver budget estimates and buffer sizes can differ from actual heap headroom. A revert removes this policy. Save, options and cache formats are unaffected.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). Focused checks are listed above. Full suite pending.main, or Measurements says why there is nothing to measure. Runtime comparison pending.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.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.Possibly related, for context:
@Beanstalk Test only Linux AMD RADV discrete Radeon RX 6700 XT, using the exact PR head
d1ab7729against its merge base3df5c13e. Use the explicit GPU model constraintgpu = "rx 6700 xt"and tagslinux,amd,radv,dgpu. Leave it queued if there is no matching agent. Do not select Steam Deck, Windows, another GPU model, or a generic fallback target.This is a short RADV area-arrival smoke check for issue #1842. Start both sides from the approved
save:kokiri-startcheckpoint, with the same defaults, no synthetic memory-pressure switches, and the same teleport route to Hyrule Field and then Market, allowing each arrival to settle. Use two starts per side if practical. Check for a RADV command-submission memory refusal, batched-submit failure, device loss, or game crash. If supported, record whether the candidate'sRADV system heapline reports actually releasing capture spares. No such line means the reclaim condition was not observed. This route does not reproduce the Saria cutscene. The exact cutscene check remains a separate manual test on Mesa 26.2.7.Recommendation: Request changes. The proposed fix has not yet been shown to prevent the reported device loss, and it adds synchronous buffer destruction on a path where that work has previously caused substantial stalls. Its runtime cost and the amount of driver headroom it actually restores are unmeasured.
The change tries to make room for large Linux RADV dma-buf imports by destroying completed system-memory capture spares before importing. It preserves the existing fallback and retirement paths, but may stall an import and force later capture allocations. Measure and address that cost before merging.
Does it help: Unproven. The PR reports a game-free fixture failing on base at a missing hook and passing on the candidate, but the RX 6700 XT cutscene reproduction and candidate gameplay are pending. No paired runtime headroom or stall measurements are available.
Other systems: The reclaim path is restricted to Linux RADV imports of at least 64 MiB. Windows, other drivers and smaller imports do not enter it. RADV configurations with unknown system-heap budgets do not reclaim; shared VMA blocks may return less driver-visible memory than the spare sizes suggest. Steam Deck and other affected RADV hardware have no reported runs.
Switches: None added, changed or removed. Existing capture spare and allocation switches can affect how much memory is reclaimable.
Reviewed:
d1ab7729ffagainst3df5c13ed2: Read the diff, changed test files, repository contribution rules, PR template and relevant capture-spare, import and VMA paths. Skimmed the remainder of the large vk_memory.cpp file and the standards document; did not read the entire changed code file in full. No earlier reviews or recorded gameplay runs were supplied. The network-only Tooling rules and overlapping PRs were unavailable.; nothing run (a code review).Checked and fine:
Blocking (to change before merge)
Suggestions (the author may take or leave)
Testing: Review only; no code, tests, builds or project scripts were run. The PR reports focused Windows game-free checks, while Linux builds, the full suite and gameplay remain pending.
Overlaps and merge order: Unknown; the network is closed and no overlapping pull requests were supplied.
Automated code review by BeanBot (gpt-6.1-terra), on the pull request's opening. Nothing was run; a maintainer decides.
@ -5388,0 +5409,4 @@if (allocation_in_vram(spare.alloc)) continue;cap_free.erase(cap_free.begin() + i);cap_free_bytes -= spare.size;destroy_buffer(spare.buffer, spare.alloc);This can synchronously free several large buffers while the import holds the pool lock. Existing capture-free notes report 25–49 ms stalls for this work, and later captures may need replacement allocations. Please measure paired transition and frame times, including subsequent captures, and bound or redesign the synchronous work if the cost is material.
Beanstalk test farm · cancelled
Commit
d1ab772· approved by futondestroyer (reviewed) · dashboardCancelled. Comment
@Beanstalkto start it again.anyWhat was tested
What will be tested · default plan (AI failed: the summary says 'manual': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again)
The AI plan failed: the summary says 'manual': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again; using the default plan.
kokiri-start, then teleport to Hyrule Field, measure field for 60 s (after 10 s warm-up); 2 runs on each side.@Beanstalk cancel
@futondestroyer cancelled 0 queued jobs.
WIP: fix(vk): release capture spares before large RADV imports under pressureto fix(vk): release capture spares before large RADV imports under pressure