Repository navigation
drm/asahi: g17: expand single-pair M5 render depth to 64 - #3411
Conversation
Single-pair M5 render queues currently cap in-flight depth at 32 (RENDER_DEPTH = 32), matching the per-pair depth of dual-pair G17P queues even though each M5 owner holds only one physical render pair whose scratch/scene-table capacity already provides 64 slots (SCRATCH_SLOTS = 64, SCENE_TABLE_ENTRIES = 64). Under render-heavy workloads such as GTA V Enhanced (~55-80 renders per frame), capping a single-pair queue at 32 stalls admission mid-frame whenever the render pipeline has >32 commands queued. Derive per-device render depth from hardware capacity in pairs::render_depth_for(pairs_per_owner, scratch_slots): single-pair queues with >= 64 scratch slots use RENDER_DEPTH_MAX (64), while multi-pair or smaller-capacity queues keep RENDER_DEPTH (32). Plumb the derived depth through Backend::render_depth(), Scheduler credits, admission::Pool, compact window sizing, Target slots, Memory graph layout (128 KiB graph + 64 KiB config ring for 64 announce/config records), and retirement::Tracker. Move large depth-scaled arrays (Graph::owners, Memory::generations, Target::slots, Retired::owners, Dependencies::entries, and Tracker::entries) to pre-allocated KVec storage allocated off-lock so expanding depth to 64 keeps kernel stack frames smaller than baseline across allocation, submission, parking, and teardown paths. Add host contract tests in tools/asahi/g17-render-depth-tests.py and register them in tools/asahi/run-host-tests.py. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: FINISH, then merge at d3c3279f2cdc
Blockers: The recovery-storm forgiveness budget is changed globally from 32 to 64, including on devices whose per-pair depth stays at 32. The guard's stated budget is one per group a pair can hold. Please use the active depth for that budget or justify and test the expanded recovery policy independently. Cover both capacities, including the final un-forgiven event and the latched stop. Please also report the deepest supported call-chain stack total for queue creation. The published frame comparison still reports a 13,360-byte new_queue frame by itself, and individual frame reductions do not establish headroom through callees.
Checked: The submission depth is derived from pair count and scratch capacity, with distinct credits and storage sizing paths. The reported J714s saturation row covers the 64-deep path in the stated integration stack. A peer exercising unchanged-depth queue creation and recovery remains pending.
Evidence
recovery/safety.rs now uses RENDER_DEPTH_MAX unconditionally, while pairs.rs retains a separate 32-depth policy. The existing forgiveness test follows the same global constant and cannot distinguish the two cases.
…ueue in place Address review feedback on per-device render depth expansion: 1. Keep recovery-storm forgiveness in recovery/safety.rs bounded by each device's active render depth instead of raising it globally to RENDER_DEPTH_MAX (64). Storm::new() retains the 32 default and Storm::with_forgive_limit() accepts the active depth derived from pairs::render_depth_for_device(shared.variant.m5_commands) in boot() and boot_m5(). Extend both the KUnit test and compiled host tests (tools/asahi/g17-render-depth-tests.py, with global-forgive-64 and m5-stuck-32 mutations registered in run-host-tests.py) to cover both 32 and 64 capacities, including the final un-forgiven restart and permanent latched stop. 2. Return KBox<Queue<B>> directly from Queue::new() using KBox::try_init and in-place Proof::init() so Queue<B> and its 128-entry cached proof array never sit on Gpu::new_queue()'s stack before boxing. This drops Gpu::new_queue()'s own frame from 19,168 B (origin/main) / 13,360 B to 5,984 B, and cuts the deepest ASAHI_QUEUE_CREATE -> Gpu::new_queue -> Context::new -> ... -> Ledger::reserve call-chain stack total inside asahi_core from 24,800 B (24.22 KiB) to 11,584 B (11.31 KiB). Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: HOLD at f4607a22 pending hosted CI and final-stack hardware evidence. The new head addresses my code findings.
Checked: Both startup paths pass the calculated active render depth to the restart storm counter. Timeout forgiveness retains its existing default. The compiled host fixture covers both budgets, exhaustion, reset and the latched stop. Queue construction now calls the in-place proof initializer and returns the boxed queue directly.
Evidence
The author's commit reports an in-driver queue-create call chain reduced from 24,800 B to 11,584 B, with the entry frame down to 5,984 B. The scope is the driver call chain. The PR body still reports test results for the preceding head. Please attach hosted checks and final-stack qualification for the J714s 64-depth path and the J700 32-depth control.
|
Addressed both blockers in fast-forward commit
Verified |
|
J700 (MacBook Neo, Apple A18 Pro
|
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Resolve Queue::new(): keep the in-place pinned init from this branch and add the scratch field main introduced. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
The forward merge resolves the conflict and retains the active-depth recovery budget. The depth fixture is byte-identical to f4607a2. The integrated queue now also includes main’s work-state batching and retirement changes, so the prior J714s result supports the depth change but does not establish the combined path. Please post the current-head build and a focused J714s depth-above-32 run with stable retirement and no recovery faults.
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed the conflict-pass merge commit 3d80607 only: queue/mod.rs gets Scratch::default() for main's new field; runtime.rs union. The resolution keeps what each side had and adds nothing outside the conflict. Approved for the merge-up; merging still waits on CI and the rows at this head.
There was a problem hiding this comment.
Verdict: MERGE at 3d8060737511
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: Code reviewed in the earlier App review at this head (6122455008).
Follow-ups (not blocking): current-head build, J714s depth>32 run with stable retirement
Initialize the per-engine failure logs inside the pinned Queue initializer. Keep the 32-slot render template assertion and the separate M5 render depth limit. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Forward-merged |
Keep #3429’s ParkedReplay wrapper in the prepared queue so installing it preserves render-active accounting. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Forward-merged main |
The render depth change moved the owners of a pair's render slots from a stack array to a vector that every render preparation allocates. A replay after a GPU recovery prepares from the event worker while it holds the device lock, and a failed preparation there fails every group parked on the pair with ENOMEM. Preparation did not allocate there before unless the target grew. Hand the owners to the target as an iterator, so only a target that is replaced copies them. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Reviewed at Fixed in Checked
Tested on Not blocking, for a later change
Hardware. A J700 run covers the shared code, but not depth 64, which runs only on the M5 Macs. The last J714s run was at |
There was a problem hiding this comment.
Verdict: MERGE at 665f2bc
Checked: The revised prepare path passes a lazy iterator over generation owners. The existing target returns without collecting owners when capacity suffices. Growing a live target still copies its owners before replacing the backing, so retirement can release the old object. The depth and recovery host suite passed 5/5 at this head. The combined build and 353 host checks are recorded in the revision report. Merge #3390 first.
Follow-ups: #4199 tracks the 32-slot tiling-notification threshold on 64-slot render pairs. The exact host decision helpers requested 32 notifications using the current call and seven using the 64-slot policy for the same sample.
Keep the ordered parked-replay frontier on each loan and clear it when the pair returns. Reuse the preallocated dependency snapshot in the same paths, and retain both host-test suites. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Forward-merged main 571a6c4 as 2c10033. The resolution preserves the parked-replay frontier from #3991 and reuses the preallocated dependency snapshot from this series. ARM64 W=1 linked aurora.o with 45 warnings and no errors. G17 host checks passed 385/385 by itself and 392/392 with #3390. The J714s and J700 rows need the combined runtime with #3991, so the older f46dffa kits do not qualify this head. |
J714s Exact-Head Hardware Receipt (
|
| Check | Base (f19ea4889ac1) |
Head (71d040c7d2dd) |
Result |
|---|---|---|---|
DEPTH64 active max |
32 |
62 |
OK |
Vulkan CTS (36,567 cases) |
29,478 Pass / 7,089 NS / 0 Fail |
29,478 Pass / 7,089 NS / 0 Fail |
0 diffs, PASS |
gpubench (15 workloads) |
gb bad 0 |
gb bad 0, all 15 within A/A noise |
PASS |
Memory (one_client / depth drm_total) |
517.47 / 121.54 MiB |
517.43 (-0.05) / 122.04 (+0.50) MiB (dev_kernel_resident +8.73 / +13.23 MiB) |
OK |
| Kernel logs (measure + postsleep) | klog clean |
klog clean |
PASS |
| Deep sleep + post-sleep render | boot object resumes 0 -> 1, postsleep: render ok, klog clean (0.66s wake on macsmc USB2_plug) |
boot object resumes 0 -> 1, postsleep: render ok, klog clean (0.65s wake on macsmc USB2_plug) |
Identical on base & head* |
*row.py judge reported FAIL solely because both base (660 ms) and head (653 ms) woke early from deep sleep on the same lab USB-C macsmc USB2_plug event (<20s threshold, flagged as BASE ARM: 1 problems (same class on base is not head-only)). Every #3390/#3411 GPU, DEPTH64, CTS, memory, perf, and post-sleep render gate passed cleanly.
J714s 2c100334fea4 (#3411 + #3390 96262ad138c9): GPU/DEPTH64/CTS/MEMORY/PERF PASS (base-identical USB2_plug early wake noted above).
|
Merge check at head The PR diff against main is the same as the diff that aurora-silicon-review approved at So only the last-push rule is still open, because DjDeveloperr made that push. Per the 12-02 maintainer rule, this PR gets merged with |
|
J700 (MacBook Neo, A18 Pro, G17P) row of #3390 One Image Functional rows, both arms PASS: identity, GPU, overlap, CTS, faults, gpubench, latency run, two-client close, capacity, dmesg, watchdog; the hang round passed on both. Throughput (GPUBench, head vs base):
C1 latency trace (head/base, held because head is more than 5 % above base):
The cull cases are flagged noisy by the kit; |
|
J700 (MacBook Neo, A18 Pro, G17P) split row on main The arms ran on one Image
The J700 was verified back on stock after each boot. Adding this PR on top of #3390 (C/B, each a median of the pooled repeats) changes the five judged latency cases by 0.97 to 1.03, inside each arm's spread:
The cull d1 cases are too noisy on every arm to judge. GPUBench C vs B is within about 2 % everywhere except Full numbers: the comment on #3390. |
|
Merged Merge tree |
What:
Derive per-device G17 render queue depth from hardware capacity in
pairs::render_depth_for(pairs_per_owner, scratch_slots)so single-pair queues whose scratch/scene-table capacity already provides 64 slots (SCRATCH_SLOTS = 64,SCENE_TABLE_ENTRIES = 64) useRENDER_DEPTH_MAX(64) instead of capping at 32, while multi-pair or smaller-capacity queues retainRENDER_DEPTH(32). Plumb the derived depth throughBackend::render_depth(),Schedulercredits,admission::Pool, compact window sizing,Targetslots,Memorygraph layout (128 KiB graph + 64 KiB config ring), andretirement::Tracker. Move depth-scaled inline arrays (Graph::owners,Memory::generations,Target::slots,Retired::owners,Dependencies::entries,Tracker::entries) to pre-allocatedKVecstorage allocated off-lock so kernel stack frames stay smaller thanorigin/mainacross allocation, submission, parking, and teardown paths. Addtools/asahi/g17-render-depth-tests.pyand register it intools/asahi/run-host-tests.py.Tested:
f4607a228ded: candidate7.3.0-m5-pr67carries both commits' driver changes unchanged (identical changed lines indrivers/; only the host-test files differ), stacked with drm/asahi: g17: support staged and compute-prefixed renders in render_direct() #3388, drm/asahi: g17: allow inline cross-engine publication behind already-published producers #3390, drm/asahi: g17: run drm_sched submit workqueues at WQ_HIGHPRI #3391, drm/asahi: g17: batch report-ring drains and skip redundant render re-observe #3428 and the first commit of drm/asahi: g17: allow compute_direct() on mixed render/compute contexts #3429,origin/mainDTB. VK CTS 594 passed, 7 not supported, 0 failed (occlusion_query copy 152/159, concurrent_queries 2/2, multiview queries 16/16, synchronization smoke 12/12, synchronization2*read_image_compute*412/412); GTA V Enhanced 3024x1964 Very High TAA ran clean on Mesa kits inst-A (P4 55.76 FPS) and inst-R (P4 58.03 FPS); GPU online, 0 crashed, 0 faults.f4607a228ded: row in the comments, PASS, 0 failures, 0 GPU faults or recoveries.d3c3279f2cdcfb9787f5bd92ccdd4deeedffcd9atools/asahi/run-host-tests.py --only g17-): 232/232 PASS (including all mutations and newg17-render-depth-tests.py).scripts/checkpatch.pl --strict --ignore FILE_PATH_CHANGES: 0 errors, 0 warnings, 0 checks.llvm-objdumpstack-frame audit (asahi_core.ovsorigin/main): every render allocation, submission, parking, and teardown frame shrinks (Registry::reclaim_unused_render_spare8,256 -> 2,352 B,teardown::Service::detach9,040 -> 3,216 B,Gpu::new_queue19,168 -> 13,360 B,Memory::new9,504 -> 6,608 B,Backend::render_with_lease5,312 -> 3,200 B,Pair::prepare2,688 -> 2,096 B).G17S B1,origin/mainDTB SLC-off, Mesainst-A8643d38a0c91, stacked on#3380 + #3388 + #3390 + #3391as7.3.0-m5-depth64vsslot3-directcontrol):occlusion_query.copy_*152/159 [7 NotSupported],concurrent_queries.*2/2,multiview.queries.*16/16,synchronization.smoke.*12/12,synchronization2.op.single_queue.barrier.*_read_image_compute*412/412).gpubench-vk compute.cull_mdi(objs=16384,visible=75): d11041.67 us/submit, d2888.10 -> 883.39 us/submit(gpu_gap_us 0.375 us,ok).chainbench_diag(14 passes):V0_ALL_BAR 60x33306.7 us(21.90 us/pass),V1_FRAG_IMG_BAR269.3 us(19.24 us/pass),V5_ALL_BAR_LOAD267.4 us(19.10 us/pass).3024x1964native, Preset 2 Very High, TAA On,ResScalingType=0, no FSR/DLSS,origin/mainDTB SLC-off, 10 s 24 MHz GPU hop trace):94.99% -> 97.66%(+2.67 pp; GPU idle501.5 -> 234.2 ms,-53.3%).>1 msGPU blackouts:91(222.4 ms) ->1(1.2 ms) (-99.5%).>3 msGPU blackouts:21(78.0 ms) ->0(0.0 ms) (-100.0%); max GPU idle gap5.13 -> 1.20 ms.FR->TAidle:208.8 -> 14.0 ms(-93.3%); peak concurrent renders34 -> 66(7,261samples above depth 32).inst-A, SLC-off):55.07 -> 55.97 FPS(+0.90 FPS;P0=59.31 P1=54.42 P2=53.49 P3=59.85 P4=55.97); bonus run onkit R(aurora-wip 5ab97d0 + #1216, still SLC-off) reachedP3=61.71 / P4=57.92 FPS.online=1,crashed=0,quarantined=0,0GPU faults,0kernel errors/WARNs across CTS + microbenchmarks + two full GTA V runs.Risk: two-way · J714s
Not yet: