Repository navigation
drm/asahi: g17: expand single-pair M5 render depth to 64 - #3411
DjDeveloperr wants to merge 3 commits into
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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
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: