Repository navigation
feat(libSceAgcDriver): import scattered direct memory as a dma-buf run list and probe its coherence - #4449
feat(libSceAgcDriver): import scattered direct memory as a dma-buf run list and probe its coherence#4449Mouad-Scriptz-0 wants to merge 2 commits into
Conversation
2dbf7b7 to
371a549
Compare
|
Which device takes the run-list path once the coherence probe is in? On i915 the probe turns the dma-buf fallback off, and
It needs a rebase as well: |
|
Test report: AMD / RADV, where the run-list path is needed (re @oneandonlydean's question). Setup
Why AMD takes this path: host-pointer imports of this title's direct memory fail at
Coherence probe on RADV: Checks
🤖 Generated with Claude Code |
|
A data point from a local port of this branch onto current main. Linux, RADV Phoenix (Radeon 760M), Dragon Quest III HD-2D (PPSA20612). On this host the write-watch probe does not run: there is no For a local test only, I set This was a local build, not a rebase of the branch. A later save-load screen can still stop presenting here; I don't think that belongs on this pull request. |
|
That is the early-return gap from 10-14: without a write watch |
…n list and probe its coherence Ports boykopovar#4449 onto main's sharedBacking import structure, per the maintainer direction that this needs a port rather than a rebase: - GuestArenaSharedBackingRuns resolves a guest range into the runs of its direct memory backing (one per physical allocation, up to udmabuf's 1024), registered by DirectMemory; a single run still takes main's chunked and sparse paths, several runs create one udmabuf buffer per run through UDMABUF_CREATE_LIST - the start-up probe stores to the import from the GPU after CPU stores to the same pages and counts pages the CPU still reads stale (i915 maps dma-buf without snooping CPU caches); an incoherent measurement keeps the fallback off - decideImportWatch no longer returns early when there is no write watch: the coherence probe still runs there (its stale measurement is a plain CPU read after a GPU fill), so such devices measure instead of skipping the dma-buf fallback - the single shared backing resolver stays as a fallback for registrations that do not provide runs Co-authored-by: Mouad-Scriptz-0 <188722908+Mouad-Scriptz-0@users.noreply.github.com>
|
The port, as directed — since What the branch carries, on top of current
Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, Branch: |
|
Thanks @blawesom, that covers both asks (the port onto @Mouad-Scriptz-0, it's your design: are you happy to take blawesom's commit as the base of this PR (it keeps your co-authorship), or would you prefer it as a separate PR? Either works for us. |
|
Review of the port ( The run-list port is faithful. The kernel, libc and runs code matches #4449 line for line: one run goes through 1. The no-write-watch probe still never runs on Linux.
2. The mixed-watch path ignores the coherence result. In
Smaller notes:
On where it lands: from the code side either way works, since it fully replaces #4449's diff. That choice is @Mouad-Scriptz-0's. It's a guest-memory change, so after the fixes it gets full CI on the exact head and our game checks. |
|
A data point for the run-list idea, from our own variant, not from this PR. In #6951 (since cut down to a run memo) I had imported windows whose direct-memory backing is scattered as one Kena: Bridge of Spirits (PPSA01802), forest title scene, no input.
So about +36 % over the memo alone in this scene; Kena maps its pools in many small direct-memory pieces. I haven't run this PR or the AI-assisted: yes (Claude Code) |
|
Thanks, that's a useful data point: +36% over the memo alone in a scene that maps its pools in many small pieces is a good argument for the run-list path. A run on the port branch, once it's this PR's base, would be welcome, ideally with the same scene and the same three rotated rounds so the numbers compare directly. |
…n list and probe its coherence Ports boykopovar#4449 onto main's sharedBacking import structure, per the maintainer direction that this needs a port rather than a rebase: - GuestArenaSharedBackingRuns resolves a guest range into the runs of its direct memory backing (one per physical allocation, up to udmabuf's 1024), registered by DirectMemory; a single run still takes main's chunked and sparse paths, several runs create one udmabuf buffer per run through UDMABUF_CREATE_LIST - the start-up probe stores to the import from the GPU after CPU stores to the same pages and counts pages the CPU still reads stale (i915 maps dma-buf without snooping CPU caches); an incoherent measurement keeps the fallback off - decideImportWatch no longer returns early when there is no write watch: the coherence probe still runs there (its stale measurement is a plain CPU read after a GPU fill), so such devices measure instead of skipping the dma-buf fallback - the single shared backing resolver stays as a fallback for registrations that do not provide runs Co-authored-by: Mouad-Scriptz-0 <188722908+Mouad-Scriptz-0@users.noreply.github.com>
… watch and gate the mixed-watch import on it ProbeDmaBufImportWriteProtection returned before measuring when the write watch was unavailable, so on Linux the no-write-watch branch of decideImportWatch never measured and dmaBufImportsCoherent kept its default. The probe now registers and collects the watch only where it exists, as the host probe does, and that branch logs when the probe failed instead of reporting an unmeasured device as coherent. The mixed-watch branch of importRunAt created a dma-buf import without consulting dmaBufImportsCoherent; it now requires it. CheckDirectMemorySharedBackingRuns closes the duplicated file of the capacity-1 call when that call succeeds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
371a549 to
ca1d482
Compare
|
@blawesom's
Fedora 44, Intel Arc Meteor Lake, Mesa 26.2: @alfalfa-star, this head is the port plus those fixes, if the Kena scene with the same three rotated rounds is still on offer. |
|
AMD data point (the PR was only tested on Intel, where the fallback stays off): The Smurfs - Dreams (PPSA21607, Unreal Engine), CachyOS kernel 7.2.2, Ryzen 9 5950X, RX 6650 XT / RADV Mesa 26.2.4, main 9f25d0b + this PR + #6208 + #6501 + #6617 + #6566 (+ unrelated local rendering fixes). Same spot in the Smurfs' Village, standing still, On RADV the host-pointer import of shared direct memory fails ( With this PR the probe reports
The image is correct. The only flicker (a ground shadow briefly getting lighter) was there before and is unchanged. AI-assisted (Claude Code). |
|
Follow-up: without AI-assisted (Claude Code). |
|
@Mouad-Scriptz-0 @oneandonlydean Kena on this head (ca1d482) against its base
That is about +51% (mean 335 against 222 presents). It matches the 344 / 323 / 314 from our own run-list variant on 10-17, so the port keeps the gain. On The probe on this GPU (write watch present, so the watched branch) keeps the fallback on: No crash, skip or GPU reset in any of the six runs. These were perf runs without frame dumps, so they say nothing about the image. Tests on the head: the 24 AI-assisted: yes (Claude Code) |
What
Linux only. The dma-buf fallback of host imports (
createImport, when the host-pointer import fails) had two problems, found while chasing Minecraft's untracked textures. This is @blawesom's port of the original branch ontomain'ssharedBackingimport structure (port/4449, authorship kept), plus the fixes from the review of 10-17.GuestArenaSharedBackingRuns(libkernel, registered byDirectMemory) resolves a range into its runs in address order, up to udmabuf's 1024; one run keepsmain's chunked and sparse paths, several runs create one udmabuf throughUDMABUF_CREATE_LIST. The single resolver stays as the fallback for registrations that do not provide runs.guest_memorygainsCheckDirectMemorySharedBackingRuns: three physical allocations mapped back to back resolve to their runs with the right offsets and total, a sub-range starts inside the first run, and a short run array, a range past the mapping or an empty range are refused.staleAfterFill, in the[write-watch]line); a device measured incoherent does not use dma-buf imports and copies instead, which rules them out on Intel. Without a write watch the probe still runs, since that measurement is a plain CPU read after a GPU fill; it registers and collects the watch only where one exists, and the no-watch line says when nothing was measured. The mixed-watch import path (watchedDmaBuf != watchedHostPointer) also requires the coherence result.Tested
Fedora 44 (kernel 7.2.11, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, Intel Arc Meteor Lake, Mesa 26.2), branch onmain9f25d0b:guest_memory(with the new case),agc_dma_data_tests,agc_write_watch_coverage,agc_host_import_unmap,agc_driver_host_import_at_mapandagc_driver_host_import_teardownpass. The probe on this GPU reports4 stale after a GPU store over CPU writesfor dma-buf imports, so the fallback stays off here.tools/check_conventions.py --base origin/mainandgit diff --checkpass. Not tested: a device without a write watch (the branch the review found unmeasured), AMD or NVIDIA, Windows (no dma-buf path), and no title was run on this head; @alfalfa-star offered the Kena scene (#4449, 10-17) on the port.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)