Repository navigation
drm/asahi: g16: widen compute concurrency to 64/16 and cache shared UMA and fw_stamp - #3340
DjDeveloperr wants to merge 3 commits into
Conversation
…o 64 With non-SCS compute VMs sharing one UMA descriptor, pool, and hardware UMA slot across all units, each extension compute unit only backs 288 KiB of preempt, auxiliary, and context-store state. Previously, COMPUTE_UNITS=24, COMPUTE_PIPES=8, and a 32-flight compute cap forced 16 concurrent compute processes to share 8 pipes and contend over only 16 reusable units, and capped deep d=32/d=64 single-queue streams at 23 commands in flight. Widen COMPUTE_UNITS to 64, COMPUTE_PIPES to 16 (events 15..=30 in type-1 event word 1), and FLIGHTS to 64, and derive params::compute_flights() from COMPUTE_UNITS and FLIGHTS: - Compact extension compute unit records (k >= 2) into 1 MiB intervals at EXT_COMPUTE_REC_BASE (0x70b4000000..0x70b7e00000), keeping 26 disjoint 33 MiB SharedComputeUma migration windows below it and base units 0..2 unchanged. - Widen compute unit bitmasks (quarantined_compute_mask, compute_slot_mask, Lifetime masks) from u32 to u64 while keeping SCS slot selection bounded by COMPUTE_UMA_SLOTS (32). - Update host selftests to validate 64 compute units, 16 compute pipes, 26 UMA migration windows, and 64-bit unit masks. Signed-off-by: DjDeveloperr <[email protected]>
…ached Shared compute UMA descriptors and compute queue fw_stamp records do not need to be uncached on the firmware side: - Add a device-lifetime ComputeUmaPool on Factory that allocates persistent ASC-cached (FwCoherent) SharedComputeUma descriptors paired with uncached (Fw) counters. Because the descriptor is never unmapped, firmware can cache it across flights; a lease returns to the pool on drop only when every published flight has retired normally, keeping aborted or quarantined records out of circulation. - Map compute QueueSession fw_stamp records ASC-cached (FwCached) and observe compute retirement through the uncached service stamp written by the notifier service after firmware descriptor bookkeeping. This drops uncached firmware writes on every shared compute flight and eliminates the host read of the shared descriptor at retirement. Signed-off-by: DjDeveloperr <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Non-author review at Commit 1: 64 units, 16 pipes, 64 flights (
Commit 2: ASC-cached shared UMA descriptor and compute
Local checks (scratch worktree)
Owed before merge
|
Address non-blocking review notes on PR #3340: - Update the stale FLIGHTS = 32 reference in the RENDER_SLOTS doc comment to FLIGHTS = 64. - Format the two new compute_list/compute_context compile-time asserts in g16/hw.rs to match rustfmt. Documented clarifications from review: - Userspace visibility: widening FLIGHTS to 64 raises QUEUE_LIMITS.max_in_flight_per_queue from 32 to 64. - Compute retirement ordering: in 26B123 armfw_g16g.im4p, firmware advances UMA COMPLETED and cleans the ASC-cached descriptor in FUNC_0x2d540 before AGFCLDataMasterPostProcessingCallback (0x24fd8) and notifier flush FUNC_0x25198 store the uncached service stamp at 0x25634 (matching the J773g 26B123 live Metal compute hypervisor capture where descriptors and fw_stamp map 0x443 ASC-cached while service stamps map uncached). Signed-off-by: DjDeveloperr <[email protected]>
|
Re-review at Blocker: firmware disassembly details in the new commit message and the PR body
Checked at this head
Still owed: the text fix above, the J516s (M3 Pro, G15S) row, and build and KUnit once the PR is retargeted to |
Document the 64-flight limit and format the layout assertions. The reported per-queue limit rises from 32 to 64. Compute completion uses the uncached service stamp so progress and retirement do not depend on CPU reads of cached firmware records. Signed-off-by: DjDeveloperr <[email protected]>
3695a16 to
1de4e8f
Compare
There was a problem hiding this comment.
Superseded 12-01: not a hold under the merge bar (no shown failure). Full diff review deferred; follow-ups: land #3287 and retarget, main CI, hardware row, keep firmware-disassembly text out
Verdict: HOLD at 1de4e8f8
Blockers:
- Targets open non-
mainbase branchperf/g16-compute-shared-uma(#3287is stillOPEN); fullmainCI has not run. - Missing hardware row at head (
needs-hw-row), and ensure any firmware-disassembly details flagged in the earlier review comment stay stripped from commit messages and PR text before merge.
Checked:
- Verified
#3287is stillOPENand base ref isperf/g16-compute-shared-uma. - Deferred full diff review until
#3287lands and this PR is retargeted ontomainwith green CI and hardware row.
Evidence
- Base ref:
perf/g16-compute-shared-uma(#3287state:OPEN).
Depends on #3287
What: widen G16 compute concurrency to firmware/ring bounds and map shared compute UMA descriptors and compute
fw_stampcells ASC-cached.Two commits stacked cleanly on #3287 (
078f963c,perf/g16-compute-shared-uma):Widen compute units, pipes, and flights (
ee819069):Now that non-SCS compute VMs share one 32 MiB UMA pool and hardware UMA slot (
1..=32) instead of one per unit, compute concurrency is no longer capped at 24 units / 8 pipes / 32 flights. Every size is derived from its hardware/firmware limit:COMPUTE_UNITS = 64: bounded by theu64slot/quarantine mask width (<= 64),SCHEDULER_CREDITS = 64, the 256-entry compute work ring ((COMPUTE_UNITS - 1) * MAX_COMPUTE_RING_ENTRIES = 63 * 3 = 189 < QUEUE_CAP = 256), and client VA compaction (62 * 1 MiBextension records atEXT_COMPUTE_REC_BASE..scs_compute_records(0), preserving 26 disjoint 33 MiBSharedComputeUmamigration windows belowEXT_COMPUTE_REC_BASE, all compile-time asserted).COMPUTE_PIPES = 16: 16 contiguous Type-1 completion events (15..=30) in event word 1, fitting entirely inside word 1 without reading an extra event word (RETIRED_COMPUTE_PIPES = 16).FLIGHTS = 64: one in-flightFlightper compute unit, well insideAHEAD_RECORDS = 128and the wrapped stamp half-window.compute_flights() = COMPUTE_UNITS.saturating_sub(1).min(FLIGHTS) = 63: retains one spare compute unit for displacement so one queue never starves another queue or VM.SCS_COMPUTE_UNITSstays bounded byCOMPUTE_UMA_SLOTS = 32andpick_scs_compute_slots()clamps toCOMPUTE_UMA_SLOTS.Map shared compute UMA descriptors and compute
fw_stampASC-cached (97d88a25):ComputeUmaPoolonFactorythat allocates persistent ASC-cached (Class::FwCoherent,0x443)SharedComputeUmadescriptors paired with uncached (Class::Fw) submission counters. Because descriptors are never unmapped, firmware caches them across flights; aComputeUmaLeasereturns to the pool on drop only when every published flight retired normally (published_flights == retired_flights), keeping aborted or quarantined records permanently out of circulation.QueueSession.fw_stampASC-cached (Class::FwCached,0x443), matching macOS 26B123 (renderfw_stampstaysClass::Shared), and observe compute progress and retirement through the uncached compute service stamp written by the notifier service after firmware updatesfw_stampand completes descriptor bookkeeping.A third candidate commit (clearing
work+0x81con non-tail commands of multi-command compute flights + an 8 us sliding compute coalesce deadline) was A/B tested and dropped: the 8 us sliding timeout fragmented 4–5 command flights into 1–2 command flights (grouped 435k -> 309k,+95kSubmitRecords) and regressedcompute.light d=16/32/64by +3.3% to +6.2%.Tested:
3695a16489beb, including the documented per-queue limit increase from 32 to 64.asahiKUnit (./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig): 463 tests: 459 passed, 4 skipped, 0 failed.tools/testing/selftests/drivers/gpu/asahi-m4/run-host-tests.py): 26/26 passed, includingtest-resources.py(75/75:FwCoherentdescriptor /Fwcounter classes, settled pool recycling, permanent quarantine non-recycling, 64-unit VA disjointness),test-publication.py(87/87),test-poll-retire.py(43/43),test-stamp-wrap.py(28/28), andtest-progress-wrap.py(20/20).scripts/checkpatch.pl --stricton all 3 commits (078f963c..3695a16489beb): 0 errors, 0 warnings, 0 checks per commit;rustfmt: 0 new diffs.7.3.0-ARCH-m4cir2final-3695a164, module build ID58aae568f3648ecfdb946e319fad5077e30ad71b, standalone on drm/asahi: g16: share one compute UMA descriptor and pool per VM #3287 without drm/asahi: g16: map the compute notifier records ASC-cached #3285,946,628jobs, 0 kernel findings, 0 GPU faults/recoveries/hangs,compute_owners: retired 64 quarantined 0 reusable 48):vk-uma-quarantine clean 35):pre_ok=35 post_ok=35/35 fresh_ok=1.compute.light d=4/8/16/32/64:40.94 / 29.45 / 22.70 / 20.96 / 20.29 us(d=16/32/64beat Metal 4 by 4.3%–5.5% even before stacking drm/asahi: g16: map the compute notifier records ASC-cached #3285);procs d=16:38.93 us.sync.signal binary / timeline / host:24.77 / 24.87 / 169.25 us(binary/timeline beat Metal 4 by 0.9%–1.6%).compute.heavy alu d=1/2/4:771.61 / 537.35 / 537.35 us;bw d=1/2/4:1519.91 / 1267.43 / 1269.04 us;concurrent.cr interleave / queues:64.17 us / 1.03x;render.light tri d=16:58.93 us.s2idlegate ran stacked on#3285 + #3287(r2base = 9e0a1b30,r2cu64 = efe761b6,r2c2 = 70ad7b64, where#3285relocates the same uncachedwork+0x800service stamp fromnotifier + COMPUTE_STAMPtouser_stamp):r2base -> r2cu64):compute.light d=6422.87 -> 21.48 us(-6.10%),d=3222.59 -> 21.97 us(-2.73%),procs d=1639.96 -> 39.04 us(-2.31%); slot holds dropped 95.5% (384,607 -> 17,266) and cross-VM compute retargets dropped 98% (2,900 -> 60).r2cu64 -> r2c2):compute.light d=4-5.24%,d=16-9.92%,d=32-12.04%,d=64-11.49%,procs d=16-8.25%,sync.signal binary-10.46%,sync.signal timeline-10.10%.r2base -> r2c2 -> r2c2 -> r2base, 144/144 ok, 0 kernel findings, 0 GPU faults/recoveries/hangs, ~963k–994k jobs perr2c2boot):r2base(#3285+#3287)r2c2(C1+C2)compute.light d=4compute.light d=8compute.light d=16compute.light d=32compute.light d=64compute.light procs d=16sync.signal binary d=2sync.signal timeline d=2sync.signal host d=1compute.heavy alu d=1compute.heavy alu d=2compute.heavy alu d=4compute.heavy bw d=1compute.heavy bw d=2compute.heavy bw d=4concurrent.cr light interleave d=4concurrent.cr heavy queues d=4render.light tri d=16kit-r2c2,198,348jobs /348,964commands /job_max 64, 0 kernel findings, 0 GPU faults/recoveries/hangs):vk-uma-quarantine clean 35):pre_ok=35 post_ok=35/35 fresh_ok=1.--jobs 1, excluding drm/asahi g16: dEQP-VK.synchronization*multi_queue* faults the GPU and fail-stops it on J773g (main 61c7b88a) #3201multi_queue/cross_instance, 16,500 cases executed in slot):8,088 Pass / 8,412 NotSupported / 0 Fail,recoveries=0.s2idlesuspend/resume: woke cleanly after 13 s (S2IDLE_POST success=1 fail=0,DELTA_ERR=0), post-wake 7/7 suite passed (including CRC-verifiedrender.postfxMSAA 4x,compress.bw1440p,render.mdi1024 draws;compute.light d=16= 22.19 us).Risk: two-way · Macs on the g16 backend (M4 G16G; M3 G15S and G15G). A plain revert undoes it.
SharedComputeUma.descriptorasFwCoherentand computefw_stampasFwCachedrelies on device-lifetime backing for cached descriptors and on firmware writing the uncached compute service stamp only after descriptor bookkeeping completes. The J773g stress and suspend/resume rows above exercised this assumption. Mitigated byComputeUmaPoolnever unmapping allocated descriptors, refusing to recycle any lease whose published flights did not all retire normally (published_flights == retired_flights), retaining active leases inSlotsacross hardware slot handoff, and host selftests verifying both normal reuse and permanent quarantine pinning.sync.signal host d=1(+1.85%) andcompute.heavy d=1(+0.76% to +0.99%) show minor shifts while remaining 7.6%–14.0% ahead of Metal 4 oncompute.heavy d=1.Not yet:
mainafter drm/asahi: g16: share one compute UMA descriptor and pool per VM #3287 and drm/asahi: g16: map the compute notifier records ASC-cached #3285 merge. Progress, diagnostics and retirement must all read the uncached per-pipe user stamp on that base.compute.light procs d=16(+12.4%) andcompute.light d=4/d=8(+5.3% / +3.3%).