Skip to content

drm/asahi: g17: prune a queue's frontier from the front - #2732

Merged
RyanTheTide merged 6 commits into
aurora-silicon:mainfrom
jgoyvaerts:m4pro/g17-frontier-prune
Nov 26, 2026
Merged

RyanTheTide merged 6 commits into
aurora-silicon:mainfrom
jgoyvaerts:m4pro/g17-frontier-prune

Conversation

@jgoyvaerts

@jgoyvaerts jgoyvaerts commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What: Prune a G17 queue's frontier from the front, bound how long a finished entry waits in it, and index its host publishers. Submitting N queued commands is no longer O(N²), and failures stay exact. Stacked on #2719.
Tested: J616s M4 Pro at c139054 (all four commits, including the publisher-failure fix, as carried in our m4.186 kernel): the submit thread's ASAHI_SUBMIT samples are 354 (1724 before this PR, the prune's about 1204 of them) on a 65,536-entry frontier; d3d12 list (544) and dEQP-VK query_pool/timestamp 0 differences against the same Mesa build; 0 failed units, 0 new kernel errors, 0 GPU recoveries. Our kernels load no SELinux/AppArmor. At 9cc1c8a (main efed1ae merged): KUnit 806/807 (1 skip); J616s M4 Pro in our m4.190 kernel (main 8c6bd8d + #2504 + this PR + #2228): the test passes at a 65,536-entry frontier, d3d12 list and query_pool/timestamp 0 differences, 0 OOM kills, 0 GPU recoveries in the run. At aabe211 (main f7b890d merged, see the merge comment): KUnit (arm64 qemu) 824 tests, 823 pass, 1 skip; host suite, every g17 and asahi job passes; no hardware run at this head yet.
Risk: two-way door · M4, M4 Pro, M4 Max and M5 (shared G17 queue code)
Not yet: a J616s row at aabe211; the publisher-failure race itself is covered by KUnit only (it needs a failure signalled while a prune runs); M4, M4 Max and M5 rows

Details

Stacked on #2719 (its commit is the first one here). The second, third and fourth commits are new: "drm/asahi: g17: prune a queue's frontier from the front", "drm/asahi: g17: bound how long a finished command waits in the frontier" and "drm/asahi: g17: index each frontier's host-timestamp publishers".

Every enqueue pruned its engine's frontier with a full retain(). That read the completion status of every unfinished command. The kernel's Vec::retain() also swaps each kept entry in place, which is three 48-byte memcpy() calls per entry. A frontier holds every unfinished command, thousands under vkd3d-proton, so submitting N queued commands cost O(N^2).

Profile on a J616s (M4 Pro), unfixed kernel: vkd3d-proton's test_resolve_image_exhaustive_descriptors (64 x 1024 resolves), cpu-clock at 1999 Hz. Of the 1724 samples the submit thread spent in ASAHI_SUBMIT:

Where Samples
memcpy from retain()'s swaps in prune_frontier 858
prune_frontier itself + fence status reads ~330
everything else ~540

That is about 70% of the ioctl, roughly 0.6 s of CPU per run.

The change

  • Prune from the front. Commands mostly finish in order, so a prune takes finished entries from the front and stops at the first unfinished one. It now costs what it removes. When the room runs out, reserve() moves the held entries down into the gap in front once it is at least half their number. That is at most two moves per entry that left, and a steady deep queue never doubles its room. Growth happens only when more than two thirds of the room is held, so the room stays under 3x the deepest the queue got. The new g17/queue/outstanding.rs holds this, generic over the entry so KUnit can test it.
  • Successes behind an unfinished command. A success that finishes behind an older unfinished command stays until it reaches the front. Most readers already skip finished entries by their status: the input-source check and the other-engine dependency loop. The two that relied on a just-pruned frontier, host_predecessors and the compute timestamp waits, now check status too. All readers therefore see the same set as before, up to the race a concurrent signal always had. The input-source check walks only the prefixes it covers (.prefix()), and the room for other-engine dependencies is sized by the unfinished entries alone.
  • Failures stay exact. Later commands whose prefix covers a failure must be cancelled from the next prune on, so a failure can't wait for the front. A same-engine command without inputs or timestamps has no other frontier reader that would see it.
    • Output::publish is the only place that sets an error on or signals these fences. A failing one now goes through VmStatus::signal_failure(), which counts it as started before the error is set and as finished after signal().
    • A prune reads finished, then started, and scans the whole frontier, as before, while started differs from the finished count at its last full scan. A prune that comes while an error is being signalled therefore scans in full, and so does every prune after it until one has run after the failure finished. Failures are rare, so full scans are too. A VM whose commands fail continuously costs what it costs today.
  • Release timing. Entries move into finished instead of being cloned, so they're still released after the ioctl publishes.
  • Bounded wait (third commit). A finished command waiting behind an unfinished one still holds its Completion. For a compute command that includes its 16 KiB timestamp page, which used to go back to the cache at the next prune. One compute ring finishes in order (completion is "stamp covers kick"), but the completion-record fallback, a change of ring and recovery replay are not shown to keep that order, and render spreads over pairs. So a full scan also runs once there have been as many prunes as the last full scan left entries. The target is fixed at each scan, because with a stuck front the length grows by one per prune too and a moving target would never be reached (found on m4.179, see the comments). That's at most two more status reads per prune, amortized, and nothing finished waits longer than one queue length of submissions.
  • Publisher index (fourth commit). host_predecessors, the compute timestamp waits and the input-source check only look for host-timestamp publishers, but walked every unfinished command of their prefix to find them on every enqueue. On m4.179, with the test running 65,536 commands deep, that walk was 1366 of the 1854 submit samples. Each engine now keeps its publishers in a second, pruned list as well, and those readers walk it. Since main's 086a909 a command can also have an ordered publication without timestamps (it chains behind a predecessor's), so the index holds every entry with a publication or with ready == completed (Fences::publishes()): every same-engine entry EnqueueOrdering::build(), has_pending_publication() and the input-source check look for.
Evidence

Testing

  • KUnit (arm64 qemu, asahi + SEP + ISP config): 747 tests, 746 pass, 1 skip.
  • 9 new asahi_g17_outstanding cases:
    • finished commands leave from the front in order;
    • a success behind an unfinished command waits for the front, and leaves within one queue length, also with a stuck front and a new command at every prune;
    • a failure behind one leaves at the first prune that sees the count move;
    • a failure whose error is visible but not yet counted as finished is still found, and prunes stay full until it is;
    • a moved count scans the whole list;
    • prefixes;
    • a 1100-deep steady queue over 9900 prunes reads at most three statuses per prune, amortized, and its room never grows. The old rule doubled it to 4096 at depths 1026 to 1365.
  • tools/asahi/run-host-tests.py --only g17: 90/90. The quarantine-drain stub takes the new status argument.
  • checkpatch: 0 errors. The only warning is MAINTAINERS for the new file; drivers/gpu/drm/asahi/ has no entry of its own.

On hardware (J616s, our m4.179 kernel, first three commits)

  • The prune is gone from the profile: about 1204 of 1724 submit samples on m4.177, 6 on m4.179.
  • The test now passes, at up to 65,536 frontier entries.
  • No regressions: the d3d12 list (544 tests) against the same Mesa on m4.177, two tests improved; dEQP-VK query_pool/timestamp (1999 cases) 0 differences; 0 GPU recoveries.
  • The new bottleneck at that depth was the publisher walk, which commit 4 removes. Details and the table are in the PR comments.

On hardware (J616s, our m4.182 kernel, all four commits)

  • Submit-thread samples in ASAHI_SUBMIT: 319, against 1854 on m4.179 and 1724 on m4.177.
  • Queue::submit's own code: 12, against 1366 on m4.179 and 165 on m4.177.
  • The frontier still reaches 65,536 entries.
  • No regressions against the same Mesa build on m4.179: d3d12 list 0 differ, dEQP-VK query_pool/timestamp 0 differ, 0 GPU recoveries.

Not done

  • Not tested on the M4, the M4 Max or the M5. The code is shared G17 queue code with no chip gate.
  • Not changed: a compute command still walks the unfinished render commands its prefix covers, because each one is a dependency it must wait for.

@RyanTheTide

Copy link
Copy Markdown
Contributor

The profile makes the case (70% of the ioctl in retain()'s swaps), and pruning from the front with the amortized compaction is the right fix. One ordering hole in the failure path:

A failure can be visible but not counted. Output::publish() does set_error(), then signal(), then note_failed_output(). A prune in between reads an unchanged count and does a front-only pass. The failed entry sits behind an unfinished command, so failure.note() never runs for it this time. Meanwhile the readers that "skip finished entries by status" treat its non-zero status as finished, so a dependent command enqueued in this ioctl is not cancelled. The old full retain() always caught a fence whose error was already visible. Only a signal that came after the prune was racy. So this adds a window, small (a few instructions in publish), but a real one.

Moving the count before signal() alone doesn't close it. A full scan between the count and the signal records the new count, still reads status 0, and later prunes then stay front-only until the entry reaches the front. A robust option: key the failure handling on what is observed, not only on the counter. Wherever a frontier reader (or the prune) sees a status < 0 on an entry the prune hasn't noted, treat it like a moved count (do the full scan / failure.note() now). The counter then stays a fast path, and correctness doesn't depend on the order of the two writes.

A KUnit case for it: an entry behind an unfinished one gets status < 0 with the count unchanged, and the next prune (or reader) must still record the failure.

Smaller: the MAINTAINERS checkpatch warning is fine to ignore. outstanding.rs being generic over the entry, with its own tests, is a nice touch.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Adversarial review of draft head 52054f130232026fbd6e6d4d4023c797bae6a67f against the pre-PR checklist. Holding approval and requesting changes on the concurrency, accounting, and draft-readiness items below.

Code findings

  1. Failure-visibility / counter ordering window in Output::publish() (completion.rs:205-215) — affects same-engine ordinary commands even if readers check status.
    Confirming and extending Ryan's finding: Output::publish() runs set_error() -> signal() -> note_failed_output(). If prune_frontier(index) runs between signal() and note_failed_output(), failed_outputs() is unchanged, Outstanding::prune() stops at an older unfinished command, and failure.note() is skipped.
    Crucially, for a same-engine ordinary command (e.g., compute with inputs.is_empty() and !query_access), no frontier reader in Queue::enqueue() walks self.frontiers[index] at all (sources requires !inputs.is_empty(), host_predecessors is render-only, frontier walks 1 - index, timestamps requires query_access). So even a reader-triggered fallback would still miss a failed same-engine predecessor retaining its VM pin and allow a dependent command to enqueue (and even publish inline via early = dependencies.is_empty()).
    A lock-free way to close the window for all callers without adding cost to the no-failure fast path is a two-counter (failed_started / failed_finished) bracket around set_error() + signal():

    • publish() on Err: failed_started.fetch_add(1, AcqRel) -> set_error() + signal() -> failed_finished.fetch_add(1, Release).
    • prune_frontier(): load finished = failed_finished(Acquire) then started = failed_started(Acquire) before scanning; run a full scan whenever started != self.failures || finished != self.failures, and only advance self.failures = finished.
      Then any prune during the window sees started != self.failures, forces a full scan, and keeps forcing full scans until the post-signal finished increment is observed. Please also add a KUnit test covering an in-flight failure bracket (started != finished).
  2. Outstanding::reserve() can double KVVec capacity to 4× steady-state depth before compaction triggers.
    In Outstanding::prune() (outstanding.rs:398), entries.drain(..self.head) only runs when self.head >= self.len(). If entries.len() == entries.capacity() with head = cap/2 - 1 and len = cap/2 + 1 (e.g., DEPTH = 1024, cap = 2048, head = 1023, held = 1025), prune() skips draining and the immediately following self.frontiers[index].reserve(1) in Queue::enqueue() reallocates entries to 4096 despite 1,023 dead None slots at the front. Note that a_deep_steady_queue_reads_a_few_entries_per_prune_and_stays_compact checks entries.len() <= 2 * DEPTH (with DEPTH = 1000), not entries.capacity(). Compacting in reserve() when entries.capacity() - entries.len() < additional and self.head is a non-trivial fraction (e.g., self.head >= self.len() / 2 and >= additional) avoids unnecessary vmalloc doublings while preserving amortized O(1).

  3. Carryover issues from #2719 (commit 1 in this branch, still open/draft).

    • Both Outstanding.entries (outstanding.rs:351) and Queue.finished (queue/mod.rs:198) still allocate with GFP_KERNEL instead of GFP_KERNEL_ACCOUNT, leaving an unbounded userspace-driven vmalloc backing uncharged to the caller's memcg (and neither entries nor finished ever shrinks capacity after a peak burst).
    • Queue::enqueue() (queue/mod.rs:230) still calls self.frontiers[index].reserve(1)? per command inside the submit loop rather than reserving the batch's per-engine count up front before the first command is enqueued, so an ENOMEM mid-batch still leaves a partial submission.
  4. Minor: sources check in Queue::enqueue() (queue/mod.rs:246-253) still walks full frontiers.
    frontiers[0].iter().all(...) and frontiers[1].iter().all(...) walk past order.wait_through instead of using .prefix(order.wait_through[...]) (which also avoids O(N) work when wait_through is None). Also note that frontiers[other].prefix(prefix).count() (queue/mod.rs:303) now includes finished entries sitting behind an unfinished front entry when sizing the physically contiguous KVecs (dependencies/checked_inputs/firmware).

Checklist & draft status

  • CI: host-tests passed on 52054f13.
  • Stacking: carries #2719's commit while #2719 is still open/draft.
  • Checklist §1–§4 & §6: Pass on code (no chip/board/firmware gates, no cmdline hacks, human-only Signed-off-by on all 3 commits). Minor attribution nit: PR body ends with Assisted-by: LLM (Claude:Opus 5.5) instead of Anthropic:Claude Opus 5.5.
  • Checklist §5 (why draft): Not yet booted on hardware; needs same-machine A/B profile + conformance unchanged + regression run (0 SELinux denials, 0 failed units, 0 new kernel errors) across affected G17 hardware before leaving draft.

@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Thanks @RyanTheTide and @DjDeveloperr. All three commits are amended and force-pushed (new head 7c3642c01890, on #2719's new 7b024be439a4).

1. The failure window. Both of you are right that it was real. I took Dj's bracket. Ryan's reader-side fallback can't close it, for the reason Dj gives: a same-engine command without inputs or query access has no frontier reader at all. One correction to the premise: the readers never treated an errored entry as finished. They skip only status() > 0, and an entry with status() < 0 still becomes a dependency or a checked input. The hole was in FailureRecord, so in cancellation.

  • Output::publish() now fails a fence through VmStatus::signal_failure(): started += 1, then set_error() + signal(), then finished += 1 (Release).
  • VmStatus::failures() reads finished, then started, both Acquire, so started >= finished in what a prune sees.
  • Outstanding::prune() scans in full while started != self.failures and then records only finished. An in-flight failure therefore keeps prunes full until a scan has run after it finished. Given that invariant, started != self.failures covers both conditions Dj listed.
  • The started increment is Relaxed: it is sequenced before the fence's signal, which is a release. So anyone who has seen the error before an ioctl also sees the count in that ioctl.
  • New KUnit case: started = 1, finished = 0, error not yet visible, then visible behind an unfinished command. The prune must still find it, and prunes go back to front-only only after the post-finish scan. It fails if self.failures is taken from started, which is the count-before-signal ordering Ryan showed is not enough.

2. Capacity. Compaction now happens in reserve(), and the prune-time compaction is gone. When the spare room is short, the held entries move down once the gap in front is at least half their number. That is at most two moves per entry that left, so it stays amortized O(1); a lower threshold would move nearly the whole queue for each slot freed. Growth now happens only when more than two thirds of the room is held, so the room stays under 3x the peak depth instead of 4x. The steady test now asserts that capacity() never changes. It runs at depth 1100: the old rule doubled the room from 2048 to 4096 at depths 1026 to 1365 (Dj's case is the first of those), and the new one keeps 2048.

3. #2719 carry-overs. Folded into #2719's commit, which is the first commit here: the whole-submission reserve before outputs.publish() and GFP_KERNEL_ACCOUNT for the frontier and finished. Neither one shrinks after a burst, on purpose. finished is cleared every ioctl and keeps its room like the other per-queue submit buffers. A frontier that had once been deep keeps its room until the queue closes, and that room is now charged to the caller's memory cgroup.

4. sources and sizing. The sources check uses .prefix(order.wait_through[i]) for both engines, so None costs nothing. The other-engine dependency vectors are sized by status() <= 0 entries only. Status only moves from 0 to non-zero, so that count is an upper bound on what the loop pushes.

KUnit: 733 tests, 731 pass, 1 skip (the 1 failure is isp_test_sensor_sysfs, as on the base), with 8 asahi_g17_outstanding cases. Host tests 90/90, checkpatch 0 errors on all three commits. Both PRs stay drafts until the same-machine A/B profile, conformance and regression run on our next test kernel. I've left the attribution line as it is; the owner decides that one.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-checked at 7c3642c0 (the two commits over #2719). The failure window is closed:

  • Output::publish() fails a fence inside VmStatus::signal_failure() (completion.rs:204-217, status.rs:99-116). failures() reads finished before started, and Outstanding::prune() stays on full scans while started != self.failures and records only finished (outstanding.rs:94-114). I traced the three interleavings: snapshot before the count, inside the bracket, after it. Each either scans in full or is the same concurrent-signal race the old retain() had. It is also complete. Output::publish() is the only place that sets an error on a per-command completion fence, and Fences::status() reads that fence (job.rs:540-546,594) through the locked dma_fence_get_status() (sync_scope.c:21-23), so the Relaxed started increment is ordered by the signal. You're right that a reader-side fallback would miss the same-engine case, and the KUnit shape I asked for can't occur under this invariant. The started/finished case at outstanding.rs:266-280 is the right test.
  • Front pruning looks right. entries[head..] stays all-held, so prefix()'s partition_point holds. Pruned entries move into finished and live to the end of the ioctl. Error entries are still dependencies in the other-engine loop and still block source conversion. A finished entry held behind the front keeps only memory, since release_healthy() has already dropped its VM pin.

Two small things:

  • Tests stop short of the fix itself. The KUnit cases drive Outstanding with a fake status and hand-fed Failures. Nothing exercises VmStatus::signal_failure()/failures(), which is where the ordering lives, or the reader changes in queue/mod.rs (:272 host_predecessors status filter, :299 dependency count, :313 pending_publisher). A short VmStatus case would pin the bracket: inside the closure failures() is { started: n + 1, finished: n }, and after it the counts are equal.
  • Optional: fetch_add(1, AcqRel) for started would make the "Relaxed because the signal releases it" reasoning unnecessary, and it runs once per failure.

Rows at 7c3642c0: on the J616s, the m4.177 reproduction with the before/after ASAHI_SUBMIT profile, CTS dEQP-VK.synchronization* timeline/semaphore groups, and a multi-hour d3d12 + dEQP soak. The same CTS group and a soak on an A18 Pro as well. Please also add one run where a command fails behind an unfinished one, showing that later commands whose prefix covers it complete with the error rather than running. That path has no hardware evidence yet. None of this has run on an M4 (T8132), which shares the code.

Assisted-by: LLM (Claude:Opus 5.5)

A logical queue keeps one frontier entry per command whose completion
has not signalled yet, and the pruned entries of the current ioctl in
`finished`. Both are KVecs, so they grow by krealloc() into physically
contiguous memory. The frontier is bounded only by how much work
userspace keeps queued: vkd3d-proton's
test_resolve_image_exhaustive_descriptors records 64 x 1024 resolves
in one command list, and the frontier reaches thousands of entries.

Growing it then needs an order-5 or order-6 block (512 KiB to 1 MiB
with 16K pages). On a fragmented machine (4.3 GB free, nothing above
order 4) the allocation fails. If it is `finished`, prune_frontier()
falls back and only warn_alloc() dumps a trace. If it is the frontier's
own reserve, the submit fails with ENOMEM after some of its commands
may already have been queued, so Mesa marks the queue lost and reports
VK_ERROR_DEVICE_LOST:

  vkd3d_queue: page allocation failure: order:6, mode:0x40cc0(GFP_KERNEL|__GFP_COMP)
  ...
   krealloc_node_align_noprof+0x154/0x238
   rust_helper_krealloc_node_align+0x10/0x20
   ..._asahi_core3g175queue...14prune_frontier...
  asahi 28a600000.gpu: [File 119992 Queue 1]: IOCTL: submit failed! (submission ID: 38521603 err: ENOMEM)

The same test reproduces it alone on a loaded machine (nothing free
above order 3): a perf probe on kmem:kmalloc shows the frontier's
reserve asking for 196608 bytes (2048 -> 4096 entries) and getting
NULL, and the submit fails with ENOMEM.

Nothing needs these arrays contiguous: only the ioctl reads them. Make
both KVVecs. kvrealloc() still tries kmalloc first, for a large size
without direct reclaim or a warning, and falls back to vmalloc. Small
frontiers keep their kmalloc memory, and a deep one no longer depends
on high-order pages.

Reserve the frontier room for a whole submission before its output
fences are published, instead of one entry per command as it is
queued, so that an allocation failure fails the submission cleanly
instead of half-way. Userspace decides how long the frontier gets, and
it can now grow past what contiguous pages ever allowed, so charge it
and `finished` to the caller's memory cgroup (GFP_KERNEL_ACCOUNT).

Fixes: 52ef95b ("drm/asahi: add the T8140 firmware interface")
Fixes: 39bdd5b ("drm/asahi: release pruned G17 frontier entries after the ioctl publishes")
Signed-off-by: Jonathan Goyvaerts <[email protected]>
Every enqueue pruned its engine's frontier with a full retain(): it
read the completion status of every unfinished command, and the
kernel's Vec::retain() swaps each kept entry in place, three 48-byte
memcpy() calls per entry. A frontier holds every unfinished command,
thousands under vkd3d-proton, so submitting N queued commands cost
O(N^2). In test_resolve_image_exhaustive_descriptors (64 x 1024
resolves) on an M4 Pro, prune_frontier() and its memcpy() took about
70% of the ASAHI_SUBMIT ioctl's kernel time, 0.6 s of CPU per run.

Commands mostly finish in order, so take finished entries from the
front and stop at the first unfinished one: a prune now costs what it
removes. When the room runs out, the held entries are moved down into
the gap left in front once it is at least half as large as they are,
so a move costs at most two per entry that left, and a steady deep
queue does not double its room. A success that finishes behind an
older unfinished command stays until it reaches the front. The readers
already skip finished entries by their status, except the two that
relied on a just-pruned frontier, host_predecessors and the compute
timestamp waits; they now check it too, so they see the same set. The
input-source check walks only the prefixes it covers, and the room for
other-engine dependencies is sized by the unfinished ones alone.

A failure cannot wait for the front: later commands whose prefix covers
it must be cancelled from the next prune on, and a same-engine command
without inputs or timestamps has no other reader that would see it.
So a public fence that fails is counted twice in its VM's status:
before its error is set and after it has signalled. A prune scans the
whole frontier, as before, while the first count is ahead of the second
one at its last full scan, so it keeps doing so until a scan has run
after the failure finished. A prune that comes while the error is
being signalled therefore still finds it.

Entries now leave by moving into `finished` instead of by a clone, and
`finished` grows as entries arrive instead of reserving room for the
whole frontier on every prune.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
@jgoyvaerts
jgoyvaerts force-pushed the m4pro/g17-frontier-prune branch from 7c3642c to bbfa456 Compare November 22, 2026 21:27
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora 110861f4333e to resolve the conflict with #2500 (new head bbfa45604804, on #2719's cde874ee627d).

Assisted-by: LLM (Claude:Opus 5.5)

Since the frontier is pruned from the front, a command that finishes
behind an older unfinished one stays in it until the front finishes.
The readers skip it, but it still holds its Completion: for a compute
command that includes the 16 KiB timestamp page (a GEM object and its
GPU mapping), which used to go back to the cache at the next prune.

A compute command completes when its ring's stamp covers its kick, so
one ring finishes in order. The completion-record fallback, a change
of ring and recovery replay are not shown to keep that order, and a
render queue spreads over several pairs. So rather than rely on it,
also scan the whole frontier once there have been as many prunes as
the last full scan left entries. The target is fixed at each scan:
every enqueue prunes once and adds an entry, so with a stuck front a
count compared against the current length would never catch up. That
costs at most two more status reads per prune, amortized, and nothing
finished waits longer than one queue length of submissions.

A KUnit case keeps the front unfinished and adds an unfinished command
with every prune; the finished ones behind it must leave at the scan.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
@jgoyvaerts
jgoyvaerts force-pushed the m4pro/g17-frontier-prune branch from bbfa456 to b792d3c Compare November 23, 2026 01:39
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Hardware results from the J616s (M4 Pro, our m4.179 kernel) for the three commits as they were (bbfa45604804), and two fixes they led to. New head b792d3c5b95b, force-pushed. It still merges cleanly into integration/aurora 13e494a072a3.

What m4.179 showed (the same cpu-clock profile of test_resolve_image_exhaustive_descriptors as the m4.177 one in the description; samples are the submit thread's, inside ASAHI_SUBMIT):

m4.177 m4.179
test stopped at ENOMEM passes
frontier depth failed growing past 4096 up to 65,536 entries
in ASAHI_SUBMIT 1724 1854
prune (retain's memcpy, the prune, its status reads) ~1204 6
Queue::submit's own code 165 1366

So the prune cost is gone. But the test now runs 16 times deeper, and a walk that was too small to see at 4096 entries became the new quadratic. host_predecessors (and the compute timestamp waits) look only for host-timestamp publishers, yet stepped through every unfinished command of their prefix to find them, on every enqueue. The hot loop is exactly that skip-entries-without-a-publication test.

Two fixes:

  • Commit 3, amended. Its full-scan bound (since_scan >= len()) could never fire with a stuck front. Every enqueue prunes once and adds one entry, so the count and the length grow together, and finished commands behind a long command were held until the front finished. The target is now fixed at each full scan, to the number of entries it left. New KUnit case: a stuck front with an unfinished command added at every prune, where the finished ones behind it must leave at the scan. It fails on the old bound.
  • New commit 4, "index each frontier's host-timestamp publishers."
    • Each engine keeps its publishers in a second, pruned list; the three readers that only want publishers walk that. Those are host_predecessors, the compute timestamp waits, and the input-source check of compute publishers.
    • Fences is built in one place, where publication is Some only with host timestamps and ready == completed exactly with host timestamps. So the index holds every entry those readers kept before; no link or wait can go missing.

Correctness on m4.179 (with the first three commits):

  • The d3d12 list (544 tests) has no regressions against the same Mesa build on m4.177: 452 / 89 / 3 against 450 / 90 / 4, with this test Fail → Pass.
  • dEQP-VK query_pool/timestamp (1999 cases): 0 differences.
  • 0 GPU recoveries, 0 OOM kills or allocation failures, 0 error-level kernel messages.

Tests on the new head: KUnit 747 tests, 746 pass, 1 skip (9 asahi_g17_outstanding cases). Host tests --only g17 90/90. checkpatch 0 errors.

This stays a draft until the next kernel has booted commit 4 and the same profile shows the walk gone.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

@jgoyvaerts status against integration/aurora daa9e2d: this merges cleanly (no change on the tip in these files since 110861f) and the g17 host tests pass on the merged tree (90/90). It still carries #2719's commit first, so #2719 goes in before it or with it. Open from review: a short KUnit case for VmStatus::signal_failure()/failures(), and hardware rows at bbfa456 (the J616s vkd3d-proton profile before and after, the dEQP-VK.synchronization groups, a soak, the same on an A18 Pro, and one run where a command fails behind an unfinished one). The change request on file is against 52054f1 and needs a re-review.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Build note: the asahi crate builds with this branch merged onto integration/aurora daa9e2d (arm64, rustc 1.97.1, fleet release config), with one new warning: method iter is never used at drivers/gpu/drm/asahi/g17/queue/outstanding.rs:55. #2719 alone builds without it, so the last caller goes away in this PR's own commits; dropping Outstanding::iter() or using it would keep the crate warning-free.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Correction to the build note above: it was built from bbfa456. At the current head b792d3c, Outstanding::iter() has a caller in outstanding.rs itself, so that warning should no longer appear; I have not rebuilt b792d3c.

@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Hardware results for the fourth commit and the amended bound, on the J616s (M4 Pro). Our m4.182 kernel carries all four commits of this PR. Same test and the same cpu-clock profile as the earlier tables.

m4.177 m4.179 (commits 1–3, old bound) m4.182 (all four)
test_resolve_image_exhaustive_descriptors stopped at ENOMEM passes, 111 s passes, 46 s
frontier depth failed past 4096 65,536 entries 65,536 entries
submit-thread samples in ASAHI_SUBMIT 1724 1854 319
in the prune ~1204 6 3
Queue::submit's own code (the publisher walk) 165 1366 12

What's left in the ioctl is spread thin. The largest pieces are memcpy (65, mostly the command copy in prepare_submission), the validator's request set (24) and Proof::validate (19); no single loop dominates.

The Mesa build changed between m4.179 and m4.182, so the test's wall time is not a kernel-only number. The correctness checks below use baselines of the same Mesa build on m4.179, so they are a clean A/B of commit 4 and the amended bound:

  • d3d12 list (544 tests): 452 / 89 / 3 against 452 / 89 / 3, 0 differ.
  • dEQP-VK query_pool/timestamp (1999 cases): 0 differ.
  • Boot: 0 GPU recoveries, 0 OOM kills, 0 page allocation failures, 0 failed units. That kernel has no SELinux, so there's no denial count.

Moving this out of draft. Still not tested on the M4, the M4 Max or the M5.

Assisted-by: LLM (Claude:Opus 5.5)

@jgoyvaerts
jgoyvaerts marked this pull request as ready for review November 23, 2026 23:25

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: HOLD at b792d3c5b95b

Blockers:

  • drivers/gpu/drm/asahi/g17/queue/mod.rs:205-207: prune_frontier() evicts failed entries from self.publishers[index] without calling failure.note(sequence, status, &fences). If a timestamp publisher at seq 2 sits behind an unfinished non-publisher at seq 1 in frontiers[index], and fails via fail_while_owned() (retaining its VM pin) after failures is loaded at :197 and frontiers[index].prune() stops at seq 1, publishers[index].prune() (where seq 2 is at the front or hit by publishers[index].scan_in == 0) sees status < 0 and drops seq 2 without noting it in self.failures[index]. Later in the same Queue::enqueue(), sources (:253-255), host_predecessors (:279-281), and timestamps (:322-326) walk publishers[index] and self.failures[index] and miss the failed retained publisher, allowing a dependent command to convert inputs, omit host-publication links, or publish inline without cancellation. Fix: call failure.note(sequence, status, &fences); inside self.publishers[index].prune(...) as well (and add a KUnit or host test covering a publisher evicted with status < 0).
  • PR body (§4): Remove the disallowed Assisted-by: attribution line at the bottom of the PR body.
  • PR body & hardware evidence (§5): Add the required What:, Tested:, Risk:, and Not yet: lines to the PR body, naming the exact head SHA (b792d3c5b95b) and regression summary (0 failed units, 0 new kernel errors, SELinux status) in Tested:, and add or request a second-Mac regression row for shared g17/queue code (another G17/G18 Mac besides J616s, such as M4, M4 Max, or M5).

Checked: All 4 commits (cde874ee..b792d3c5), prior blockers from 52054f13, Outstanding<T> compaction/wraparound/panic safety, VmStatus::signal_failure()/failures() ARM64 memory ordering, publishers index equivalence and pruning sync, G13–G18 regression isolation, checklist §1–§6, mergeability against main, and exact-head CI.

Evidence
  • Prior blockers from 52054f13:
    • Failure bracket (VmStatus::signal_failure() / failures() + Outstanding::prune() recording failures.finished) and KUnit case: resolved for frontiers, regressed on publishers in commit 4 (blocker above).
    • Outstanding::reserve() compaction (2 * self.head >= self.len()) preventing 4x doubling, verified at DEPTH = 1100: resolved.
    • #2719 carryovers (GFP_KERNEL_ACCOUNT for frontiers/publishers/finished, whole-submission reserve before outputs.publish()): resolved (#2719 itself remains OPEN at cde874ee).
    • sources .prefix() walk and status() <= 0 sizing for dependencies/checked_inputs/firmware: resolved.
  • Correctness & safety:
    • Outstanding<T> (outstanding.rs): self.head <= self.entries.len() and scan_in == 0 guard prevent underflow; partition_point monotonicity holds on strictly increasing sequence >= 1; no unwrap()/expect() outside #[kunit_tests]; bounded wait fix (scan_in = self.len() at each full scan) verified by a_stuck_front_does_not_hold_finished_commands_past_a_queue_length.
    • Fences::publishes_timestamps() (job.rs:561-563): matches Scheduler::enqueue (ready == completed iff host_timestamps, and publication.is_some() implies host_timestamps).
    • G13–G16 untouched; zero chip/board/firmware gates (§1), default cmdline (§2), no hardcoded hardware-safety limits (§3), clean human author/committer + Signed-off-by on all 4 commits (§4), naming clean (§6).
  • Mergeability & CI at b792d3c5b95b: OPEN, non-draft, mergeable: true, host-tests SUCCESS.
  • Non-blocking notes:
    • drivers/gpu/drm/asahi/g17/queue/outstanding.rs:57: Outstanding::iter() is only called inside #[kunit_tests], so CONFIG_KUNIT=n builds will emit a dead_code warning; gating with #[cfg(CONFIG_KUNIT)] keeps non-KUnit builds warning-free.
    • drivers/gpu/drm/asahi/g17/queue/mod.rs:595-604: publishers.reserve(room) reserves for all commands in pending rather than only those with destinations.has_outputs().
    • drivers/gpu/drm/asahi/g17/status.rs:111: failures_started.fetch_add(1, Ordering::Release) (instead of Relaxed) would avoid relying on dma_fence_signal()'s internal barrier, and a small KUnit test in asahi_g17_vm_status would directly pin signal_failure()/failures().

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (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
Two readers of a queue's frontier only look for commands that write
host timestamps: a render's host-publication links to earlier renders,
and a compute command's waits for timestamps it may copy. Few commands
publish, but both walked every unfinished command of their prefix to
find them, on every enqueue. With pruning no longer the cost, that
walk is what makes a deep queue quadratic: on an M4 Pro, vkd3d-proton's
test_resolve_image_exhaustive_descriptors held up to 65536 commands in
one frontier, and 1366 of the 1854 profile samples its submit thread
spent in ASAHI_SUBMIT were this loop, which skips commands without a
publication.

Keep the publishers of each engine in a second, pruned list as well,
and let both readers walk that. The input-source check, which needs
every compute publisher of its prefix to have finished, uses it too.
Each list is pruned and reserved with its frontier, and its entries
are released with the other pruned ones after the ioctl.

A publisher can leave its own list while the frontier still holds it
behind an older unfinished command: a failure signalled after the prune
read the VM's failure counts leaves the frontier's prune front-only.
Its readers would then not see that failure in the same enqueue, so a
failure is recorded whichever list it leaves first. prune_engine() does
both prunes with one callback, and a KUnit case keeps a failed
publisher behind an unfinished command and checks it is recorded.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
@jgoyvaerts
jgoyvaerts force-pushed the m4pro/g17-frontier-prune branch from b792d3c to c139054 Compare November 24, 2026 18:06
@jgoyvaerts
jgoyvaerts requested review from a team as code owners November 24, 2026 18:06
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Nov 24, 2026
@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed 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) labels Nov 25, 2026
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Merged main (efed1ae377ba) into the topic branch, pushed normally: new head 9cc1c8acf8bc. It also merges cleanly with today's main 8c6bd8d1e806. The conflicts were with 086a909 (EnqueueOrdering) in g17/queue/mod.rs and g17/completion.rs. The resolution keeps main's ordering rules. What changes against main:

  • EnqueueOrdering::build() (g17/queue/mod.rs) now takes the Outstanding lists instead of slices. Its same-engine walks (predecessor links and same-engine host waits) read the engine's publisher list, while the other-engine walk still reads every covered frontier entry. Both same-engine loops only take entries with a publication or ready == completed, so they see the same set as main's full walk.
  • The publisher list's predicate widens. Fences::publishes() (was publishes_timestamps(), g17/job.rs) is now publication.is_some() || ready == completed. Before 086a909 a publication meant timestamps. Now a command without outputs that chains behind one gets an ordered publication too, and it has to be in the list so later commands chain behind it.
  • has_pending_publication() and the compute input-source check read the publisher lists. Main's ready != completed && publication.is_none() exemption is the same set, expressed through the list.
  • enqueue()'s per-command reserve(1) is gone, because submit() reserves room for the whole batch in both lists first (drm/asahi: g17: keep a queue's frontier off contiguous pages #2719).
  • HostOutput::finish() takes the VmStatus, so a failing Immediate output goes through VmStatus::signal_failure(), as Publication already did. Without that, a prune could miss a failure from a compute command with no ordered publication.
  • Main's five asahi_g17_cross_engine_timestamps cases now build Outstanding lists. They are otherwise unchanged and pass.

One cost to know, unchanged here: with 086a909, every render without outputs behind a pending publication gets a publication itself. In that pattern the publisher list is no longer sparse, and each submit walks and links all pending ones, as main does over the whole frontier. The 65,536-deep test has no timestamps, so it doesn't show this.

Tested at 9cc1c8acf8bc: KUnit (arm64 qemu) 807 tests, 806 pass, 1 skip; tools/asahi/run-host-tests.py, every g17 and asahi job passes. The 5 jobs that fail locally (apple-dcp, test-m3-uapi, g15-pb-growth, g15-stats-drain, sep-suspend-errors) fail on my host toolchain: rustup 1.93.1 missing, a __stack_chk_guard link error, headers_install exit 127. There's no hardware row at this head yet. The J616s rows above are at c139054181d2.

The PR description was empty from 2026-11-24 21:09 UTC; it is restored from its last version, with the Tested and Not yet lines updated.

@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

J616s (M4 Pro, T6040) row at head 9cc1c8acf8bc. This is the main merge, including the EnqueueOrdering resolution described above.

Kernel: our m4.190 test kernel, booted 2026-11-25 15:43 UTC: aurora main 8c6bd8d1e806 with #2504 (b731bf1a34b0), this PR (9cc1c8acf8bc) and #2228 (6e21fca49d00) merged in, plus our carried patches. The Mesa is unchanged from the earlier rows (m4/next c356a1498). Run 17:16 to 17:22 UTC as one chain.

m4.188 (c139054181d2 + T104) m4.190 (9cc1c8acf8bc)
test_resolve_image_exhaustive_descriptors passes, 51.5 s passes, 47.6 s
peak frontier room (largest Outstanding::reserve kvrealloc from Queue::submit) 65,536 entries 65,536 entries (3,145,728 B)
vkd3d_queue samples in the submit ioctl (drmIoctl frames, cpu-clock 1999 Hz) 333 350
Queue::submit's own code 9 8
prune 4 2

EnqueueOrdering::build() has no frame of its own; it is inlined into Queue::submit, whose own samples stayed at 8. The ioctl's top frames are memcpy (62), Proof::validate (21) and the validator's request set (20), the same as before.

  • d3d12 list (544 tests) against the same Mesa: 0 differ (452 Pass, 89 Skip, 3 Fail on both sides).
  • dEQP-VK query_pool/timestamp (1,999 cases): 0 differ from the stored baseline (1,972 Pass, 27 NotSupported).
  • Kernel log:
    • 0 invoked oom-killer, 0 page allocation failure, 0 refused submissions;
    • 0 GPU recoveries during this chain (the boot's earlier recoveries came from a separate, deliberate hang test);
    • 0 failed units, and no SELinux/AppArmor loaded.

Not covered: M4, M4 Max and M5 rows; a soak. The 086a909 publication-chain pattern noted in the merge comment isn't exercised here, because this test writes no timestamps.

DjDeveloperr
DjDeveloperr previously approved these changes Nov 25, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Audited the main merge at 9cc1c8acf8bc on top of the previously verified 4-commit series (c139054181d2): widening Fences::publishes() to publication.is_some() || ready == completed matches both same-engine predicates in EnqueueOrdering::build() (L749/L770) and the compute source check, routing HostOutputKind::Immediate errors through VmStatus::signal_failure() keeps failure-count pruning race-free, host-tests + KUnit pass, and the exact-head J616s row passes cleanly (65,536-entry frontier, 0 d3d12/query_pool diffs).

Holding merge until the remaining second-generation hardware row (M5 or Neo) lands for this shared G17 queue path.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) merge-conflict Conflicts with the base branch (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Nov 25, 2026
Resolve against 8677cbd ("drm/asahi: g17: avoid publication
contagion and host drains on timestamp overlap"), keeping main's rules
and reading them through each engine's publisher list:

- has_pending_publication() reads the publisher lists and now needs
  Publication::is_pending(), as on main.
- The compute input-source check walks the compute publisher list with
  main's predicate: every covered entry with a pending publication or
  ready == completed must have finished. Settled publications no longer
  block it.
- EnqueueOrdering::build() takes main's rules (pending publications
  only, host waits only for query-accessing compute, has_outputs gone)
  over the same lists as before.
- Fences::publishes() is unchanged (publication.is_some() or ready ==
  completed). It is a superset of what build() and the checks look for;
  each reader still filters on is_pending().
- New: enqueue() prunes its engine again right before build(). Main
  now also host-waits on a same-engine command that failed after the
  first prune without a pending publication. Such a command is not in
  the publisher list, but a visible failure always moves the VM's
  failure count, so this prune does a full scan and records it, and
  the failure record makes it a checked dependency like main's host
  wait. With no failure it costs one front-only prune.
- Main's cross-engine KUnit cases build Outstanding lists.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Merged main (f7b890d4380e) into the topic branch, pushed normally: new head aabe2117e9ef. It also merges cleanly with today's main f408c8dd7ae6. The only conflict was g17/queue/mod.rs, against 8677cbd. The resolution keeps main's rules and reads them through each engine's publisher list. Against main:

  • has_pending_publication() reads the publisher lists and now requires Publication::is_pending(), as main does.
  • Compute input-source check: it walks the compute publisher list with main's predicate. Every covered entry with a pending publication or ready == completed must have finished. Settled publications no longer block it, as on main.
  • EnqueueOrdering::build() follows main's rules (pending publications only, host waits only for query-accessing compute, no has_outputs) over the same lists as in the last merge. Its same-engine walk is the publisher list; its other-engine walk is every covered frontier entry.
  • Fences::publishes() is unchanged (publication.is_some() || ready == completed). The is_pending() rule only narrows what readers take: a publication that settles stays in the list until its command finishes, and each reader filters on is_pending(). Main's fix also removes the cost I flagged last time, because a settled timestamp-free publication no longer makes later commands publishers.
  • New: enqueue() prunes its own engine again right before build() (g17/queue/mod.rs, just above EnqueueOrdering::build). Main now also host-waits on a same-engine command that failed after the first prune without a pending publication. Such a command needn't be in the publisher list. But a failure that is visible always has its VM failure count moved first (VmStatus::signal_failure()), so this second prune does a full scan and records it. The failure record then makes it a checked dependency, the same effect as main's host wait. With no failure in flight it costs one front-only prune, usually a single status read.
  • Main's cross-engine KUnit cases, including the two new ones, now build Outstanding lists. They are otherwise unchanged and pass.

Tested at aabe2117e9ef:

  • KUnit (arm64 qemu): 824 tests, 823 pass, 1 skip. That includes asahi_g17_cross_engine_timestamps (7), asahi_g17_publication_order, asahi_g17_timestamp_window and asahi_g17_outstanding (10).
  • tools/asahi/run-host-tests.py: every g17 and asahi job passes. The jobs that fail locally fail for host-setup reasons: missing rustup 1.93.1, a __stack_chk_guard link error, headers_install exit 127, and a g15 mutation job that needs a commit my clone lacks. They are apple-dcp, test-m3-uapi, sep-suspend-errors and three g15 jobs.

Not yet: a J616s row at this head. Our m4.190 kernel carries 9cc1c8acf8bc (row posted above). This head goes into our next test kernel, and I'll post the row when it boots.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 25, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified the main merge-forward resolution in drivers/gpu/drm/asahi/g17/queue/mod.rs against 8677cbde1ddc: has_pending_publication() and the compute fast-path cleanly preserve main's pending-publication and failure rules through each engine's publisher list, with prune_frontier(index) run before EnqueueOrdering::build(). Holding merge until CI completes green and updated hardware verification clears.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

aabe2117e9ef (batched cleanly in J616s Batch #2 5b411e230229 over main 95a983c08be4, 0 merge-tree diffs across all 7 changed files) J616s (MacBook Pro 16" M4 Pro, T6040, Apple M4 Pro (G16S B1), macOS 26.6.2 fw, guarded one-shot 7.3.0-aurora-pr2905+, default cmdline, stock Stage 2 1.0.0b17, boot_id=de17fad3) PASS: 0 failed units, Enforcing, 0 new AVC (1 matching baseline), 0 GPU faults, 0 errors in this subsystem, real rtc1 s2idle 2/2 (success=2 fail=0), eDP connected pre/post-sleep, 406600000.sep + 514600000.mtp RTKit v12 (AppleMTPFirmwareMac-5340.61.4~502, HID keyboard/trackpad/accel/actuator/touch) clean, Borealis VK dEQP-VK.api.smoke.* 8/8 (pre & post-sleep) + glsl.loops.* 624/624, Wi-Fi 3/3 ping pre/post-sleep; stock 7.3.0-aurora-fleet89 restored & verified (b67edc6c).

@RyanTheTide
RyanTheTide merged commit 1f31e40 into aurora-silicon:main Nov 26, 2026
22 of 42 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merged into main (ORCH5 batch, 11-26). Thanks @jgoyvaerts! The exact-head hardware row it landed on is #2732 (comment).

Assisted-by: LLM (Claude:Opus 5.5)

jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Nov 26, 2026
Conflicts, and how they were resolved:

- g17/queue/mod.rs submit(): main (aurora-silicon#2732) reserves room for every
  command's frontier and publisher entry before queuing, then takes the
  guards with into_iter(). The reservation is kept, and this branch's
  guards.drain_all() follows it, so the per-queue scratch vector keeps
  its allocation.
- g17/runtime.rs Backend: main's compute_channels and this branch's
  spare_batch fields are both kept, in the struct and in new().

No behaviour changes: the branch's diff against main is unchanged.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

J616s (M4 Pro, T6040) row at aabe2117e9ef, the head that was merged (1f31e404dec5).

Kernel: our m4.195 test kernel, booted 2026-11-26 19:06 UTC: aurora main a851ca0edfc9 (contains this PR) with #2504, #2228 and #2724 merged in, plus our carried patches. The Mesa is unchanged from the earlier rows (m4/next c356a1498). The checks ran 19:16–19:22 UTC as one chain.

m4.190 (9cc1c8acf8bc) m4.195 (aabe2117e9ef)
test_resolve_image_exhaustive_descriptors passes, 47.6 s passes, 43.0 s
peak frontier room (Outstanding::reserve from Queue::submit) 65,536 entries 65,536 entries (3,145,728 B)
vkd3d_queue samples in the submit ioctl (drmIoctl frames) 350 285
Queue::submit's own code 8 11
prune (both calls per enqueue) 2 5

The second prune before EnqueueOrdering::build() shows up as 3 more prune samples, about 1% of the ioctl. The ioctl's top frames are still memcpy, the validator's request set and Proof::validate.

  • d3d12 list (544 tests) against the same Mesa: 0 differ (452 Pass, 89 Skip, 3 Fail on both).
  • dEQP-VK query_pool/timestamp (1,999 cases): 0 differ from the stored baseline (1,972 Pass, 27 NotSupported).
  • Kernel log:
    • 0 invoked oom-killer, 0 page allocation failure, 0 refused submissions;
    • 0 GPU recoveries during the chain (the boot's earlier ones came from a separate, deliberate hang test);
    • 0 failed units, and no SELinux/AppArmor loaded.

Not covered: M4, M4 Max and M5 rows; a soak.

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) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants