Repository navigation
drm/asahi: g16: keep 64 standby parameter-buffer epochs per VM - #4035
Conversation
At render depth 64 (render.light tri d=64), standby.reserved exceeds SPARE_EPOCHS = 32, so every commit_render() -> release_reserved() trims an epoch (deferring client unmap and UAT TLB sync) and the very next ASAHI_SUBMIT -> Cache::prepare() allocates, zero-fills, client-maps, and UAT-syncs a replacement via PbEpoch::new_for(). J773g CPU sampling attributed 55.6% of focused CPU (Window::sync_inner, rust_helper_readq, and cleanup worker mutex contention) and a 249.56 us p95 submit tail to this per-submit churn. Raise SPARE_EPOCHS from 32 to 64 (1/4 of budget::LIMIT = 256, matching d=64 render pipelines) with a compile-time budget assertion: - Shallow VMs (d <= 32) never pre-allocate extra epochs and see zero memory change. - Deep d=64 render VMs retain their standby epochs across steady-state submits without per-submit eviction, zeroing, or UAT syncs. Each extra set has 96 KiB of page-rounded backing, for up to 3 MiB of backing plus metadata and 1.5 MiB of DYNAMIC VA per deep VM. Bursts above 64 still trim back to 64 and Cache::close() still drains all unreserved epochs immediately. - Add a host selftest regression exercising production release_reserved() at steady-state depth 64, above-ceiling trim, and close drain. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed 00f3d43. The larger standby cap remains within the existing budget. Allocation is demand-driven and the existing cache close still drains standby records. Hardware A/B is pending.
|
J516s (M3 Pro) g16batch row: FAIL (judge exit 1). Except for one CPU-time flag that looks like noise, every failure also happens on base. For this PR: Kernel Same on both arms:
Why the judge says FAIL:
The J516s is back on its stock kernel ( |
|
J516s |
|
The J516s run retained only 4–7 standby epochs. The remaining row at |
J773g (Mac mini M4, T8132, G16G B0)
|
|
J773g and J516s showed no regression and 48/48 clean client teardowns, with only 4–7 epochs retained. The host test covers the 64-epoch ceiling and drain. The merge tree after #4033 is identical to the one that passed ARM64 W=1, both scoped host suites, and checkpatch. |
What: Keep up to 64 standby parameter-buffer epochs per VM on g16 instead of 32, so a client with 64 renders in flight stops freeing and rebuilding one on every submit.
Tested: No hardware run at the head of this PR; an earlier combined run is in Evidence. Local checks at
00f3d43b9640: arm64 W=1 build ofdrivers/gpu/drm/asahi(clang) with the same warnings as main,run-host-tests.py --only asahi-m41/1 and--only g162/2, checkpatch --strict clean.Risk: two-way · M4 (T8132) and M3 (T8122, T6030). A VM that renders 64 deep can keep up to 3 MiB more records and use 1.5 MiB more GPU address space; a VM that renders up to 32 deep keeps what it keeps today.
Not yet: J773g and J516s base/head ABBA at the head of this PR:
render.lightd16, d32 and d64, with submit CPU time (median and p95) and memory per VM; many-client open/close. No performance gain is claimed until that ABBA is in.Details
At depth 64 the standby pool holds more epochs than its ceiling, so each
commit_render()trims one, with a deferred client unmap and a TLB sync, and the next submit allocates, zeroes, maps and syncs a new one. 64 is a quarter ofbudget::LIMIT, and a compile-time assertion keeps it inside that budget. Extra epochs are allocated only when a VM renders that deep. Bursts above the ceiling still trim back, and closing the cache still drains it.Evidence
CPU profile on the J773g, stock kernel
efed1ae377ba, gpubench7a0dfcf8, 12-01,render.lighttri d64:Window::sync_inner,rust_helper_readqand the cleanup worker's mutex spin took 55.6 % of the focused CPU samples. The submit ioctl had a 6.92 µs median and a 249.56 µs p95.Hardware, supporting only:
render.lighttri d64 went from 61.3 µs on that kernel to 45.2 µs on the 16-commit tree53599499071a(module on kernel6c83a2a64539, 12-02, CRCs valid). Other changes in that tree affect the row, so this is not an A/B of this PR.The host test runs the production release path at a steady depth of 64, above the ceiling, and at close.
Checks ran on main
d1ae4f292b93plus this branch.