Skip to content

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

Open
funkzy wants to merge 3 commits into
aurora-silicon:mainfrom
funkzy:pr/m5-render-pair-memory
Open

funkzy wants to merge 3 commits into
aurora-silicon:mainfrom
funkzy:pr/m5-render-pair-memory

Conversation

@funkzy

@funkzy funkzy commented Nov 20, 2026 •

Copy link
Copy Markdown

Problem

On M5 a render pair's target records, TPC object and initial parameter buffer are sized from the client's render pass, with no cap. The objects were allocated in full before they were mapped into the client's 4 GiB compact window, and they were accounted as kernel memory rather than to the client. On the Mac Studio (M5 Ultra, J775D) a pass whose pair took more than half the window, such as a single-sample 512x512 pass of 2048 layers, never rendered: the queue's second render pair did not fit beside the first, and after about 26 s the client saw a lost device.

Why this shape

  • Where the decision lived. The bound and the mappings are two views of one thing: what a pair maps in the compact window, and how it is placed. Before this series the mappings each carried their own alignment and guard at the call site, and the bound needed a second, hand-kept list of the same objects. dj's review found that list missing the task-stage mesh storage. A check of every mapping found two more mismatches: a page list the window does not hold, and a fixed-address metrics mapping outside the shared placement.
  • The narrow alternative would add the mesh storage to the list. The next object mapped there would need someone to remember the list again.
  • The one source used. Each object is now one buffer::compact::PairObject with its alignment and guard. Its mapping and its room check go through it, and SUBMIT's bound sums the same objects, so an object cannot be mapped there without a size in the bound. Each size in the bound is the one the allocation uses; the context state, for one, is the board's layout that the pair allocates.
  • The second-pair routing (commit 3) marks the slot that takes a queue's large renders. The mark was a second per-slot array beside owners that could outlive the owner (dj's review). Every owner change now goes through one State::set_owner(), which drops the mark when the slot changes hands, so no reassignment site has to remember it.
  • What it gives. Every M5 pair, on any board, is bounded by the same objects it maps. A part with one pair per queue sees no change from commit 3.

Change

Three commits in drivers/gpu/drm/asahi/g17:

  1. SUBMIT refuses, with ENOMEM and before anything is allocated, a layout whose pair cannot fit the 4 GiB window, counting every object a pair maps there (buffer::compact). A pair also checks for room before it allocates a target object, parameter blocks or the mesh storage (ENOSPC).
  2. Those objects are admitted against the client's and the device's memory limits and counted as the client's memory.
  3. A render runs on both of its queue's pairs only when the window holds its layout twice, otherwise on one pair, always the same one, as long as the queue holds that slot.

Which parts it affects: the M5 render path (the G17 parts whose firmware uses the compact window), selected by the existing M5 firmware path in the driver. This series adds no chip, board or firmware condition of its own. The window size is the firmware interface's (32-bit offsets), not a tuned value. Commit 3 only matters where a queue holds two pairs, today the M5 Ultra; every other G17 part holds one pair per queue and is unchanged. No new parameter or default.

Testing

J775D row on the PR's own base: kit m5-render-pair-memory-r5-1 is integration/aurora at 3710668 plus #1973 (the J775D GPU node, which the board needs to run the GPU at all) plus these three commits; baseline kit m5-render-pair-memory-r5-1b is the same without them. One boot of each, back to back, 27.0 firmware through the default stub, Aura main dff1235d8bac (the published image the boot tools pick by default), default command line. Borealis, single-sample R8, one draw per pass, all four corners read back:

Pass Baseline With the series Client fdinfo peak
16384x16384x15 correct (349 ms) not run
512x512x2048 EBUSY after 26.7 s, lost device correct (153 ms); also two in flight 2982 MiB
16384x16384x22 not run correct (388 ms) 8402 MiB
16384x16384x21, more than four primitives not run correct (368 ms) 9562 MiB
16384x16384x22 and x23, more than four primitives not run ENOMEM at SUBMIT
16384x16384x54 not run ENOMEM at SUBMIT
16384x16384x16 and x17, two in flight not run correct 12547 / 11195 MiB

With the series, each refusal logs two kernel lines ("refused a submission at preparing the command: ENOMEM" and the ioctl's "submit failed! ... err: ENOMEM"); the client sees VK_ERROR_OUT_OF_DEVICE_MEMORY from vkQueueSubmit and goes on, the next pass runs, and the boot ends with 0 lost devices, recoveries, faults or timeouts. The target objects are the client's memory: the device's kernel-resident memory stays at 33-34 MiB through the passes, where the baseline's failing 512x512x2048 left 2288 MiB of kernel memory. Render CTS subset: 571 Pass and 57 NotSupported of 628, 0 Fail, on both kits. Failed units (iwd, systemd-networkd-persistent-storage) and the 8 kernel error lines (display, HID, USB enumeration, cpufreq boost) are the same on both kits: 0 new. ALARM has no SELinux, so there is no AVC count.

KUnit (on the branch's base, 2c35f50): 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.

Extra evidence, not this PR's own row, both on the previous head (before the context-state change below, which leaves the J775D's sizes as they were): kit m5-render-pair-memory-r4-1, on integration/aurora 17075e3 with #1973, 27.0 firmware, gave the same results as the table, and kit pr2501j2, on integration/aurora cacf355 with #1650, #1973 and two local commits for the 26B123 firmware, 27.2 firmware, ran the same nine passes with the same results (16384x16384x22 in 345 ms, ENOMEM at x22 and x23 with more than four primitives and at x54) and the same CTS subset result.

Since dj's review: the compact-window objects are described once, and the task-stage mesh storage is counted (commit 1). The bound takes each pair's context state from the board's layout, the size the pair allocates, where it had worked it out a second way from the cluster count (commit 1); on the J775D both give the same size, and on a board whose context store has fewer clusters than the part the bound had counted more than the pair allocates. The one-pair mark is dropped by the one function that changes a slot's owner (commit 3). Commit 2 is rebased onto the new commit 1: its two room checks now use commit 1's PairObject. KUnit adds a case for each: a slot lost and claimed back, or given to another queue and claimed back, does not take the large renders from the pair that holds the layout (both cases fail on the previous head), and the mesh storage at the window's 4 GiB and 2 GiB edges. The only change in what SUBMIT admits: a 16384x16384 pass with more than four primitives at 32x32 tiles now fits up to 21 layers (it was 22), and the row above shows that edge.

Still to run

  • The M5, M5 Pro and M5 Max take commits 1 and 2 and were not run; rows from RyanTheTide's lab or their owners welcome: 16384x16384x22 and 512x512x2048 rendered with correct readback, a pass over 4 GiB returning ENOMEM without a lost device, the render CTS subset, 0 failed units and 0 new kernel errors.
  • A pass with a task stage near the window's edge on the J775D. Borealis there does not expose VK_EXT_mesh_shader yet, so no client binds the mesh storage today. The two KUnit edge cases cover the bound.
  • A follow-up offered to dj, not in this series: the M5 pool's capacity grouping in fw/m5/pool.rs repeats the parameter block size as 33 * 0x80000; it could take BlockGeometry::M5_BLOCK_BYTES.
Full description of the three commits
  1. Refuse layouts that do not fit. Deriving the layout (which SUBMIT does for every M5 render) returns ENOMEM when one pair's objects do not fit the 4 GiB window. Those objects are the records, TPC object and initial parameter blocks the layout sizes, and about 3.8 MiB of per-pair objects it does not size (context state, scene scratch, discard, page list, metrics). While the task-stage binding is enabled, they also include the 32 MiB of mesh storage a pair maps on its first task-stage kick and keeps. Guard pages and placement alignment are counted too. Each object is one PairObject: its mapping, its room check and the bound all use the same description. A layout accepted at SUBMIT can therefore run on one pair. Before allocating a target object, parameter blocks or the mesh storage, a pair also checks that the window has room for them, and returns ENOSPC otherwise, as the mapping would.
    • The bound depends on the pass's tile size and on whether it is marked as drawing few primitives. On the M5 Ultra, for a single-sample pass with 32x32 tiles (what Borealis uses for such a pass), it admits a 16384x16384 target of up to 21 layers with more than four primitives and up to 53 layers with four or fewer, and 2048 layers of a target up to 1024x1024 (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 and the mesh storage at the edge.
  2. Account the memory to the client. The target records, TPC object, initial parameter blocks and each growth are admitted against the client's and the device's memory limits, as the M5 pool backing already is. They are then counted as the client's memory until freed. A refusal fails that render, or declines that growth.
  3. Run a pass on one render pair when the window holds it only once (M5 Ultra). A render queue there may hold two render pairs, each with its own copy of the layout's objects in the same window. For a pass over about half the window (any 2048-layer target, for example), the second pair did not fit, the render waited for room its own first pair held, and failed with EBUSY after about 26 seconds. Each render now gets a pair count: both pairs for a layout the window holds twice, one otherwise. Admission keeps such renders on the one slot that took the queue's previous such render. The mark is dropped by the one function that changes a slot's owner, so a slot that leaves the queue comes back unmarked. A later render is therefore never placed on a pair that cannot be built. Smaller renders of the same queue still use both pairs.

Other G17 parts are unchanged.

Full test results

Own-base row (kit m5-render-pair-memory-r5-1, the boot above). The committed memory is the device's gpu_memory user total, read before the pass and about 3 s after the client exits (the sampler's eleventh reading):

Pass Run Client fdinfo peak Committed before / after
16384x16384x22 correct, 388 ms 8402 MiB 1539 / 1747 MiB
512x512x2048 correct, 153 ms 2982 MiB 1539 / 1747 MiB
512x512x2048, two in flight correct, 189 ms 3494 MiB 1539 / 1747 MiB
16384x16384x21, more than four primitives correct, 368 ms 9562 MiB 1547 / 1755 MiB
16384x16384x17, two in flight correct, 463 ms 11195 MiB 1547 / 1755 MiB
16384x16384x16, two in flight correct, 474 ms 12547 MiB 1547 / 1755 MiB
16384x16384x54 ENOMEM, 547 ms 14371 MiB (the image) 1547 / 1755 MiB
16384x16384x22, more than four primitives ENOMEM, 281 ms 6180 MiB 1555 / 1763 MiB
16384x16384x23, more than four primitives ENOMEM, 306 ms 6436 MiB 1555 / 1763 MiB
  • The 208 MiB after each exit is a deferred release that predates this series. Each Vulkan client that completes leaves 208 MiB of user-committed memory that no open DRM file holds: the open clients' fdinfo totals (compositor, Xwayland, shell) add up to the level before the pass at each of the three samples taken after the exit. After each exit gpu_memory was read 50 times, 0.1 s apart plus the time of the client scans at the first, eleventh and last reading (the eleventh reading is at least 3.2 s after the exit). On the baseline kit's completing pass the 208 MiB is released 3.2 s after the exit; with the series it is still held at the end of that sampling and released before the next pass. The baseline's first pass also started with about 210 MiB held by no open file, left by the client before it, so the unmodified driver already holds it from about 3 s to beyond the sampling. The amount is the same for every pass with the series, refused ones included, and for the baseline's completing pass; the baseline's lost-device pass left 312 MiB. Which object holds it was not traced.

Earlier rows, on the previous head (27.2 firmware, integration branch, Borealis, single-sample R8, one draw per pass, all four corners read back):

Pass Pair size Before the series With the series
16384x16384x15 1.9 GiB correct correct, on two pairs
512x512x2048 2.2 GiB EBUSY after 26 s, lost device correct; also two, three and four in flight
16384x16384x22 2.3 GiB EBUSY after 26 s correct
1152x1152x2048 3.1 GiB not run correct
2048x2048x2047 3.9 GiB EBUSY after 26 s correct
16384x16384x53 4.0 GiB not run correct
  • With the series but the queue's full pair count for every render, three 512x512x2048 renders in flight still failed with EBUSY after 26 s; with the per-render count they are correct.
  • Heavy 1080p rows at depth 8, same boot: fill 38.2 us and geometry 36.9 us per submit, the same as with the queue's full pair count for every render, and 7-10% less time per submit than on one pair (42.4 and 39.8 us).
Known limits
  • The window is shared by all of a client's render pairs. A layout that fits on its own can still find too little room beside the client's other pairs, on another queue or built for an earlier layout of the same queue; that render waits for room as before.
  • Borealis advertises 16384x16384x2048 framebuffers. On M5 the largest of these do not fit the window, before or after this change.
  • The other G17 parts still allocate their (capped) targets as kernel memory. The mesh storage, scratch, discard, page list and slot state of an M5 pair are still kernel memory: their sizes are fixed per pair rather than sized by the pass.

Thanks to ewb, who reported the uncapped M5 target sizes and suggested refusing and charging them, and to RyanTheTide and dj for the reviews.

  • Clean-room: no Apple code, strings, firmware, RE output or tuning values
  • No chip/board/firmware-version gate where a hardware property can decide
  • Works on the default kernel command line; no hacks, delays or lab-only paths
  • Safety limits come from the machine, not from constants in code
  • Hardware safety rules followed for every test boot
  • Third-party commits unchanged; reporters and testers credited
  • Commits: human Signed-off-by only; no co-author or Assisted-by trailers
  • Tested on the affected hardware; no regression

@funkzy
funkzy force-pushed the pr/m5-render-pair-memory branch from 9d1e69b to 48c5f89 Compare November 20, 2026 19:25
@funkzy funkzy changed the title drm/asahi: g17: M5: bound render target layouts by the compact window and account their memory to the client 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 Nov 20, 2026
@funkzy
funkzy force-pushed the pr/m5-render-pair-memory branch 2 times, most recently from 8a3871f to daa0d08 Compare November 21, 2026 06:20
@RyanTheTide

Copy link
Copy Markdown

No blockers.

I checked these and they read correct:

  • The SUBMIT-time bound (m5_layout()/pair_window_bytes(), drivers/gpu/drm/asahi/g17/queue/render/m5_render_submission.rs:135-217) uses checked arithmetic throughout and refuses a layout before anything is allocated.
  • check_m5_room() runs before each allocation in both the target and TVB paths.
  • KernelObject::client_backing() (g17/object.rs:118-134) releases its admission if the allocation fails, because Commit is RAII, and drops the charge with the object.
  • Admission (can_pick_render()/pick(), g17/queue/admission.rs:414-465) follows the same one-pair rule in the scheduler check and at pick time; usable() and join() agree.
  • The two-pair split only applies where self.pairs > 1, so other G17 parts are unchanged. No trailers to fix.

Two nits:

  1. pair_fixed_bytes() uses a bare 0x8000 for the discard object (m5_render_submission.rs:197), and the allocator uses its own literal for the same object (Compact::new(alloc, vm, 0x8000) in g17/queue/render/memory.rs:568). Name it once and use the constant in both places, so the SUBMIT bound cannot drift from what a pair actually maps.
  2. render_pairs() (g17/runtime/render/submit.rs:43-54) derives the whole layout again on every call, and a packet goes through it up to four times (submit.rs:106, 209, 431, 594, plus ensure_render). Compute the window bytes once at SUBMIT, where layout_and_window() already runs, and keep them on the packet.

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)

@funkzy
funkzy force-pushed the pr/m5-render-pair-memory branch from daa0d08 to 5d6427e Compare November 21, 2026 19:14
@funkzy

funkzy commented Nov 21, 2026

Copy link
Copy Markdown
Author

Thanks, Ryan. Both nits are fixed in the commits, now at 5d6427e, with no change in behaviour:

  1. Discard size named once. fw::m5::pool::DISCARD_BYTES is the discard object's size, and both the window bound (pair_fixed_bytes) and the pair that allocates it (Compact::new) use it. First commit; its message says so.
  2. Pair window computed once. SUBMIT computes the pair window bytes once, in prepare_command, and keeps them on the validated render command. render_pairs() reads them from the packet instead of deriving the layout again. Third commit.

I've added your Suggested-by to both. git range-diff against the current head: the first and third commits change only in those lines and their messages; the second is unchanged.

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):

  • 16384x16384x22 and 512x512x2048 (also two in flight): correct readback in all four corners.
  • 16384x16384x54, and x23 with more than four primitives: SUBMIT returns ENOMEM, and the same client then renders and dispatches correctly, with no lost device.
  • fdinfo grows during each pass (8201 MiB at 16384x16384x22, 2984 MiB at 512x512x2048, image included), and the device's committed memory is back to its starting value within seconds of the client's exit.
  • Render CTS subset: 571 Pass, 57 NotSupported, the same as without the series.
  • KUnit: 366 of 368 pass (two skips, as on the base), including the pair-window and pair-count suites. Host tests: 427 of 427 on base and head.
  • Regression: 0 new failed units (iwd.service and systemd-networkd-persistent-storage.service fail on the read-only test root with and without the series) and 0 new kernel error lines apart from the intended ENOMEM refusals. ALARM has no SELinux, so there is no AVC count.

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.

@RyanTheTide

Copy link
Copy Markdown

Re-review of 5d6427e: No blockers.

  1. Discard object size duplicated (nit): resolved. fw::m5::pool::DISCARD_BYTES (drivers/gpu/drm/asahi/g17/fw/m5/pool.rs:58) is used by the window bound in m5_render_submission.rs and by Compact::new in g17/queue/render/memory.rs:568.
  2. Layout derived again on every render_pairs() call (nit): resolved. prepare_command (g17/runtime/backend.rs:201-218) stores the window bytes from layout_and_window() on Validated::Render::pair_window, and render_pairs() (g17/runtime/render/submit.rs:43-49) reads them. Dropping the pairs == 1 early return is fine: pairs::for_window returns the queue count when it is 1 (pairs.rs:56-61, covered by its KUnit case), and a render without an M5 plan keeps None, which also leaves the count unchanged, as before.

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)

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 human Reported-by/Suggested-by/Signed-off-by trailers only; PR body includes Assisted-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

  1. Stale State::wide[slot] can route a >2 GiB render onto the second pair and reproduce the 26 s ENOSPC/lost-device failure (drivers/gpu/drm/asahi/g17/queue/admission.rs):

    • self.wide[slot] is only written in State::pick() when pairs == 1 (self.wide[usize::from(slot)] = owner), and is never cleared when self.owners[slot] changes or is cleared (take_idle, claim_sibling, reassign_unused_spare, cancel_empty_slot), nor are other slots cleared when a new wide slot is assigned for owner.
    • Concrete failure path on a 2-pair queue (owner O):
      1. O picks slot 1 for a 1-pair render (pairs == 1) -> wide[1] = O.
      2. Slot 1 leaves O via cancel_empty_slot(1, O) (failed/cancelled build before publication) or reassign_unused_spare(1, Some(O), ...) -> owners[1] becomes 0 or another owner, while wide[1] remains O.
      3. O's next >2 GiB render takes slot 2 -> owners[2] = O, wide[2] = O, and slot 2 builds and maps the >2 GiB target in the 4 GiB compact window.
      4. O runs a small render (pairs == 2) and claim_sibling claims slot 1 back for O. Now owners[1] == O, owners[2] == O, and both wide[1] == O and wide[2] == O.
      5. 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 (slot 1) instead of slot 2. Slot 1 then tries to map a second >2 GiB pair beside slot 2's live >2 GiB pair in the 4 GiB compact window -> ENOSPC -> 26 s timeout / lost device.
    • Fix: Clear self.wide[slot] = 0 whenever self.owners[slot] is reassigned or cleared (take_idle, claim_sibling, reassign_unused_spare, cancel_empty_slot), and clear any prior wide[other] == owner when recording self.wide[slot] = owner. Add a KUnit case covering slot loss + sibling reacquire with a live wide slot at a higher index.
  2. pair_window_bytes() omits task-stage mesh_storage (32 MiB default) mapped in M5_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) maps m5_mesh_storage_chunks * 64 KiB (default 0x200 chunks = 32 MiB, plus 16 KiB guard rounded to 64 KiB alignment) into BlockGeometry::M5_COMPACT via Compact::new_aligned().
    • pair_window_bytes() does not account for this reservation when resources.as_deref().is_some_and(|p| p.uses_task()) and m5_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 with ENOMEM, and a pass in (2 GiB - 32 MiB, 2 GiB] gets for_window() == 2 even though two pairs plus mesh storage exceed the 4 GiB compact window.
    • Fix: Include the aligned mesh_storage compact-window reservation (when uses_task() and m5_mesh_storage_chunks != 0, using a shared helper/constant with Memory::mesh_storage_register) in pair_window_bytes() and add a KUnit check.

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 RAII Commit rolls back admission on allocation failure.
  • Object::new (buffer/target.rs) and Tvb::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_BYTES deduplication and SUBMIT-time Validated::Render::pair_window caching 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, 512x512x2048 readback, over-4 GiB ENOMEM with no lost device, fdinfo growth/release, render CTS subset, 0 failed units, 0 new kernel errors beyond the intended ENOMEM).

@funkzy
funkzy force-pushed the pr/m5-render-pair-memory branch from 5d6427e to 45ccd86 Compare November 22, 2026 18:52
@funkzy

funkzy commented Nov 22, 2026 •

Copy link
Copy Markdown
Author

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 PairObject its two room checks now use); git range-diff --creation-factor=95 5d6427e7cba7...45ccd865d466 shows them.

1. Stale wide[slot]. Confirmed: the mark was set in pick() only and never cleared when owners[slot] changed. Your path is reachable; the spare reassignment (reassign_unused_spare taking the marked slot while the owner keeps its other one) gets there in fewer steps than the cancelled build. Instead of clearing wide in each place that reassigns a slot, every owner change in the driver now goes through one State::set_owner(), which drops the mark when the slot changes hands (take_idle, claim_sibling, reassign_unused_spare, cancel_empty_slot and the processor-stop release). wide is a bitmask beside held and killed, and mark_wide() clears the owner's other slots, so an owner has at most one marked slot. pick() also stops repeating the lookup inline and calls wide(). I first had owners as a small type that only set() could write, but the host tests' admission fixtures build State from its methods and write owners directly in their setup, so it stays a plain array with one writer; the fixtures take the new helpers (set_owner, wide, mark_wide) and all their mutants are still killed. KUnit: a_slot_lost_and_claimed_back_drops_its_one_pair_mark (your path: cancelled build, another queue takes the slot, the large render builds at a higher slot, the slot is claimed back as a sibling) and a_slot_given_to_another_owner_drops_its_one_pair_mark (the spare path). Both fail on the old head and pass now.

2. Mesh storage missing from pair_window_bytes(). Confirmed: 32 MiB plus guard at 64 KiB alignment in the same window. One difference from the suggested fix: counting it only when the pass uses_task() is not enough. A pair maps the storage on its first task-stage kick and keeps it, so a later pass without a task stage, landing on that pair near the edge, would still run out of room after SUBMIT accepted it. It is counted in every pair while the binding is enabled (m5_mesh_storage_chunks != 0, the same condition that advertises TASK_MESH_STORAGE). The cost is one layer at one edge: a 16384x16384 pass with more than four primitives at 32x32 tiles now fits up to 21 layers (it was 22). The commit message and KUnit say so.

On the structure: every object a pair maps in the compact window is now one buffer::compact::PairObject (records, TPC, parameter block, slot state, scratch, discard, page list, metrics, mesh storage), with its alignment and guard. Every mapping goes through PairObject::map()/map_at()/placement(), and every room check through check_room(). pair_window_bytes() sums the same list (PairSizes, an exhaustive match per object), so a new object cannot be mapped there without a size in the bound. Looking for other copies turned up two more:

  • The bound counted a 32 KiB "pool page list" that is not in the compact window (it is aliased at its kernel address). It is gone.
  • The J813's fixed-address metrics mapping bypassed the shared placement. It now goes through map_at().

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 mesh_storage_counts_at_the_4_gib_edge (16384x16384x22 with more than four primitives fits without the storage, ENOMEM with it) and mesh_storage_counts_at_the_2_gib_edge (16384x16384x17 with few primitives runs on two pairs without it, on one with it).

Same structure, not changed here: the other per-slot arrays in admission::State (epochs, the released and killed bits) are still reset by hand at each owner change. Moving their resets into set_owner() would change behaviour on every G17 part, so I've left it as a follow-up for you to decide on. One more, in your fw/m5/pool.rs: the capacity grouping repeats the parameter block size as 33 * 0x80000, which could take BlockGeometry::M5_BLOCK_BYTES; I've left your file alone.

J775D row, on the PR's own base this time: kit m5-render-pair-memory-r5-1 is integration/aurora at 3710668 plus #1973 (the J775D GPU node) plus these three commits, and baseline kit m5-render-pair-memory-r5-1b the same without them, one boot each, back to back, 27.0 firmware, default command line:

  • Baseline: 16384x16384x15 renders; 512x512x2048 fails with EBUSY after 26.7 s and a lost device.
  • With the series: 16384x16384x22 and 512x512x2048 render correctly (all four corners read back), the latter also with two in flight. With more than four primitives, 16384x16384x21 renders and x22 and x23 get ENOMEM at SUBMIT, which is the edge that moved by one layer; 16384x16384x54 gets ENOMEM too. Each refusal leaves the device working: the next pass runs, with 0 lost devices, recoveries, faults or timeouts over the boot. 16384x16384x16 and x17 with two in flight (the 2 GiB edge) render correctly.
  • fdinfo grows during each pass (8402 MiB at 16384x16384x22), and kernel-resident memory stays at 33-34 MiB, where the baseline's failing pass left 2288 MiB.
  • Render CTS subset: 571 Pass, 57 NotSupported, 0 Fail on both kits; the same two unrelated failed units and the same 8 kernel error lines on both.
  • Every client that completes leaves 208 MiB of user-committed memory that no open DRM file holds, released some seconds later (3.2 s after the exit on the baseline kit's completing pass; with the series, after the sampling ended but before the next pass). The baseline's completing pass shows the same 208 MiB, so that deferred release predates this series; its lost-device pass left 312 MiB. Which object holds it was not traced.
  • A pass with a task stage could not be run: Borealis on the J775D does not expose VK_EXT_mesh_shader yet. The two KUnit edge cases cover it.

The rows on the previous head (kit m5-render-pair-memory-r4-1 on 17075e3 with #1973, and the 27.2 kit pr2501j2 on cacf355 with #1650, #1973 and two local 26B123 commits) gave the same results and stay in the body as extra evidence.

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)

@RyanTheTide

Copy link
Copy Markdown

Re-review of 45ccd86: no blockers.

  • Stale one-pair mark: fixed. State::set_owner() (drivers/gpu/drm/asahi/g17/queue/admission.rs:170) is now the only writer of owners and drops the slot's mark when the owner changes. Every reassignment site goes through it. mark_wide() keeps one mark per owner, and pick() and can_pick_render() share wide(). Both new KUnit cases follow the reported path and the spare path to the intended slot.
  • Mesh storage in the bound: fixed. It is counted in every pair while the binding is enabled. A pair keeps the storage after its first task-stage kick, and SUBMIT cannot know which pair a render lands on, so this is the right condition. The 22 to 21 layer edge is in the commit message and KUnit.
  • buffer::compact::PairObject gives the same alignment and guard as the old call sites for every object. Each mapping and room check now goes through it, and the bound sums the same list. Dropping the pool page list from the bound is correct, since it is aliased outside the compact window. The context state now comes from the same Layout::m5(board) that Generation::allocate_state uses.
  • Earlier nits stay resolved (DISCARD_BYTES, pair_window cached at SUBMIT).
  • The admission, resource and quarantine-drain host tests pass at this head.

HW row: please give the kernel commit IDs that the m5-render-pair-memory-r5-1 kit ran, so the J775D row is tied to 45ccd86. Still missing: an M5, M5 Pro or M5 Max (one pair per queue, commits 1 and 2) on this head. The cases are 16384x16384x21 and x22 with more than four primitives (render, then ENOMEM), 512x512x2048 with correct readback, and a pass over 4 GiB returning ENOMEM without a lost device. Also needed: fdinfo growing during the pass and returning after, the render CTS subset unchanged, 0 failed units, and no new kernel errors besides the intended ENOMEM lines.

Assisted-by: LLM (Claude:Opus 5.5)

@funkzy

funkzy commented Nov 22, 2026

Copy link
Copy Markdown
Author

Thanks. Kit m5-render-pair-memory-r5-1 is integration/aurora 3710668 with these applied in order, nothing else:

Its baseline m5-render-pair-memory-r5-1b is the same without this PR's three commits. The booted kernel reports 7.3.0-m5u-m5-render-pair-memory-r5-1-g371066885814-dirty: the version string names the base, and -dirty is the six commits applied as patches on top of it.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown

Thanks, that pins the J775D kit to its trees: integration/aurora 3710668 plus #1973 and this PR's three commits, against the same tree without them. That closes the commit-ID point. Approval stands.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown

Review notes (non-author):

  • The new charge uses Charge::user(commit, None), so the target/TPC/parameter-buffer backing is counted against the limits but attributed to no mm (RSS, OOM score) and, as it is built on the scheduler path, probably not to the submitter's memcg. Please attach the submitting client's mm, as the user-object path does.
  • On M4 Pro / A18 Pro the capped targets and the tiler block are still uncharged kernel objects; please charge them the same way (or say in the body that this follows separately).
  • Please add a KUnit case for the charge itself: taken on allocation, released on drop, refused at the client limit.
  • The pass size and MiB figure in the second commit message describe the base behaviour in more detail than the change needs; a shorter description would do.

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Stale State::wide mark (drivers/gpu/drm/asahi/g17/queue/admission.rs): Fixed — State::wide is now a u64 bitmask cleared on every owner change through the sole owner mutator State::set_owner(), mark_wide() clears any prior slot for the same owner before setting the new one, pick() and can_pick_render() share wide(), and both reported loss/reclaim and reassignment paths are covered by new KUnit tests.
  2. Omitted mesh_storage in compact-window bound (drivers/gpu/drm/asahi/g17/buffer/compact.rs, m5_render_submission.rs): Fixed — buffer::compact::PairObject (with compile-time ALL exhaustiveness check) now unifies alignment, guard, mapping, placement, room checks, and PairSizes::window_bytes(), including MeshStorage and SlotState (from Layout::m5(board)), with KUnit tests at both the 4 GiB and 2 GiB edges.
  3. J775D hardware kit provenance: Pinned to exact commits (integration/aurora 371066885814 + #1973 + #2501 at 45ccd865d466 vs 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 human Reported-by/Suggested-by/Fixes/Signed-off-by trailers only; PR body includes Assisted-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):

  • 16384x16384x21 and x22 with >4 primitives (renders, then ENOMEM at SUBMIT without lost device);
  • 512x512x2048 with verified readback;
  • a pass >4 GiB returning ENOMEM cleanly without lost device;
  • fdinfo client memory rising during the pass and releasing afterward;
  • render CTS subset unchanged, 0 failed units, and 0 new kernel errors beyond the expected ENOMEM refusals.

Non-Blocking Notes

  • KernelObject::client_backing() using Charge::user(commit, None) matches existing g17/freelist.rs:403 (shared mm/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 #2520 in drivers/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 <erik@ebourget.net>
Suggested-by: Erik Bourget <erik@ebourget.net>
Suggested-by: Ryan Murray <ryan@aurorasilicon.org>
Suggested-by: DjDeveloperr <hey@djdev.me>
Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
…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 <erik@ebourget.net>
Suggested-by: Erik Bourget <erik@ebourget.net>
Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
…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 <ryan@aurorasilicon.org>
Suggested-by: DjDeveloperr <hey@djdev.me>
Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
@funkzy
funkzy force-pushed the pr/m5-render-pair-memory branch from 45ccd86 to 4fd2974 Compare November 23, 2026 23:56
@funkzy

funkzy commented Nov 23, 2026

Copy link
Copy Markdown
Author

Rebased onto integration/aurora (c91527272e90, including #1973, #2520, and #1902) at 4fd2974238b1 (e87e13858b5d, f58724566915, 4fd2974238b1).

Only change from 45ccd865d466 is resolving the textual conflict with #2520 in drivers/gpu/drm/asahi/g17/queue/render.rs (prepare_bind() keeps self.board in m5_render_submission::layout() ahead of #2520's cross-VM clear_render_ring() block; range-diff also shows adjacent #1902 host_growth_target() context). Commits 2 and 3 are unchanged (git range-diff matches).

Re-verified on the rebased head:

  • KUnit (built-in drm/asahi suites): 80 suites; 404/406 pass, 0 fail, 2 skip (apple_g17_rx_util_min_test needs CONFIG_UCLAMP_TASK, j713_accepts_all_loaded_images skipped).
  • Host tests (tools/asahi/g17-admission-order-tests.py, g17-quarantine-drain-tests.py, g17-resource-tests.py): all pass.

Still holding for the 1-pair-per-queue M5 / M5 Pro / M5 Max hardware row before merge; mm/RSS attribution for scheduler-allocated client objects, charging capped G17P targets, and a KUnit charge-refusal test remain follow-ups as noted.

Assisted-by: LLM (Claude:Opus 5.5, Gemini:Neon)

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 from 45ccd865d466 resolved a conflict in touched file drivers/gpu/drm/asahi/g17/queue/render.rs) and the pending 1-pair-per-queue M5 / M5 Pro / M5 Max row at 4fd2974238b1 covering commits 1–2 (16384x16384x21 render and x22 ENOMEM with >4 primitives, 512x512x2048 readback, >4 GiB ENOMEM without lost device, fdinfo rise/release, render CTS subset unchanged, 0 failed units, 0 new kernel errors beyond expected ENOMEM).

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 into M5_COMPACT (Records, Tpc, ParameterBlock, SlotState, Scratch, Discard, PageList, Metrics, MeshStorage) routes through PairObject, with compile-time PairObject::ALL exhaustiveness checking, checked arithmetic throughout, Layout::m5(board) for per-slot state sizing (DEPTH = 32), DISCARD_BYTES shared with fw/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 via LEDGER.admit() before allocating new_kernel_object_wc_user_charged() (RAII Commit rolls back on failure), holds Charge as the final struct field so GPU unmap and GEM teardown precede charge release, and leaves BlockGeometry::NEO and 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 caches pair_window once on Validated::Render; pairs::for_window() only narrows when queue > 1 and two copies exceed the 4 GiB window; State::set_owner() is the sole writer of owners and clears the wide bit on owner transitions; can_pick_render() and pick() share wide() and safely wait out Plan::Pair(other) when hazard::plan requires barrier room.
  • Rebase & main compatibility: prepare_bind() in drivers/gpu/drm/asahi/g17/queue/render.rs cleanly preserves self.board ahead of #2520's cross-VM clear_render_ring() and #1902's host_growth_target(). Verified no conflict or symbol clash with #2433 on main (Generation::retire removal in generation.rs is 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, 4fd2974238b1 are clean (human author/committer Jeff 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 head 45ccd865d466 before the conflicting rebase in queue/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 (all Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>).
  • CI at 4fd2974238b1: host-tests (Host tests) — SUCCESS.

Non-Blocking Follow-Ups

  • Attaching submitting client mm/RSS attribution to KernelObject::client_backing() (matching g17/freelist.rs), charging capped NEO/G17P targets, and adding a KUnit charge-refusal test remain fine as separate follow-ups.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@DjDeveloperr
DjDeveloperr dismissed stale reviews from themself November 24, 2026 19:01

Superseded by the review at 4fd2974

@github-actions github-actions Bot removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown

Merge readiness at 4fd29742: not ready yet

Check Detail
CI at head ok 1 check passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head no no line with the head SHA 4fd29742, a Mac and a result in the PR body or a comment
Conflicts no merge conflicts with main: merge it in (no force push)
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants