Repository navigation
drm/asahi: g17: M5: render large passes instead of losing the device after 26 s, refuse those that cannot fit, and account their memory to the client - #2501
Conversation
9d1e69b to
48c5f89
Compare
8a3871f to
daa0d08
Compare
|
No blockers. I checked these and they read correct:
Two nits:
HW row: an M5, M5 Pro or M5 Max (for example J815 or K114c) on this head, since commits 1 and 2 apply there. Run 16384x16384x22 and 512x512x2048 single-sample passes (correct readback), one over-4 GiB pass (SUBMIT returns ENOMEM, no lost device) and the same render CTS subset (no Pass to Fail). Check the client's fdinfo memory grows by the pair size during the large pass and returns afterwards. Pass: 0 failed units and no new kernel errors besides the intended ENOMEM line. Assisted-by: LLM (Claude:Opus 5.5) |
daa0d08 to
5d6427e
Compare
|
Thanks, Ryan. Both nits are fixed in the commits, now at 5d6427e, with no change in behaviour:
I've added your J775D on this head (stacked with #1973 and our other three open drm/asahi PRs on integration/aurora cc14570, 27.0 firmware, default command line; the kernel also carries a local fix for an appledrm boot oops, see #1973):
Rows we can't run: could your lab, or an owner of an M5, M5 Pro or M5 Max, run this head? These take the first two commits (the third only matters where a queue holds two pairs). The useful row is the same cases: 16384x16384x22 and 512x512x2048 with correct readback, a pass over 4 GiB returning ENOMEM without a lost device, fdinfo growing and returning, the render CTS subset, 0 failed units and 0 new kernel errors. |
|
Re-review of 5d6427e: No blockers.
The second commit is unchanged since the last review. HW row: the new numbers are from the M5 Ultra, on an integration stack with other open PRs and a local appledrm fix. Still needed: an M5, M5 Pro or M5 Max (one queue holding one pair) on this head: 16384x16384x22 and 512x512x2048 with correct readback, a pass over 4 GiB returning ENOMEM with no lost device, fdinfo growing during the pass and returning after, the render CTS subset unchanged, 0 failed units, 0 new kernel errors apart from the intended ENOMEM line. Assisted-by: LLM (Claude:Opus 5.5) |
There was a problem hiding this comment.
Pre-PR checklist review (§1–§6) on live head 5d6427e7cba76199c56b2b76cce8af2ac15abf4a (host-tests: pass).
Checklist Summary
- §1 No model gating: Pass — uses the existing M5 firmware path and architectural 32-bit compact-window size; commit 3 keys on queue pair count (
queue > 1), not chip IDs. - §2 Production-ready, no hacks: Pass — default command line, no new params/hacks.
- §3 Safety: Pass — no hardcoded hardware safety constants.
- §4 Clean-room & attribution: Pass — all 3 commits (
312bbde50816,aeed8c38c412,5d6427e7cba7) carry human author/committer and humanReported-by/Suggested-by/Signed-off-bytrailers only; PR body includesAssisted-by:. - §6 Naming: Pass — uses Borealis and Aurora naming.
- §5 Evidence: Still needs a 1-pair-per-queue M5/M5 Pro/M5 Max row for commits 1–2 in addition to the code fixes below.
Blocking Code Findings
-
Stale
State::wide[slot]can route a >2 GiB render onto the second pair and reproduce the 26 sENOSPC/lost-device failure (drivers/gpu/drm/asahi/g17/queue/admission.rs):self.wide[slot]is only written inState::pick()whenpairs == 1(self.wide[usize::from(slot)] = owner), and is never cleared whenself.owners[slot]changes or is cleared (take_idle,claim_sibling,reassign_unused_spare,cancel_empty_slot), nor are other slots cleared when a newwideslot is assigned forowner.- Concrete failure path on a 2-pair queue (owner
O):Opicks slot1for a 1-pair render (pairs == 1) ->wide[1] = O.- Slot
1leavesOviacancel_empty_slot(1, O)(failed/cancelled build before publication) orreassign_unused_spare(1, Some(O), ...)->owners[1]becomes0or another owner, whilewide[1]remainsO. O's next >2 GiB render takes slot2->owners[2] = O,wide[2] = O, and slot2builds and maps the >2 GiB target in the 4 GiB compact window.Oruns a small render (pairs == 2) andclaim_siblingclaims slot1back forO. Nowowners[1] == O,owners[2] == O, and bothwide[1] == Oandwide[2] == O.O's next >2 GiB render runs(0..cfg::RENDER_SLOTS).find(|slot| self.owners[*slot] == owner && self.wide[*slot] == owner), which returns the lowest-index slot (slot1) instead of slot2. Slot1then tries to map a second >2 GiB pair beside slot2's live >2 GiB pair in the 4 GiB compact window ->ENOSPC-> 26 s timeout / lost device.
- Fix: Clear
self.wide[slot] = 0wheneverself.owners[slot]is reassigned or cleared (take_idle,claim_sibling,reassign_unused_spare,cancel_empty_slot), and clear any priorwide[other] == ownerwhen recordingself.wide[slot] = owner. Add a KUnit case covering slot loss + sibling reacquire with a live wide slot at a higher index.
-
pair_window_bytes()omits task-stagemesh_storage(32 MiB default) mapped inM5_COMPACT(drivers/gpu/drm/asahi/g17/queue/render/m5_render_submission.rs):- For any render pass using a task shader (
programs.uses_task()),Memory::mesh_storage_register()(drivers/gpu/drm/asahi/g17/queue/render/memory.rs:672-685) mapsm5_mesh_storage_chunks * 64 KiB(default0x200chunks = 32 MiB, plus 16 KiB guard rounded to 64 KiB alignment) intoBlockGeometry::M5_COMPACTviaCompact::new_aligned(). pair_window_bytes()does not account for this reservation whenresources.as_deref().is_some_and(|p| p.uses_task())andm5_mesh_storage_chunks > 0. As a result, a task-shader pass whose pair fits in(4 GiB - 32 MiB, 4 GiB]passes SUBMIT instead of failing withENOMEM, and a pass in(2 GiB - 32 MiB, 2 GiB]getsfor_window() == 2even though two pairs plus mesh storage exceed the 4 GiB compact window.- Fix: Include the aligned
mesh_storagecompact-window reservation (whenuses_task()andm5_mesh_storage_chunks != 0, using a shared helper/constant withMemory::mesh_storage_register) inpair_window_bytes()and add a KUnit check.
- For any render pass using a task shader (
Verified Non-Blocking Items
KernelObject::client_backing()(g17/object.rs) properly orders fields (mapping,obj,ptr,size,charge) so GPU unmap and GEM teardown precede releasing the client charge, and RAIICommitrolls back admission on allocation failure.Object::new(buffer/target.rs) andTvb::allocate(buffer.rs) both pre-check compact-window room (check_m5_room) before allocating and cover both initial creation and growth (Target::ensure_capacity/Tvb::grow).DISCARD_BYTESdeduplication and SUBMIT-timeValidated::Render::pair_windowcaching are clean.
Also Needed Before Merge (§5)
- After fixing the two code issues above, re-prove on J775D and obtain a 1-pair-per-queue M5 / M5 Pro / M5 Max row on the updated head covering commits 1–2 (
16384x16384x22,512x512x2048readback, over-4 GiBENOMEMwith no lost device, fdinfo growth/release, render CTS subset, 0 failed units, 0 new kernel errors beyond the intendedENOMEM).
5d6427e to
45ccd86
Compare
|
Thanks dj, both findings were right, and both are fixed at the place the copy lived rather than at the four or five sites that could miss it. The branch is force-pushed with the fixes amended into commits 1 and 3 (commit 2 rebased onto the new commit 1, whose 1. Stale 2. Mesh storage missing from On the structure: every object a pair maps in the compact window is now one
The scratch, page-list and metrics sizes now come from one function each, used by both the allocation and the bound, and the context state's size in the bound is the board's layout that the pair allocates (it was worked out a second way from the cluster count). KUnit adds Same structure, not changed here: the other per-slot arrays in J775D row, on the PR's own base this time: kit
The rows on the previous head (kit KUnit: 364 of 366 pass, the two skips as on the base. The upstream host tests pass, 427 of 427 on the base and with the series, no result differing. Commits 1 and 2 each build on their own. M5 / M5 Pro / M5 Max: we only have the J775D. Commits 1 and 2 are the ones those parts take, so a row from RyanTheTide's lab or an owner would be welcome. The cases are in the PR body under "Still to run". Assisted-by: LLM (Claude:Opus 5.5) |
|
Re-review of 45ccd86: no blockers.
HW row: please give the kernel commit IDs that the Assisted-by: LLM (Claude:Opus 5.5) |
|
Thanks. Kit
Its baseline Assisted-by: LLM (Claude:Opus 5.5) |
|
Review notes (non-author):
|
There was a problem hiding this comment.
Formal pre-PR checklist (§1–§6) re-review at verified live head 45ccd865d466e3be56672bc46d020e6a26f67b35 (MERGEABLE CLEAN; live CI: host-tests pass).
Prior Code Blockers — Resolved
Both code blockers from 5d6427e7cba7 are cleanly fixed at 45ccd865d466:
- Stale
State::widemark (drivers/gpu/drm/asahi/g17/queue/admission.rs): Fixed —State::wideis now au64bitmask cleared on every owner change through the sole owner mutatorState::set_owner(),mark_wide()clears any prior slot for the same owner before setting the new one,pick()andcan_pick_render()sharewide(), and both reported loss/reclaim and reassignment paths are covered by new KUnit tests. - Omitted
mesh_storagein compact-window bound (drivers/gpu/drm/asahi/g17/buffer/compact.rs,m5_render_submission.rs): Fixed —buffer::compact::PairObject(with compile-timeALLexhaustiveness check) now unifies alignment, guard, mapping, placement, room checks, andPairSizes::window_bytes(), includingMeshStorageandSlotState(fromLayout::m5(board)), with KUnit tests at both the 4 GiB and 2 GiB edges. - J775D hardware kit provenance: Pinned to exact commits (
integration/aurora 371066885814+#1973+#2501at45ccd865d466vs same without#2501).
Checklist Summary (§1–§6)
- §1 No model gating: Pass — uses the existing M5 compact-window path and architectural 32-bit offset window; commit 3 keys on queue pair count (
queue > 1), not chip IDs. - §2 Production-ready, no hacks: Pass — default kernel command line, no new knobs or workarounds.
- §3 Safety: Pass — pre-checks compact-window room before allocation and prevents 26 s lost-device failures on oversized passes.
- §4 Clean-room & attribution: Pass — all 3 commits (
58b8f8620e03,fbded7d11534,45ccd865d466) carry human author/committer (Jeff Queisser) and humanReported-by/Suggested-by/Fixes/Signed-off-bytrailers only; PR body includesAssisted-by:. - §6 Naming: Pass — Borealis and Aurora naming used throughout.
- §5 Evidence: Blocker (see below).
Remaining Blocker (§5)
0 code, policy, attribution, naming, or CI blockers remain at 45ccd865d466. Holding APPROVE strictly for the missing cross-chip M5 hardware row covering commits 1–2 on a 1-pair-per-queue M5 / M5 Pro / M5 Max Mac (e.g., J813/J815/J714s/J716c) on 45ccd865d466 (default command line):
16384x16384x21andx22with >4 primitives (renders, thenENOMEMat SUBMIT without lost device);512x512x2048with verified readback;- a pass >4 GiB returning
ENOMEMcleanly without lost device; fdinfoclient memory rising during the pass and releasing afterward;- render CTS subset unchanged, 0 failed units, and 0 new kernel errors beyond the expected
ENOMEMrefusals.
Non-Blocking Notes
KernelObject::client_backing()usingCharge::user(commit, None)matches existingg17/freelist.rs:403(sharedmm/OOM attribution gap for scheduler-allocated client objects can be addressed together in a follow-up, alongside charging capped NEO/G17P targets and adding a KUnit charge-refusal test).- Merge-train coordination: this PR conflicts textually with
#2520indrivers/gpu/drm/asahi/g17/queue/render.rs.
…compact window before allocating them On M5 a render pair's target records, TPC object and initial parameter buffer are sized from the client's render pass. The record and TPC limits apply only to the other G17 parts, so on M5 these sizes were bounded only by integer overflow. A pair allocated and zeroed each object in full before mapping it into the client's compact window, so a layout too large for the window was allocated first and then failed at the mapping, and the render was retried while the runtime waited for capacity. The other parts are bounded by the window their targets live in. On M5 that window is the client's compact window, which the firmware addresses with 32-bit offsets: 4 GiB. A pair maps there its target records (one stride of the page-rounded record for each of the 32 command slots), its TPC object, its initial parameter blocks at 0x88000 bytes each, about 3.8 MiB of objects its layout does not size (the context state of each command slot, the parameter buffer's scene scratch, discard and page list, and its metrics entry) and, while the task-stage binding is enabled, the 32 MiB of mesh storage it maps on its first task-stage kick and keeps for the passes that follow. A layout whose pair does not fit in the window can never be mapped, so deriving the layout, which SUBMIT already does for every M5 render, now refuses it with ENOMEM before anything is queued or allocated. The window's objects are described once (buffer::compact::PairObject): each with its alignment and guard, used by its mapping and by the room check before its allocation, and SUBMIT's bound sums the same list, so the bound cannot leave out an object a pair maps or disagree with its placement. Each size in the bound is the one the allocation uses: the context state comes from the board's layout, as the pair allocates it. The mesh storage counts in every pair, whether or not the pass has a task stage, as the pair keeps it. The bound depends on the pass's tile size and on whether it is marked as drawing few primitives, which sets how much of the TPC object is needed. On the M5 Ultra, for a single-sample pass with 32x32 tiles, the size the Borealis Vulkan driver uses for such a pass, this admits a 16384x16384 target of up to 21 layers when the pass draws more than four primitives, and up to 53 layers when it draws four or fewer; 2048 layers of a target up to 1024x1024, or up to 2048x2048 with few primitives. With 16x16 tiles it admits up to 5 layers at 16384x16384 and 2048 layers up to 512x512. KUnit pins these sizes, their first refused neighbours, and the mesh storage at the window's edge. The window is shared by the client's pairs, so a layout that fits on its own can still find too little room. Before allocating a target object, parameter-buffer blocks or the mesh storage, a pair now checks that the window has a hole for the object and room for all the blocks, and fails with ENOSPC, as the mapping would, without allocating them. Other G17 parts are unchanged. Reported-by: Erik Bourget <[email protected]> Suggested-by: Erik Bourget <[email protected]> Suggested-by: Ryan Murray <[email protected]> Suggested-by: DjDeveloperr <[email protected]> Signed-off-by: Jeff Queisser <[email protected]>
…izes it On M5 a render pair's target records, TPC object and parameter buffer are sized from its client's passes and geometry: up to the 4 GiB of the client's compact window for each pair, and a client can hold a pair on each of its queues. They were allocated as kernel memory, which counts toward the device total but is not refused and is attributed to no client, so the client's memory limit and fdinfo did not include it. Charge that backing as the M5 pool backing is charged: admitted against the client's and the device's memory limits before it is allocated, as a user buffer of the same size would be, and counted as the client's held memory instead of kernel memory until it is freed. This covers the target records and TPC object when a pair is built for a client and when a larger target replaces them, and the parameter buffer's initial blocks and every growth. A refusal fails the allocation with ENOMEM: building or growing the pair for a render fails that render, and a growth the firmware asks for is declined, as when the buffer is at its largest. The client's fdinfo now includes this memory. Other G17 parts are unchanged. Reported-by: Erik Bourget <[email protected]> Suggested-by: Erik Bourget <[email protected]> Signed-off-by: Jeff Queisser <[email protected]>
…one render pair, so it renders instead of failing after 26 s On the M5 Ultra a render queue may hold two render pairs. Each pair maps its own target records, TPC object and parameter blocks, sized from the pass, in the client's 4 GiB compact window. The first render of a pass warms the second pair at the same layout, and admission spreads a queue's renders over both. A pass whose pair takes more than half the window, such as a single-sample 512x512 pass of 2048 layers or a 16384x16384 pass of 22 layers (2.2 to 2.4 GiB a pair), never rendered: building the second pair failed with ENOSPC, the render waited for room that its own first pair held, and after about 26 seconds failed with EBUSY, which the client saw as a lost device. Skipping the second pair when it does not fit is not enough: with three such renders in flight the third went to the unbuilt pair and failed the same way. Decide per render how many pairs its queue uses: both for a layout the window holds twice, else one (g17::pairs::for_window). SUBMIT, which already derives the layout, keeps the window bytes of one pair on the command, and the decision reads them there. A render that runs on one pair goes, through admission, only to the pair that took its queue's previous such render, so the large layout's objects exist in one pair, and it claims and warms no sibling. The scheduler's admission check applies the same rule, so it waits for that pair rather than for any. Smaller renders of the same queue still use both pairs. The optional warm-up of a sibling for which the window or the client's memory limit has no room is skipped as a busy one is, and the render runs on its pair. Which slot took those renders is kept with the slot's owner, as part of the owner's tenure of it: a slot that leaves the queue, whether its build was cancelled, it was given to another queue as a spare, or the processors stopped, comes back unmarked, so the renders stay on the pair that holds the large layout's objects, and a queue has at most one such slot. The rule only narrows a queue's renders to a slot it already holds: a held, quarantined or killed slot is handled as before, and no slot goes to another queue. On the M5 Ultra, Borealis (Vulkan) renders of 512x512x2048 (one, and two, three or four in flight), 16384x16384x22, 2048x2048x2047 and 1152x1152x2048 are now correct; heavy 1080p fill and geometry rows at depth 8 still run on both pairs, at the same time per submit as before (38.2 and 36.9 us) and 7-10% faster than on one pair. KUnit covers the decision and the admission routing: renders that run on one pair stay on the same pair up to its depth and never move to the other, a new queue whose renders need one pair claims no sibling, a slot lost and claimed back, or given to another queue and claimed back, does not take them from the pair that holds the layout, and the mesh storage moves a pass at the window's half to one pair. The admission fixtures of the host tests (tools/asahi) take the new State helpers, so they build the code they test. Other G17 parts, which hold one pair per queue, are unchanged. Fixes: b1c9a21 ("drm/asahi: g17: restore two render pairs per queue on G17D within the shared QID capacity, 9-15% faster heavy 1080p rows at depth 8") Suggested-by: Ryan Murray <[email protected]> Suggested-by: DjDeveloperr <[email protected]> Signed-off-by: Jeff Queisser <[email protected]>
45ccd86 to
4fd2974
Compare
|
Rebased onto Only change from Re-verified on the rebased head:
Still holding for the 1-pair-per-queue M5 / M5 Pro / M5 Max hardware row before merge; Assisted-by: LLM (Claude:Opus 5.5, Gemini:Neon) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: HOLD at 4fd2974238b1
Blockers:
- §4 (PR body): Remove the AI attribution footer on the last line of the PR body (and omit AI attribution footers from PR comments). The three commits themselves carry human author/committer and trailers only.
- §5 (PR body structure): Add top-level
**What:**,**Tested:**,**Risk:**(two-way door · M5 / G17 Macs), and**Not yet:**lines to the PR body, keeping full tables and logs in<details>blocks. - §5 (Exact-head HW rows): Record an exact-head (
4fd2974238b1) J775D verification and regression row (the rebase from45ccd865d466resolved a conflict in touched filedrivers/gpu/drm/asahi/g17/queue/render.rs) and the pending 1-pair-per-queue M5 / M5 Pro / M5 Max row at4fd2974238b1covering commits 1–2 (16384x16384x21render andx22ENOMEMwith >4 primitives,512x512x2048readback, >4 GiBENOMEMwithout lost device,fdinforise/release, render CTS subset unchanged, 0 failed units, 0 new kernel errors beyond expectedENOMEM).
Checked: Full 20-file diff across e87e13858b5d..4fd2974238b1 (0 code blockers; clean rebase over #2520/#1902 and compatible with main including #2433), §1–§6 pre-PR checklist, commit trailers, CI (host-tests: SUCCESS), and HW evidence rows.
Evidence
Code Audit (0 code blockers)
- Compact-window accounting & pre-checks (
drivers/gpu/drm/asahi/g17/buffer/compact.rs,buffer.rs,buffer/target.rs,queue/render/m5_render_submission.rs,queue/render/memory.rs,queue/render/generation.rs): Every client-VM mapping intoM5_COMPACT(Records,Tpc,ParameterBlock,SlotState,Scratch,Discard,PageList,Metrics,MeshStorage) routes throughPairObject, with compile-timePairObject::ALLexhaustiveness checking, checked arithmetic throughout,Layout::m5(board)for per-slot state sizing (DEPTH = 32),DISCARD_BYTESshared withfw/m5/pool.rs, and room pre-checks (PairObject::check_room) prior to allocation on both initial creation and growth. - Client memory accounting (
drivers/gpu/drm/asahi/g17/object.rs,buffer.rs,buffer/target.rs):KernelObject::client_backing()admits viaLEDGER.admit()before allocatingnew_kernel_object_wc_user_charged()(RAIICommitrolls back on failure), holdsChargeas the final struct field so GPU unmap and GEM teardown precede charge release, and leavesBlockGeometry::NEOand non-M5 targets untouched. - Per-render pair selection & admission (
drivers/gpu/drm/asahi/g17/pairs.rs,command.rs,queue/admission.rs,runtime/backend.rs,runtime/render/prepare.rs,runtime/render/submit.rs): SUBMIT cachespair_windowonce onValidated::Render;pairs::for_window()only narrows whenqueue > 1and two copies exceed the 4 GiB window;State::set_owner()is the sole writer ofownersand clears thewidebit on owner transitions;can_pick_render()andpick()sharewide()and safely wait outPlan::Pair(other)whenhazard::planrequires barrier room. - Rebase &
maincompatibility:prepare_bind()indrivers/gpu/drm/asahi/g17/queue/render.rscleanly preservesself.boardahead of#2520's cross-VMclear_render_ring()and#1902'shost_growth_target(). Verified no conflict or symbol clash with#2433onmain(Generation::retireremoval ingeneration.rsis disjoint).mergeable == MERGEABLE.
Pre-PR Checklist (§1–§6)
- §1 No model gating: Pass — uses existing M5 compact-window path, architectural 32-bit offset window, board
Layout::m5(board), and queue pair count (queue > 1). Non-M5 G17/G16/G15/G14/G13 and 1-pair-per-queue M5 paths are unaffected by commit 3. - §2 Production-ready, no hacks: Pass — works on default kernel command line; no new parameters, delays, or lab-only paths.
- §3 Safety: Pass — no hardcoded hardware safety constants; refuses impossible layouts at SUBMIT (
ENOMEM) and prevents 26 s lost-device failures. - §4 Clean-room & attribution: Blocker — commits
e87e13858b5d,f58724566915,4fd2974238b1are clean (human author/committerJeff Queisser,Signed-off-by:and human trailers only, clean-room), but the PR body ends with an AI attribution footer (and recent comments also carry one). - §5 Evidence & PR structure: Blocker — missing top-level
What:/Tested:/Risk:/Not yet:fields in the PR body, J775D HW row is on prior head45ccd865d466before the conflicting rebase inqueue/render.rs, and the 1-pair-per-queue M5 / M5 Pro / M5 Max row is still pending. - §6 Naming: Pass — Borealis and aura naming used cleanly across title, body, commits, and diff.
Commits & CI
- Commits at head
4fd2974238b17937ba757b1983513c0886979b29:e87e13858b5d,f58724566915,4fd2974238b1(allSigned-off-by: Jeff Queisser <[email protected]>). - CI at
4fd2974238b1:host-tests(Host tests) —SUCCESS.
Non-Blocking Follow-Ups
- Attaching submitting client
mm/RSS attribution toKernelObject::client_backing()(matchingg17/freelist.rs), charging capped NEO/G17P targets, and adding a KUnit charge-refusal test remain fine as separate follow-ups.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 4fd2974238b1: the code is ready; it needs only a row at this head.
Blockers: none in the code. Missing row: the J775D row is at 45ccd865, and the rebase to this head resolved a conflict in queue/render.rs, so it needs one more run at the new head: the same J775D checks (the 512x512x2048 readback, >4 GiB refused with ENOMEM and no lost device, fdinfo rising and falling). The branch also conflicts with main again. Once it's updated, the row goes on that head. A 1-pair-per-queue M5 Pro run of commits 1–2 is one we'll run on our J714s.
Checked: no Apple material, no chip gates. Every mapping into the compact window goes through PairObject with checked arithmetic, and a layout that can't fit is refused at SUBMIT before anything is allocated. The memory is charged to the client and released after unmap. set_owner() is the only writer of owners and clears the wide bit on every change, which fixes the stale-wide path from my first review. KUnit 404/406 (2 skips), CI green. This replaces my earlier reviews: the body template and the footer aren't blockers, and I removed the footer myself.
Evidence
Read the 20-file diff e87e1385..4fd29742 and your 11-23 rebase note (range-diff equal for commits 2 and 3). Follow-ups, not blocking: a KUnit case for the charge (taken, released, refused at the limit), and per-client RSS attribution as in g17/freelist.rs.
Superseded by the review at 4fd2974
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
The approved |
Signed-off-by: Jeff Queisser <[email protected]>
…ng under QID pressure When an owner holds two render pairs and one has been marked wide (the slot carrying the larger parameter-buffer layout), reclaiming a sibling under QID pressure should take the non-wide sibling before disturbing the wide pair. Update State::reclaim_sibling(), Registry::reclaim_unused_render_spare(), and Registry::reclaim_unused_render_sibling() to pass over wide-marked siblings first and only fall back to reclaiming a wide sibling if no non-wide sibling is available. In render.rs, pass 3 omits any wide filter so a slot whose wide mark moved between pass 2 and pass 3 is still reclaimed rather than skipped. Detaching a published sibling keeps release_unused_sibling(..., true) + release_owner() unchanged so exit-kill ownership stays intact. Add KUnit tests covering non-wide-first reclaim (and clearing of the wide mark on detach) and the open-queue capacity gate and release_owner path for wide-marked owners. Signed-off-by: Jeff Queisser <[email protected]>
|
Merged Re-verified at
|
satchlj
left a comment
There was a problem hiding this comment.
Gemini 4 Neon on @satchlj's behalf
Verdict at 4fc8d0f4be14
APPROVE — Clean M5 compact-window (4 GiB) PairObject accounting, upfront submit sizing, and wide-layout single-pair routing with solid KUnit/host coverage, green CI, and an exact-head J775D A/B hardware row.
Blockers
None.
Checked
- Full diff audit (21 files,
+961/-121):PairSizes::window_bytes()enforces the 4 GiB compact-window ceiling upfront at SUBMIT time (ENOMEMbefore allocatingPairObjects).KernelObject::client_backing()chargesPairObjectallocations cleanly throughmemacct::LEDGER.admit+Charge::userwith proper teardown accounting.pairs::for_window()routes wide layouts to a single pair;State::widebitmask is tracked consistently acrossset_owner(),release_owner(), andrelease_unused_sibling(), andreclaim_sibling()prefers non-wide siblings before evicting wide ones.- KUnit and host unit tests cover window-size bounds, wide-pair routing, sibling reclamation preference, and backing-memory ledger accounting.
- Hosted CI at
4fc8d0f4be14: 3 successful, 1 skipped, 0 failing (Host tests10m2s,pr-text5s,pr-readiness10s). - Hardware evidence: Exact-head J775D (M5 Ultra) A/B row posted on this PR at
4fc8d0f4be14. - Untested scope: Static code review, CI verification, and posted hardware row review only (no local kernel build or boot performed).
Evidence
- Head:
4fc8d0f4be14(OPEN|false|MERGEABLE) - Diff audited in full: 21 files (
+961/-121) - CI:
All checks were successful (3 successful, 1 skipped, 0 failing, 0 pending)
Main's aurora-silicon#2501 charges an M5 render pair's parameter buffer to its client through KernelObject::client_backing(), and checks the M5 compact window for room before allocating blocks. This branch charges tiler-heap growth to the client per extension and keeps the extensions made so far when a growth stops short. Conflicts in g17/buffer.rs and g17/object.rs, resolved as the union: - the primary blocks use main's Tvb::allocate(): M5 checked for room and charged to the client, NEO kernel memory, as before; - an M5 block is mapped with main's PairObject::ParameterBlock.map(); - each growth extension of an M5 heap checks the compact window for room for its own blocks before it is allocated, so a window without room ends the growth with ENOSPC there, as a full growth arena does on NEO; - growth keeps this branch's charging (Tvb::extension()), so it is counted once. Signed-off-by: Jonathan Goyvaerts <[email protected]>
What: Bound M5 render-pair allocations against the 4 GiB compact window before allocating (
ENOMEMat SUBMIT instead of failing mid-flight), account render target/TPC/parameter-buffer/mesh-storage objects to the client, and route wide passes that fit only once in the window onto a single render pair (preferring non-wide siblings when reclaiming under QID pressure), fixing the 26 s lost-device failure on passes like512x512x2048.Tested: J775D (Mac Studio, M5 Ultra) at
4fc8d0f4be14on baremain(bf03d7419ea8) under published Aurac0aaf3162edeon 27.0 firmware:512x512x2048renders in 179 ms with verified readback (and 2 in flight in 200 ms; baseline fails withEBUSY/ lost device after 26.6 s), oversized passes (16384x16384x54,16384x16384x22/23with >4 primitives) returnENOMEMat SUBMIT with 0 lost devices and clean follow-up render+compute, clientfdinfo/gpu_memoryrise and release cleanly (kernel_resident37–45 MiB vs 2288 MiB baseline), render CTS subset 571 Pass / 57 NotSupported / 0 Fail unchanged, 0 new kernel errors, 0 new failed units. KUnit: 87 suites, 453/457 pass, 0 fail, 4 skip (including both new wide-reclaim KUnit tests). G17 host tests (g17-admission-order-tests.py,g17-quarantine-drain-tests.py,g17-resource-tests.py): all pass.Risk: Two-way door · affects the M5 render path (G17 parts using the 4 GiB compact window), selected by the existing M5 firmware path with no chip/board gate; wide single-pair routing and non-wide-first reclaim apply only where a queue holds two render pairs (G17C/G17D).
Not yet: 1-pair-per-queue M5 / M5 Pro cross-board hardware row (if still desired alongside the approval); Linux VM full
host_tests_vm.shdiff summary pending final run at4fc8d0f4be14.Details
Why this shape
buffer::compact::PairObject(with compile-timeALLexhaustiveness), unifying alignment, guard, mapping, placement, room checks, andPairSizes::window_bytes(). Every owner change inadmission.rsgoes throughState::set_owner(), which drops thewidebitmask whenever a slot changes hands, andState::reclaim_sibling(),Registry::reclaim_unused_render_spare(), andRegistry::reclaim_unused_render_sibling()pass over wide-marked siblings first under QID pressure while keeping published-sibling detach (release_unused_sibling(..., true)+release_owner()) intact for exit-kill ownership.ENOMEMbefore allocation, client memory accounting tracks the backing instead of kernel memory, and 2-pair queues run wide passes on one pair without disturbing other queues' wide pairs during reclaim.Change
Five commits on
main(bf03d7419ea8, non-force-push merge preserving prior review history):e87e13858b5d—drm/asahi: g17: M5: refuse render target layouts that cannot fit the compact window before allocating themf58724566915—drm/asahi: g17: M5: account render target memory to the client that sizes it4fd2974238b1—drm/asahi: g17: M5: run a pass the compact window holds only once on one render pair, so it renders instead of failing after 26 s329cb8a00570—Merge branch 'main' into pr/m5-render-pair-memory(resolvingadmission.rsagainst published-sibling detach and updating G17 host-test extractors)4fc8d0f4be14—drm/asahi: g17: keep an owner's wide-layout render pair when reclaiming under QID pressure(prefer non-wide siblings before wide siblings inState::reclaim_sibling(),reclaim_unused_render_spare(), andreclaim_unused_render_sibling(), with 2 new KUnit tests)Follow-ups (outside this series):
mm/RSS attribution for scheduler-allocated client objects, charging capped G17P targets, and a KUnit charge-refusal test.Evidence
Testing
Own-base A/B row on J775D (Mac Studio, M5 Ultra): kit
pr2501-m3(windowqspi2501m3@20261124-1504) is baremainbf03d7419ea8plus this branch at4fc8d0f4be14(no other PRs carried), compared against baseline kitpr2501-m3b(windowqspi2501m3@20261124-1504), baremainbf03d7419ea8alone. Both arms ran one-shot with a read-only root on the default J775D command line through the 27.0 stub under published Aurac0aaf3162ede. Borealis, single-sample R8, all four corners read back:pr2501-m3bpr2501-m3fdinfopeak16384x16384x15512x512x2048EBUSY/VK_TIMEOUTafter 26.6 s, lost device,kernel_resident=2288 MiB)16384x16384x2216384x16384x21(HKENOMEM_TRIS=8)16384x16384x17(2 in flight)16384x16384x16(2 in flight)16384x16384x54(>4 GiB)ENOMEMat SUBMIT, no lost device, follow-up render+compute clean)16384x16384x22&x23(HKENOMEM_TRIS=8)ENOMEMat SUBMIT, no lost device, follow-up render+compute clean)gpu_memoryonpr2501-m3:user_committedpeaked at 16183 MiB during the tests and returned to 1819 MiB 5 s after the last case (vs 1811 MiB before the refusal cases);kernel_residentstayed 37–45 MiB (vs 2288 MiB on baseline512x512x2048).pr2501-m3:client_failed=0,lost=0,recov=0,e110=0,fwrestart=0,timedout=0,fault=0,WARNING/BUG/Oops/panic=0,refused=3(the 3 expectedENOMEMrefusals), 2 failed systemd units (iwd,systemd-networkd-persistent-storage, exact same 2 as baseline), 0 newerr-level kernel lines vs baseline (8 vs 8).CONFIG_KUNIT=y,CONFIG_DRM_ASAHI=y,kunit-vzwith upstreamaop_motion.rsdisabled): 87 suites; 453/457 pass, 0 fail, 4 skip, includingreclaim_prefers_non_wide_sibling_and_clears_wide_on_detachandwide_render_respects_open_queue_capacity_gate_and_release_owner.tools/asahi/g17-admission-order-tests.py,g17-quarantine-drain-tests.py,g17-resource-tests.py): all pass.