fix(vk): the readback line also counts the waits for a whole submission whose pages were written in place #700
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!700
Loading…
Reference in a new issue
No description provided.
Delete branch "mooki/Longshot:fix/readback-whole-waits"
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?
Type: fix · Risk: low · Tested on: macOS 26.7.1, Apple M4 Max (MoltenVK 1.4.2), arm64 and x86_64 under Rosetta (game-free tests only) · Needs: Windows and Linux, any GPU (build and start); macOS (a start, on the macOS stack)
Why
Every 3000 readbacks of GPU results the renderer logs how many waited and, since the part waits of issue 997, how many waited for
their submission's last part because guest memory is read in place after their part. A readback whose pages were written in place
(no mirror, so no part) waits for its whole submission too, but the line counted none of those. On a Mac, where every pool is written
in place, it read 0 although every readback there waits for its whole submission (
reports/2026-11-14-mac-perf.md). This changes adefault log line on every platform, so it is its own PR, split from the macOS performance lines (#704). It is part of the
macOS port's work. See #420.
How to reproduce
Seen on: macOS 26.7.1, Apple M4 Max, MoltenVK 1.4.2 (any device whose pools have no mirror)
Settings and switches: defaults
Steps: play until the
vk: readbacks of GPU results:line printsExpected: the line says how many readbacks waited for their whole submission
Actual: it counts only the held-back waits; the whole-submission waits of pages written in place are not on it
What changed
The readback line counts one more kind of wait: a readback of pages written in place that waited for its whole submission. Nothing
else changes.
gpu/vk/vk_replay.cppinvalidate(): a wait for a range whose pages were written in place (part 0, no mirror) adds one toin_place(a relaxed atomic); the line now ends…, K waited for their whole submission (their pages written in place, no mirror),read and reset with the others. Nothing waited for, recorded or drawn changes, on any driver.
tests/test_readback_part.py: the model ofinvalidate()counts it (a range written in place counted once; a range with amirror's page, and a range in a part of its own, not) and the line's source is checked.
Measurements
Verdict: nothing to measure: one counter on a log line; what is waited for is unchanged (the model's 40 checks pass).
Flags and settings
None.
Testing
Tested: on macOS 26.7.1, Apple M4 Max, at
203b8b7c, this PR's head before the rebases ontoe090cc48andaa95d35f(main
6c9edffeplus this commit):tests/test_readback_part.pywith/usr/bin/clang++andclang++ -arch x86_64(Rosetta): pass; with the test copied onto main itfails (
the readback line no longer counts the waits for a whole submission whose pages were written in place)(
reports/PubWave-files/PubLate4/proof-01/rb-readback-*,base-rb-readback-*).gpu/vk/vk_replay.cppcompiled whole for arm64 and x86_64 with main's renderer flags (#476's, #492's and #490's macOS compilepieces merged in a scratch tree only): 2 objects, exit 0 (
reports/PubWave-files/PubLate4/compile/readback-whole-waits/).vk_replay.cppdiffers (intended: the count is every platform's)(
reports/PubWave-files/PubLate4/offapple-readback-whole-waits.txt).aa95d35f, at4d243bc0(203b8b7cbefore the rebases ontoe090cc48andaa95d35f):Sweep3's checks of this head (the C/C++ it changes compiled, and its own tests run, on arm64 and x86_64 where they
apply) gave the same results as before;
python -I -B tests/run_all.pyon wave C6's mergea10d0c4b, which carriesthis head: 584/33/18 (passed/failed/skipped) against main aa95d35f's 543/33/17 on this Mac, one new failure,
test_gpu_hang_watch, which passes run alone on the same merge on arm64 and x86_64 (its 2 s bound under the suite'sload) (
reports/2026-11-15-rebase-sweep-3.md).Not tested: a game run (main does not start on macOS by itself); not built on Windows or Linux; its test request covers it.
Must be tested:
4d243bc0, on main) and mainaa95d35fthe same way, play to thefield, expecting the
vk: readbacks of GPU results:line with the newwaited for their whole submissioncount atthe end and every other figure as main's; on a device whose pools are mirrored the new count is small or 0 (by hand:
test request T-LF3Z).
Risks
What could break: a tool that parses the readback line by its end would see one more field.
Turning it off: revert the PR (no switch).
Compatibility: A log line gains a field on every platform. No file in the shader stamp changed; no
MKWVK_API_VERSIONchange.Reviewer notes
6c9edffe; written for this PR from the macOS topicmacos/perf-instr2c20c030, whosein_placecount andline it is, with a positive check added to the test (the topic's test only checked a range not counted).
invalidate();test_readback_part.py's stand-ins): whichever lands second keeps both lines (in the wave merge39da60e1, this count first, thenL5's).
Issues
See #420
Checklist
Everyone
type(scope): description) of the status line's type.main: onaa95d35f(#761, 2026-11-15), head4d243bc0, without a conflict; this PR's owncommits, old → new:
203b8b7c→4d243bc0; the commit names elsewhere in this description are from before therebase.
python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (On the wave's merge39da60e1= the nine late renderer PRs' heads (fan-key592cd8d3, fan-indirectfa6dd43a, provoking-firstb8194380, perf-instrea90d3ca, readback-whole-waits203b8b7c, fix/indirect-quadsc6e0c37f, indirect-quads978079d4, fix/mesh-count0a61a9e7, mesh-provoking56c09f1b) with their sibling fixes: 570 passed, 31 failed, 18 skipped against main 6c9edffe's 531/32/17 on this Mac; the 31 failures are main's own and nothing that passes on main fails;test_collect_widenow passes; 38 new tests pass;reports/PubWave-files/PubLate4/wave4/full-39da60e1/. After the rebase onto mainaa95d35f(head4d243bc0): wave C6's mergea10d0c4b, 584/33/18 against main aa95d35f's 543/33/17, one new failure,test_gpu_hang_watch, which passes run alone on the same merge on arm64 and x86_64 (its 2 s bound under the suite's load).)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.203b8b7c2665bad6b7f5WIP: fix(vk): the readback line also counts the waits for a whole submission whose pages were written in placeto fix(vk): the readback line also counts the waits for a whole submission whose pages were written in place65bad6b7f54d243bc092View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.