Repository navigation
Conversation
A buffer fill whose range no single host import covers, but which existing imports cover contiguously (adjacent registered ranges, each imported on its own), was refused by FillBuffer, so the caller waited for the GPU to go idle and stored the fill on the CPU. The fill is now recorded per covering import between the same barriers, with the same pending-write and write-stamp bookkeeping over the whole range. The pieces are planned before anything is recorded; a range with a part that has no import is still refused. Fills split this way are not elided as repeats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
|
This pull request is labeled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A buffer fill (CP DMA fill or a recognized fill kernel,
VulkanDevice::FillBuffer) whose range no single host import covers was refused, even when existing imports cover it contiguously: two adjacent registered ranges, each imported on its own. The caller then waited for the GPU to go idle (WaitIdle) and stored the fill on the CPU.FillBuffernow plans the fill over the existing imports first: when the range has no single import, it walks the imports that hold it (ExistingHostImportFor), one piece per import, and refuses unless every piece has an import and every piece boundary stays 16-byte aligned to the fill (so the pattern phase is kept). Nothing is recorded before the plan is complete. The pieces are then recorded between the same barriers as a single fill (uniform fills withvkCmdFillBuffer, 16-byte patterns from the cached pattern buffer or, withAPS5_FILL_CHAIN=1, seeded and doubled per piece). The pending-write checks,SyncThrough, key and label flushes, the pending-write note and the write stamp cover the whole range as before. After a sync the plan is made again, as the single import is looked up again today. A range with a part that has no import is still refused and stored by the caller as before. A fill split this way is not elided as a repeat: the repeat check compares one import serial, and a split fill has none.Seen in Astroneer (PPSA27623, boykopovar#21967): the per-frame 640 KiB fill straddles two GPU-mapped ranges (0x90000 imported at map time during loading and the next range imported later) in some launches; in a profiled one, 798 of 5237 fills went to the CPU at about 7.4 ms each.
No import is made or replaced. A joined import (
importJoined, which boykopovar#6197 exposes asHostImportSpanningfor storage surfaces) could cover this layout too, but it retires the two existing imports and imports the joined range anew, andjoinedRuntakes only some layouts (a run that starts where the access starts, or ranges larger than the 8 MiB window). Recording per existing import leaves the import table as it is. boykopovar#17255 walks existing imports the same way for sampled texture uploads (ExistingHostImportCopies, not merged); this PR uses only the existingExistingHostImportForand does not touchGuestBufferMemory.Tested
Windows 10 Pro 22H2 (19045), NVIDIA GeForce RTX 4060, driver 621.14.
GPU tests, same build directory,
main(258ab7b plus the new test) and this PR (then on 258ab7b; rebased onto ab50895, whose new commits change no file oflibSceAgcDriver),ctest -R <50 fill, copy, import and label tests> -VwithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(validation layer 1.4.363):main: 48 of 50 passed; the two failures are the newagc_driver_fill_across_importsand_chain("a uniform fill across two imports was not stored on the GPU"). 0VUID-lines, the layer inserted 77 times,was not found but was requested0 times.VUID-lines, the layer inserted 77 times,was not found but was requested0 times.The new test registers two adjacent ranges of 0x90000 and 0x50000 bytes and checks the import layout it needs (each range imported on its own, no import over both). A fill across the boundary is refused and leaves the memory unchanged while the second range has no import. With both imported, a uniform fill and a 16-byte pattern fill are recorded on the GPU (the recorder holds work after the call) and the bytes are checked across the boundary, with the bytes before and after the fill left alone.
_chainruns the same withAPS5_FILL_CHAIN=1.Astroneer (PPSA27623), opening cutscene, no input, 120 s per launch, cold and warm launch pairs in the order base, change, change, base (the second round's warm launch crashed in the title's
FAsyncLoadingThreadat 15 s, before any fill was split, and that round was run again),APS5_PIPELINE_STATS=1only. Base:main459f4f8 with boykopovar#16053 reverted, because plainmainaborts or draws this scene wrongly (boykopovar#21967); change: the same plus this PR. Both arms carry a counter of CPU-stored fills that is not part of this PR. Which layout a launch gets is decided by the title's memory layout, so not every launch splits the fill. FPS is the cutscene window 30-100 s of the summary clock, fill commit cost the[commits]line'sbufferfillmean over 30-90 s.The base arm got no split layout in this set, so this set has no FPS comparison of that layout. Earlier the same night, on the base without the counter, a warm launch with the split layout had fill commits of 1425-1568 us at 9.64 FPS, and a profiled one stored 1136 of 7434 fills on the CPU. With this PR the split fills are recorded on the GPU and cost what a fill through one import costs. The one split-layout warm launch (10.16 FPS) lies inside the spread of one-import warm launches on this machine the same night (10.16 to 12.81 FPS, 7 launches) but at its low end.
trace_digest.pyof the summary files (the 100:10 trace window ended after the 120 s launches, so no window trace was written):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)