Repository navigation
Conversation
|
This pull request is labeled |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@imellag thanks, the record-time stamping itself looks sound. One question before this can go in: #9685 (c7f9eaa) made |
MarcZX10
left a comment
There was a problem hiding this comment.
I reviewed the recorder changes and the new ordering test, and I agree with the concern already raised by the collaborator: PendingUnstampedWriterSerial skips every stamped note before FlushPending can apply the existing ownNotes exception, which is deliberately restricted to a single image with an existing host import. The new test covers a repeated store for one image, but not multiple flushed images or an image without a host import. Please explain why the #9685 restriction does not apply to those stamped writes, or constrain the skip to the same safe cases and add the requested multi-image/no-import regression case. I am not treating the current test as evidence for those cases.
The performance report also does not use the repository main baseline: it names a custom tree containing open macOS boot PRs and #11705. Please rerun the matched capture against current main and this exact change, and refresh the attached digest/traces as requested by the performance-report check. Finally, coordinate the same-line/test overlap with open #8887 and record the agreed ordering in Depends on per CONTRIBUTING; the overlap section currently says either PR may land second while the checklist says none.
…ng a storage image FlushPending syncs when an unfinished batch writes the image's range, so that the marks of a writer that stamps guest memory only when its batch completes (an address-based dispatch) land before the write-back decides which blocks to keep. Storage image write-backs and unit shadow publishes stamp their blocks while they are recorded, so waiting for them adds nothing: the next write-back of the same range is recorded after them in GPU order. The recorder now notes those writes as stamped (NoteStampedWrites), and FlushPending looks for writers with PendingUnstampedWriterSerial, which skips them. Every other writer still makes the flush wait.
The stamped-write skip now applies under the same condition as the own-store skip of boykopovar#9685: the flush stores a single image and that image has a host import. A flush of several images, or of an image without an import, waits for stamped writes as before. StorageFlushOrdering checks a single image stored again (the flush must not wait when the image has an import, and must wait without one) and two adjacent images stored again together (the flush must wait). A second registration runs the stored-again cases with APS5_NO_HOST_IMPORT=1.
7973cef to
156bbaa
Compare
|
@oneandonlydean @MarcZX10 thanks, you are right about #9685's restriction. A flush that stores several images, or an image without a host import, can store on the CPU or over a neighbour, and must wait for every pending GPU write over the range, stamped or not. Pushed 156bbaa (branch rebased on current
Baseline.
Why each one: #7631, #7804, #10552, #11249 libkernel/libc on macOS; #11447 and #11554 AGC driver on macOS; #10669 libSceAudioIn link. The earlier numbers in the description came from a tree that also had #11551 and #11705; they are replaced below. Same focused tests on both arms with God of War (PPSA28997), Cyclops fight, one pair on these two branches, same machine,
This is one pair only; I will add a matched trace capture of these two branches with #8887. I measured it on macOS and proposed there that it lands first; once SleglJan agrees I will set |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 156bbaa. The new guard and the no-import/multi-image regression cases address the broad skip outside the existing single-image, host-import case. I found three remaining blockers:
-
When ownStoresSkipped is true, PendingUnstampedWriterSerial ignores every overlapping note in batch.stampedNotes, not only this flush's ownNotes. NoteStampedWrites is used both for storage write-backs and UnitShadow::recordCopies. The single-image/host-import guard does not establish that every overlapping stamped note belongs to the image being flushed; a pending unit-shadow publish or another overlapping stamped writer can still be skipped. Please narrow the exception to the flush's own writes, or document the invariant that rules out unrelated stamped writers and add a regression with an unrelated stamped publish overlapping a single imported image.
-
The current heads of #8887 and #6186 both conflict with this head in shared AGC code. Pairwise merge-tree reports conflicts for #8887 in Recorder.hpp, Recorder.cpp, Texture.cpp and StorageFlushOrdering.cpp; for #6186 it reports conflicts in CMakeLists.txt, Recorder.hpp, UnitShadow.cpp and the debt file. The PR describes these overlaps but still says Depends on: none. CONTRIBUTING requires agreement on order and a declared dependency for same-line overlaps. Please coordinate and declare the agreed order. I checked #11694 as well; its current head merges cleanly with this PR, so I do not see a required ordering there.
-
The updated report includes matched traces and digests, but its baseline is e5d3b00 from a custom tree with macOS boot PRs and #11705, rather than current upstream main d13b3d7. The perf contribution rule requires a current-main/change comparison on the same machine and scene. Please provide that comparison on a supported platform or remove the performance claim and label.
The current-main merge preview for this head is clean. I am requesting these specific corrections; this is not an approval of the performance or ordering claims.
|
@MarcZX10 thanks. Updated what I can without new test runs:
|
|
Windows + NVIDIA result for head This PR's own tests: Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER (vendor 0x10de, device 0x1e84; Vulkan loader 1.4.357 from the NVIDIA driver 621.01), Khronos Validation Layers nightly 1.4.366 (b2b44c0d37) through Same focused run on
The tree also carried the open PRs #11948, #12062, #12132, #11680, #11679, #11678, #11677, #11675, #11674, #11605, #11604, #11600, all merged cleanly, so the run is a joint one. Not run on a PS5. AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
@MarcZX10 point 1 is in 5b34b1d: the skip is now limited to the flushed image's own writes.
The UnitShadow.cpp change stays: Tested on the support branch named in the description ( Point 2: |
|
On head
Could the stored exemptions be associated with the texture that produced each note, including any shared shadow publish, or be conservatively omitted for multi-image flushes? A focused sequence with a joint A+B flush followed by an overlapping single-image A flush would exercise this separately from the existing test, which inserts an unrelated note outside the first flush. This is a source-level observation and I have not reproduced it at runtime. AI-assisted: Codex |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for narrowing the skip to the image's own notes. One ownership problem remains, confirmed in the source (same point @mashingaan raised):
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:4319-4328:StampedNotesSince(firstNote)returns every stamped note recorded during the whole flush, and the same vector is appended toflushNotesof every texture inflush. After a joint A+B flush, A'sflushNotescontain B's write-back/publish notes. A later flush of A alone with a host import adds them toownNotes(line 4253-4254), so B's write over an overlapping range is treated as A's own and the flush does not wait. Keep per-texture notes (collect them around each texture's own write-back, and decide how a shared unit-shadow publish is attributed), or only recordflushNoteswhen the flush stored a single image.tests/execution/StorageFlushOrdering.cpp: add the sequence joint A+B flush, then A dirtied and flushed alone with a host import, with B's range overlapping A's flush range. It must wait. The current "unrelated" case notes the foreign write after the first flush, so it does not cover this.- Depends on #8887, which is still open; rebase on it once it lands (the same lines in
FlushPendingand in this test will conflict). - The
perflabel asks for themainvs change summary lines andtools/trace_digest.pyoutput (or drop the label/perf framing if this is a correctness-only change, as the body says "No performance claim").
|
@adriadam10 @mashingaan thanks, confirmed: after a joint A+B flush, A's Fixed in 3b3cd73:
#8887: I will rebase once it lands. The |
|
Windows + NVIDIA run of the current head Setup: Windows 11 Home 26200, AMD Ryzen 9 5900X, NVIDIA GeForce RTX 3080, driver 610.88, Vulkan SDK 1.4.363 ( Command: the pattern from the Tested section, 3 runs on each side, with
GPUs tested: NVIDIA GeForce RTX 3080, driver 610.88, Windows 11. AI-assisted: yes (Claude Code) |
|
Linux + AMD measurement of the waits this PR removes, from a title. I did not run this PR itself: these numbers come from counters on the code it changes, so they show what is there to save, not a Setup: CachyOS, Linux 7.3.0, Ryzen 7 5700X3D, RX 9070 XT (RADV, Mesa 26.2.5), GPU DPM level forced to What waits, per present (from a nonserializing trace over 36 presents, and from counters over a 60 s run):
Whether the waited writer is the image's own earlier store: for each label flush I recorded the recorder's open serial when it stored the image, and compared it with the writer serial
All of these flushes store a single image: either linear and host-imported (the GPUs tested: AMD Radeon RX 9070 XT (RADV, Mesa 26.2.5), Linux. AI-assisted: yes (Claude Code) |
|
Alternated A/Bs of this PR, of #8887, and of both together, on a title: PPSA21564 01.007.000 (the US release of PPSA21567), in the particle effect that follows the publisher title card. Apple M5 Pro, macOS 27.2, MoltenVK 1.4.2 (Vulkan SDK 1.4.363), x86-64 Release under Rosetta 2, 3840x2160, The tree is not
In that tree, mesh list draws with primitive restart are skipped locally. On top of it:
What this scene waits on in
That is the case this PR describes. Each row is one 200 s run:
This PR's effect:
#8887 alone leaves these waits where Limits:
Not covered:
AI-assisted: yes |
What
StorageTexture::FlushPendingsyncs when an unfinished batch writes the flushed range (#6364, 9fffcea): a writer that stamps guest memory only when its batch completes (an address-based dispatch) must have its marks land before the write-back decides which 64 KiB blocks to keep. When the writer is in the open batch, that is a fullRecorder::Sync.Some writers need no such wait: storage image write-backs (
writeBackLayers,writeBackWindows) callGuestMemory::MarkWrittenfor what they store while they are recorded, and a unit shadow publish copies bytes those write-backs already stamped. The next write-back of the same range is recorded after them in the same queue, so it lands after them on the GPU anyway. Today the flush still waits for them. Example: an image is written back at one label, written again by a dispatch, then flushed again at the next label; the second flush finds the first one's publish in the open batch and drains the queue.Recorder::NoteStampedWritesnotes such ranges likeNotePendingWritesand also keeps their write notes in the batch (stampedNotes). The two write-back paths andrecordCopiesin UnitShadow.cpp note their writes this way. The staged publish (the copy into a host buffer that writes guest memory at completion) does not.FlushPendingkeeps the stamped notes that flush recorded (the image's write-backs and its publish), fromRecorder::StampedNotesSince, in the image'sflushNotes(the last 32). A flush that stores several images keeps none, so no image takes another's notes.flushNotesto the existingownNotesexception of fix(agc): store resident linear color targets at completion points, limited to their drawn rectangles #9685, so it applies only where that one does: the flush stores a single image and that image has a host import. OtherwiseownNotesis cleared as onmain. Any other writer over the range (another image's write-back or publish, a dispatch, draw, fill, label, CPU-resolved copy, address-based lease) still makes the flush wait, and CPU readers still sync on these writes through the pending-write snapshot as before.tests/execution/StorageFlushOrdering.cppgains a stored-again case: images are stored, written again by a dispatch and flushed again in the same open batch, and the newer texels must land. With one image and a host import the second flush must not submit the open batch. It must wait with two adjacent images flushed together, without a host import, when another stamped write that is not the image's own (noted withNoteStampedWritesover the image) is in the open batch, or when the image is flushed alone after a joint flush with its neighbour. A second registration,agc_driver_storage_flush_ordering_no_import, runs the stored-again cases withAPS5_NO_HOST_IMPORT=1.mainfails the one-image case (it waits), the first head of this PR failed the two-image case, the second head failed the unrelated stamped write case and the third the alone-after-joint case (they did not wait), the current head passes all of them. The two existing cases (writer in flight, writer in the open batch) still pass.Overlaps:
FlushPendingand in this test. Order agreed with SleglJan on perf(agc): wait on a flush only for writers over the image layers it stores #8887: perf(agc): wait on a flush only for writers over the image layers it stores #8887 first, then this PR rebased on it (the stamped skip moves into perf(agc): wait on a flush only for writers over the image layers it stores #8887's per-range loop, the lease check unchanged, the test cases merge).recordCopieswith a write kind (ShadowPublishWrite); if it lands first, the stamped flag can be expressed through that kind.writeBackWindows' imported pieces) is noted as stamped here too.Tested
No performance claim:
maincannot run titles or the AGC execution tests on macOS yet, and I have no other platform for amain-vs-change capture.macOS 27.0.1, Apple M4 Pro, MoltenVK 1.4.2, x86_64 build under Rosetta. Support branch, not
main: fork branchsupport/macos-boot-1027(76d41ef) =maind13b3d7 + only the macOS boot PRs #7631 #10552 #11249 #11447 #11554 #10669 #7804 (#7804's conflicts in Process.cpp and Time.cpp resolved locally). Change: fork branchsupport/macos-boot-1027-pr12070(f6730c3) = that branch + the four commits of this PR.Focused tests on both with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -R 'storage_flush_ordering|linear_readback_label|linear_target|agc_driver_storage_(cache_budget|one_slice_alias|read_during_idle_store|write_back)|storage_cache_retained|depth_storage_reuse|flip_stores_small' -V: the same 10 tests fail on both with the same messages (the aborts are "deferred destruction found two different device resolvers", fixed by #11705, which is not in this support branch), all the others pass, bothstorage_flush_orderingregistrations pass on the change (rerun on the current head on macOS 27.2: same failures, except thatagc_driver_linear_target_direct_write_completionnow hits the resolver abort only intermittently), nowas not found but was requested by env var VK_INSTANCE_LAYERS, noVUID-in either log. God of War (PPSA28997) ran through the Cyclops fight on the second head with no crash or device loss; not rerun on this head.python3 tools/check_conventions.py --base upstream/main(0c4d871): passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)