Skip to content

drm/asahi: g17: cut the references a pending command holds - #3681

Merged
DjDeveloperr merged 3 commits into
aurora-silicon:mainfrom
jgoyvaerts:m4pro/g17-reach-links
Dec 3, 2026
Merged

DjDeveloperr merged 3 commits into
aurora-silicon:mainfrom
jgoyvaerts:m4pro/g17-reach-links

Conversation

@jgoyvaerts

@jgoyvaerts jgoyvaerts commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What: A pending G17 command kept references that grow with the queue's depth: one publication link per covered pending publication, and one completed fence per unfinished producer of the other engine it waits for in firmware. Behind a stalled job a queue of n pending commands held about n² of them (#2858). Cyberpunk 2077 filled #3602's queue budget with them (about 310 links and 170 producer fences per command on an M4 Pro). Two commits cut both at the source, with publication order and errors unchanged: (1) a publication records how far its ancestors reach, and a command skips a candidate a kept predecessor already reaches, so a chain that waits for all earlier commands takes one link per command; (2) each queue keeps a failure log per engine, and a command checks its producers through it (one reference and two numbers) instead of keeping a fence for each.
Tested: QEMU arm64 KUnit (asahi kunitconfig) at the current head c1fae1d: Ran 958 tests: passed: 957, skipped: 1. At 4d9cb2f, my last commit: Ran 958 tests: passed: 957, skipped: 1. Each of my commits' new cases fails on the code before it (link cut disabled: the link-count case fails, Ran 954; failure check stubbed: the 3 failure-log cases fail, Ran 957; lost failures tracked as first-only and not in flight: the lost case fails, Ran 958). tools/asahi host tests at c1fae1d: failures only in files this doesn't touch (apple-dcp, g15-pb-growth, g15-retention mutations, g15-stats-drain, sep-suspend-errors: environment). g15-input-error, the one host test reading dependency.rs, passes. J616s M4 Pro, only on backports in test kernels, never at this head, both with #3602's budget: (1) the first commit on 7.3.0-m4.213: Cyberpunk 2077 benchmark 33.3 / 35.4 fps; 1.4 links per command (was ~310); busiest queue at 84.8% of the budget; 0 recoveries, 0 submit failures (result). (2) both of my commits on 7.3.0-m4.219: Cyberpunk 34.2 / 35.7 fps; other references per command 189 → 16 (the producer fences are gone); busiest queue at 33.6% of the budget; 0 recoveries, 0 submit failures (result). The current head adds DjDeveloperr's c1fae1d, which was not run on the J616s. With it, a failure's log entry stays open until a deferred public fence is published.
Risk: two-way door · M4 and M5 (G17 publication chaining in EnqueueOrdering::build, the producer status checks of Packet, and every command's failure path, which now enters a failure log before its fences signal). A wrong reach or a wrong since could let a command publish before an older publication it covers, or miss a producer's failure. The write-ups, with file:line references, cover ordering, error propagation, coverage, the in-flight race and the log's bound; the tests cover each. The many-to-many pattern (independent producers covered together) keeps one link each; #3602's budget still bounds it.
Not yet: a hardware run at this head (the backports above lack c1fae1d). Not run on M5.

Details

Reach. Publication::reach[e], set once before activation under the queue's lock (set_reach), is the largest s such that every publication of engine e up to seq s, which a later command could still link to (unfinished, publication pending) when this one was accepted, is an ancestor of this one. EnqueueOrdering::build:

  • walks each engine's covered candidates newest first (the frontier's prefix iterator now runs backwards; no extra allocation);
  • keeps a candidate unless its sequence ≤ what kept predecessors already reach on its engine;
  • sets the command's reach to the covered prefix of each engine its rules link (same_chain, cross_chain), or what its kept predecessors reach, whichever is further.

Timestamp waits are still collected from every candidate.

Why it is sound (full write-up with file:line references: ordering, error propagation, coverage):

  • Ordering: a skipped X is at most a kept K's reach. X is pending now, so it was pending when K was accepted, and a covered command is always accepted before its consumer (Order::new refuses a prior past the base). So X is an ancestor of K. A publication fires only once every predecessor has (remaining == 0), and so does upstream release. So K, and this command, fire after X.
  • Errors: X's error sets predecessor_error along the path to K. That blocks K's upstream release and turns its result into PRODUCER_FAILED, and the command inherits it from K.
  • Coverage: reach records only what a command actually linked. A query-accessing compute's host waits, a host-wait queue, or a command whose barriers skip an engine reach nothing there. So "link only the newest" counterexamples keep their link.

Not changed: host waits, firmware producer waits and scheduler dependencies.

Builds on the analysis in #2858 (its option 2a, reach-based reduction) and bounds what #3602's budget has to hold.

Second commit: producer failures through a log

dependency::FailureLog, one per queue and engine:

  • entries (count, seq, done), entered in Completion::signal_result before the terminal or output fence signals, and marked done after both;
  • since() is the count just below the oldest entry still in flight;
  • a command that waits for the other engine's producers in firmware reads since right before EnqueueOrdering::build reads their statuses, and keeps Producers { log, since, prefix } instead of a fence per producer;
  • it fails iff an entry has count > since and a sequence within its prefix.

Why it matches the fences exactly. For any other-engine command X within the prefix:

  • finished ok before: X never fails, and is never entered.
  • X's failure signalled before since was read: build() finds X failed and waits for it on the host, as before, and the log doesn't count it again.
  • X fails after, or is still being signalled: its entry is past since and counts.
  • X failed and retired before the command was accepted: not counted. A plain "lowest failed sequence" would keep failing every later command covering it, which FailureRecord stopped on purpose.

Bound.

  • Trimmed at every enqueue: a done entry stays only while an unfinished command of the other engine has a smaller since and covers it. In-flight entries stay.
  • Each kept entry stands for one (consumer, producer) pair that used to hold a completed fence. So the log never holds more than those fences did, and normally only recent failures.
  • A failure that cannot be entered (its GFP_NOWAIT push fails) holds since below it while in flight, like an entry, and conservatively fails every command whose since is below the latest such failure.

New cases (asahi_g17_dependency):

  • a_producer_failing_after_acceptance_fails_its_consumer (including the in-flight case);
  • a_failure_before_acceptance_does_not_fail_a_later_consumer;
  • trimming_keeps_only_what_an_unfinished_consumer_can_check.

The quarantine-drain host test's Completion stand-in gets signal_result.

Evidence
KUnit (QEMU arm64, asahi kunitconfig)
red (cut disabled: every candidate kept): Ran 954 tests: passed: 952, failed: 1, skipped: 1
  asahi_g17_cross_engine_timestamps.a_chain_behind_a_stalled_head_takes_one_link_per_command
green at 087a904aa7df: Ran 954 tests: passed: 953, skipped: 1
new cases (asahi_g17_cross_engine_timestamps):
  a_chain_behind_a_stalled_head_takes_one_link_per_command   (32 renders: 32 links, was 528)
  a_reduced_chain_still_publishes_after_its_stalled_head     (ordering, no early upstream release)
  a_reduced_chain_still_fails_when_its_head_fails            (error propagation)
  a_newest_predecessor_that_does_not_reach_keeps_the_older_link   (2858 problem 1)
  independent_producers_keep_one_link_each                   (2858 problem 2, m x n kept)
  a_rule_that_links_nothing_reaches_nothing                  (mixed per-command rules)
host tests: 29 FAIL lines, identical set on main 45d7f828e08a and on d5c52de7a062 (comments differ from this head)

Measured motivation (before this change, m4.211, budget probes on the inlined charges): Cyberpunk's busiest queue, 680k commands. Per command: links mean 302-319 (64%), producer fences ~170 (35%), scheduler dependencies ~6 (1%). Peak 311,000 units against the 262,144-unit budget.

…reach

A command chains its host publication behind every covered pending
publication, one link each. Behind one stalled timestamp writer every
later covered command joins the chain, so a queue of n pending
commands held n(n-1)/2 links. On an M4 Pro,
Cyberpunk 2077's busiest queue averaged about 310 links per pending
command, 64% of what its pending commands hold, and filled the queue
budget.

A publication now records how far its ancestors reach on each engine:
every publication of that engine up to that sequence which a later
command could still link to (unfinished, publication pending) when it
was accepted is one of its ancestors. A new command takes its
candidates newest first and skips one whose sequence a kept
predecessor already reaches. Its own reach is the covered prefix of
each engine its rules link, or what its kept predecessors reach.

Publication order and errors are unchanged:
- a skipped publication is an ancestor of a kept one, so it fires
  first: a publication fires only once every predecessor has, and
  upstream release needs that too;
- its error reaches the kept one, and through it this command, as
  PRODUCER_FAILED.

Reach records only what a command actually linked, so per-command
prefixes, a query-accessing compute's host waits instead of links, and
host-wait queues reach nothing they did not link (the "newest only"
counterexample keeps its link). Independent producers covered together
(m x n) keep every link; the queue budget still bounds that.
Timestamp waits are still collected from every candidate.

A chain that waits for all earlier commands now takes one link per
command.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Hardware result on a backport, not the exact head. J616s M4 Pro, test kernel 7.3.0-m4.213 (m4/private-213, on m4/private-212): #3681's link cut (cherry-pick of 087a904), #3600, #3601 and #3602's first two commits, with main's 2048-submission order window. #3602's budget was 262,144 units per queue.

Cyberpunk 2077 built-in benchmark, 1920x1200 Low, cold + warm, headless gamescope, alone on the GPU. Kprobes on the budget's two inlined charges read the new used after each one, beside the asahi_g17_* tracepoints. 0 trace overruns.

m4.211 (before the link cut) m4.213 (with it)
fps cold / warm 23.6 / 25.9 33.3 / 35.4
links per command, mean (p50 / p99) 302-319 (358 / 415) 1.4 (1 / 3)
producer fences + host waits per command, mean 167-176 183-189
scheduler dependencies per command, mean 5.7-6.0 2.1
busiest queue's budget peak 310,982 units (118.6%: submitter slept) 222,180 units (84.8%)
second queue 309,291 (118.0%) 208,241 (79.4%)
peak pending commands per queue 555 607
submit failures, GPU recoveries 0, 0 0, 0
  • The link cut does what the proof says. A command now holds 1.4 links on average, against ~310. Most of the fps difference against m4.211 comes from other changes in the test kernel (memory limits, queue lending, storm fixes) and is not attributed to this.
  • The budget no longer fills, but sits at ~85%. What remains is the producer fences, now 98% of the references (about 190 per command): one completed fence per covered unfinished producer of the other engine, kept for error propagation.
  • Replacing those with a per-engine failure log is written up but not implemented. The owner decides it from this number.

@jgoyvaerts jgoyvaerts changed the title drm/asahi: g17: link a command only to publications its others don't reach drm/asahi: g17: cut the references a pending command holds Nov 30, 2026
A command kept one completed fence for every unfinished command of the
other engine it waited for in firmware, only to fail when one of them
failed. Behind a deep queue these were most of what its pending
commands held. On an M4 Pro, once publication links had been cut,
Cyberpunk 2077's commands held about 190 such references each, 98% of
the references its busiest queue's budget counted, and that queue
peaked at 85% of the budget.

Each queue now keeps a failure log per engine. A failed command is
entered before its terminal and output fences signal and marked done
after both. A command that waits for the other engine's producers in
firmware keeps that engine's log and two numbers instead:
- since: the log count below its oldest failure still in flight, read
  before the command reads its producers' statuses;
- its prefix of that engine.
It fails if a failure past since is within the prefix.

This fails a command exactly when one of its fences did:
- a producer whose failure is at or below since had signalled it
  before the statuses were read, so it is found failed there and waited
  for on the host, as before;
- a producer that fails later, or is still being signalled, is past
  since;
- a producer that finished, or failed and retired before the command
  was accepted, never counts. A plain lowest failed sequence would have
  kept failing every later command covering it, which FailureRecord
  deliberately stopped.

The log keeps a done failure only while an unfinished command of the
other engine has a smaller since and covers it; it is trimmed at every
enqueue. Each kept failure then stands for one (consumer, producer) pair
that used to hold a completed fence, so the log never holds more than
those fences did, and normally only recent failures. A failure that
cannot be entered (the GFP_NOWAIT push fails) holds since below it
while in flight, like an entry, and fails, conservatively, every
command whose since is below the latest such failure.

The scheduler still waits for the producers' latest scheduled fence.
The quarantine-drain host test's Completion stand-in gets the new
signal_result.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
@jgoyvaerts
jgoyvaerts force-pushed the m4pro/g17-reach-links branch from 602ea2f to 4d9cb2f Compare November 30, 2026 16:42
Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (Neo, G17P) boot row at head c1fae1db

Kernel: one trial boot (boot b0f8a86e). Stock Fedora -41 was restored and verified afterwards.

Results

  • Mixed render/compute with checked output:
    • q4 render triangle 42.3 µs, per-queue CRC ok
    • compute.light d1, per-slot CRC ok
    • concurrent render + compute on separate queues, and interleaved on one queue
    • 4-queue and 4-process compute; 4-queue render
    • cross-queue timeline and binary semaphore chains; host signal
    • queue churn (CRC ok)
  • Multi-queue CTS: sync2 16,680 Pass / 7,080 NotSupported / 0 Fail; sync 12,798 Pass / 9 NotSupported / 0 Fail. Identical case for case to the other boots on this Image.
  • Two clients in separate cgroups: kernel_resident 308 → 452 MB while running, 297 MB six seconds after close; user_resident back to its starting value at the end.
  • Health: 0 WARN, 0 GPU faults, 0 AVC, 0 failed units. The only flagged line is the out-of-tree taint from building the module with M=.

Not covered:

  • link or reference counts per command: the J700 has no counter for them, and this run did not trace them;
  • the deferred-error path for delayed publication;
  • a lost-device or failure injection.

This row covers the success path and multi-queue progress only.

@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.

Reviewed c1fae1d. Raw failure is logged before terminal signalling. A deferred predecessor failure is also recorded before the public fence signals, and the model observed that failure through the consumer's log. The 291 driver checks passed. The mixed-engine hardware row is still open.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Recorded inherited publication errors before signalling the producer’s public fence in c1fae1d.

@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Hardware result for the second commit, on a backport, not the exact head. J616s M4 Pro, test kernel 7.3.0-m4.219: the failure log as a cherry-pick of 4d9cb2f, on top of the link cut and #3600/#3601/#3602's budget (262,144 units per queue). The test kernel also has a local change that lets a command queued behind already-published producers be published from its ioctl. That change lowers scheduler dependencies but not the references counted here.

Cyberpunk 2077 built-in benchmark, 1920x1200 Low, cold + warm, headless gamescope, alone on the GPU. The same kprobes as before sit on the budget's two inlined charges. 0 trace overruns.

m4.213 (link cut only) m4.219 (link cut + failure log)
fps cold / warm 33.3 / 35.4 34.2 / 35.7
links per command, mean (p50 / p99) 1.4 (1 / 3) 1.4 (1 / 3)
other references per command, mean (p50 / p99) 189 (205 / 297) 16.2 (18 / 28)
scheduler dependencies per command, mean 2.1 2.1
busiest queue's budget peak 222,180 units (84.8%) 88,048 units (33.6%)
second queue 208,241 (79.4%) 84,354 (32.2%)
submit failures, GPU recoveries 0, 0 0, 0
  • The producer fences are gone. Packet no longer keeps a completed fence per producer, and the other references per command fell from 189 to 16.
    • The remaining 16 are checked inputs and the inherited host-timestamp waits. The charge counts both, and this trace doesn't separate them.
  • The busiest queue now peaks at a third of the budget (was 85%).
  • No GPU fault happened during the run, so it did not exercise the failure path itself. The KUnit cases cover that path.

This is a backport, so the PR stays a draft until the row passes at its own head.

@jgoyvaerts
jgoyvaerts marked this pull request as ready for review December 2, 2026 23:11
@jgoyvaerts
jgoyvaerts requested review from a team as code owners December 2, 2026 23:11
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) 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) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at c1fae1db: not ready yet

Check Detail
CI at head ok 24 checks passed
Review no approved by DjDeveloperr, but GitHub does not count it yet (code owner from Core or Omarchy Mac needed, or approval went stale)
Requested changes ok none
Hardware row at head ok in the PR body at c1fae1db
Conflicts ok none
PR text ok Risk: two-way · M4 and M5 (G17 publication chaining in EnqueueOrdering::build, the producer status checks of Packet, and every command's failure path, which now enters a failure log before its fences signal). A wrong reach or a wrong since could let a command publish before an older publication it covers, or miss a producer's failure. The write-ups, with file:line references, cover ordering, error propagation, coverage, the in-flight race and the log's bound; the tests cover each. The many-to-many pattern (independent producers covered together) keeps one link each; #3602's budget still bounds it.

Areas: area:gpu

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

@erikwb

erikwb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Tested exact head c1fae1db7ecc on J716c (16" MacBook Pro, M5 Max / T6050 / G17C, SLC enabled on 32 planes, paired with a current t6050-j716c.dtb because 45d7f828e08a predates 03b510a3b6a1 for die 0's second MMIO window):

  • Problem solved: When D3D12 uses separate graphics, compute, and copy Vulkan queues on Borealis (compute-only + transfer-only queue families), a stock main kernel without #3681 stalls on the O(N²) publication-link / producer-fence buildup and drops Cyberpunk 2077 2.5 (2560×1600 benchmark) to 38.47 FPS (min 27.14, p99 42.0 ms, compute busy 66%).
  • Observed result at c1fae1db7ecc (alone, no #3443, 0 GPU faults / 0 recoveries):
    • With current aurora-wip Borealis + separate D3D12 queues: 57.33 FPS (min 44.38, p99 24.8 ms, compute busy 98%, +18.86 FPS / +49% over main).
    • With aurora-silicon/mesa#1561 (timestamp copy carriers) + separate D3D12 queues: 59.92 FPS (min 48.44, p99 24.9 ms, compute busy 102%, 0 faults).

Note: This was a single-pass benchmark check on J716c rather than a full CTS/reboot regression row, and the kernel image booted with a post-03b510a3b6a1 J716c DTB.

@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: the code is right. Land it once the J714s and J700 rows below pass at this head. I found nothing that has to change first. There is one thing worth fixing in a follow-up (an extra cancel after a failure) and two small notes.

Reviewed at c1fae1db7ecc, merged into main 5fe340acef00 (clean, tree 634cfeb3de00). It is also clean on 37a630623169; nothing under drivers/gpu/drm/asahi changed between the two. I pushed nothing.

What I checked

Link cut. A kept predecessor really does stand for everything below its reach:

  • Covered commands are always accepted before the command that covers them (prior can't pass the base, and an ioctl's commands are enqueued in order), and pending only goes from true to false. So anything still linkable now was linkable when the kept one was accepted.
  • A rule that links nothing (query-access compute, host_producer_waits) records no reach of its own.
  • The first candidate is always kept, so the terminal fence, the timestamp window and the host/firmware waits are decided exactly as on main.

Failure log.

  • since is read after the prunes and before build(). Failures are entered before the first fence signals, and an entry stays open until the public fence has signalled. Trimming never drops an open entry.
  • The mutex is a leaf: nothing is allocated under it with a blocking flag, and it is taken in process context only (device mutex → log, queue lock → log).
  • Every failing path goes through signal_result or the inherited error in Output::publish. That covers retirement, unpublished cancels, failed-while-owned, recovery and teardown.
  • The log holds no references, so there is no cycle with the queue.
  • c1fae1db is needed. Without it (entry closed at the raw failure, or no entry for an inherited error) the check below misses failures that the old fences caught.

What I ran on the merge tree

Check Result
run-host-tests.py --only g17, CI image (rust 1.96) 333/333 passed (the runner is byte-identical to main's)
g15-input-error, m3-packet, m5-client-handoff, legacy-wq (read the changed files or their neighbours) 3/3, 2/2, 2/2, 10/10
make ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/asahi/, stock aurora config (G15, G16, G18 and M5 on) rc 0; asahi_core.o and aurora.o rebuilt
The same with CONFIG_KUNIT=y (compiles the new cases; not run here) rc 0
W=1 warnings in the six changed driver files one, on main's fetch_update in begin_replay
checkpatch --strict per commit 0 errors; 6 warnings (test lines over 100 columns) / clean / 1 warning (c1fae1db has no description)
Random comparison of main and this head, described below no difference, no missed failure

The comparison compiles the real publication.rs, EnqueueOrdering::build, Outstanding, Output and FailureLog source from main and from the merge on the host. It feeds both the same random commands, barriers and failures. In 400,000 sequences (11.2 million commands):

  • every command got the same host, firmware and inherited timestamp waits, and every public fence, terminal fence and pending flag was the same after every step;
  • links fell from 18.0 to 6.7 million;
  • of 56 million producer checks, the log missed none that a fence would have caught;
  • 300,000 (consumer, producer) pairs with failures signalled from other threads during acceptance: none missed.

I also broke the code on purpose: reach without its rule, keep-newest-only, reach off by one, no entry for inherited errors, entry closed early, trim of needed entries, and since past open entries. The comparison caught all seven.

Follow-up, not blocking: an open failure can cancel a command that main would run. Since c1fae1db an entry stays open while its public fence waits for an older publication, and since stays below it all that time. Take Y (failed, finished and pruned) and X (a newer, failed command whose public fence is still waiting). A command accepted now that covers Y but not X gets a since below Y's entry and fails with ECANCELED. On main it runs, unless Y still holds its VM pin. Between the two commits the log didn't do this, and the second commit's text ("failed and retired before the command was accepted: not counted") no longer holds here. It only errs towards cancelling, only after a real failure, and only for a barrier that stops short of the newest failure. It was 4,983 of 14 million checks, in sequences that fail on purpose.

A fix that is exact in the same comparison (0 of 14 million, still no misses): count when an entry closes instead of when it opens.

  • since() returns the number of closed entries. end() increments that number, stores it in the entry, and moves the entry to the end of the closed ones.
  • failed() counts entries that are open or closed after since. trim() then still needs only one pass.
  • Please add the case that has no KUnit test yet: a raw failure behind a pending predecessor, checked between its terminal and its public fence.

I didn't push this because the head has rows and a comparison on it now.

Notes

  • firmware_waits still collects each producer's completed fence, and nothing reads it any more. It can become a list of scheduled fences.
  • The earlier approval here came from the account that pushed c1fae1db, so it doesn't count for the last-push rule. It missed the point above. The 12-01 J700 row is the success path only, with aurora.ko built out of tree on another main plus #3705. The readiness table's "hardware row ok" is also early: the body's J616s runs are backports. The J716c result at this exact head (38.5 → 57.3 fps, 0 faults) is the best evidence so far.

Land order. #3985 and #3342 share no file with this; any order. #3991 (on hold) merges cleanly either way; I didn't build it together with this one. #3411 and #3390 each merge into main but conflict with this in queue/mod.rs, so whichever lands second needs a forward merge. For #3411 it is one field in Queue::new. For #3390 it is the producer loop, plus its host test, which expects firmware.push(completed.clone()). #3443 conflicts in publication.rs, job.rs and queue/mod.rs and cuts the same clique, so it should be reworked on top of this one. Its deferred attaching has to keep the rule this relies on: a kept predecessor can't fire before its ancestors. I'd land this first, then #3390/#3411, then #3443, then #3602.

Rows owed: J714s, J700, J616s (J773g not needed)

Kernels. head = this head merged into the current main. base = that main. Same .config, DTB and Mesa. Image and modules from the same build, not an out-of-tree module. Record the main, merge and tree SHAs and both build IDs.

Link and failure counters, both arms (as root; stock config has KPROBE_EVENTS and HIST_TRIGGERS):

cd /sys/kernel/tracing
L=$(awk '$3 ~ /publication.*8Prepared8activate$/{print $3; exit}' /proc/kallsyms)
F=$(awk '$3 ~ /dependency.*10FailureLog5begin$/{print $3; exit}' /proc/kallsyms)
echo "p:g17row/links $L n=+24(%x0):u64" >> kprobe_events
[ -n "$F" ] && echo "p:g17row/failed $F seq=%x1:u64" >> kprobe_events
echo 'hist:keys=n' > events/g17row/links/trigger
[ -n "$F" ] && echo 'hist:keys=seq' > events/g17row/failed/trigger
# after each workload
cat events/g17row/links/hist; [ -n "$F" ] && cat events/g17row/failed/hist

+24 is the length of Prepared::links. I read it from the disassembly of my build (rustc 1.100.1); check that activate in the row's aurora.ko loads the length from [x0, #0x18]. FailureLog::begin exists only on head.

J714s (M5 Pro, T6050 G17S): base, head, head, base, then one lockdep boot of head. SLC on (16 planes), headless only.

  1. gpubench-vk, CRCs verified: compute.cull_mdi (objs=16384 visible=75, depths 1, 2, 8, timestamps on, CRC 07f6c861), render.light (kind=tri, depths 1, 8, 32, 64), render.postfx (1, 2), compute.light (1, 8), compute.heavy (kind=alu, 1, 4). Plus gpubench-rt-vk rt.scene medium.
  2. CTS: synchronization.smoke.*, synchronization2.op.single_queue.*, query_pool.concurrent_queries.*, query_pool.occlusion_query.copy_*, multiview.queries.*, pipeline.monolithic.timestamp.*.
  3. Stress for the cut references: GTA V at native resolution, 3 minutes in the open world, with the link histogram. Cyberpunk 2077 with separate D3D12 queues also works. These keep hundreds of commands pending behind timestamp writers.
  4. Failure path: gpubench-stress-vk --test cr.concurrent,xq.order,xq.chain,sync.dense,queue.depth,compute.long,life.churn,life.fault --duration 240 --seed 3681 --kernel-log.
  5. Lockdep boot (PROVE_LOCKING, DEBUG_LOCK_ALLOC): items 2 and 4 once.

Pass:

  • every CRC right, CTS results identical case by case with 0 Fail, stress exits 0;
  • no primary metric more than 5% worse in both halves of the ABBA;
  • GTA V links per command on head at or below base at p50 and p99 (J616s went from about 310 to 1.4), and no lower fps;
  • failed has entries after life.fault if it reports faults_device_lost above 0;
  • 0 WARNING:, BUG:, possible circular locking dependency, possible recursive locking, G17: refused a submission;
  • G17: recovery gen, asahi: recovery: GPU MMU fault and the client sees a lost device only during life.fault and only for its faulting client. The checked client reports no error.

J700 (T8140 G17P): one head boot, plus base if any number looks off. Items 1 (render.light to depth 32) and 4, the 12-01 multi-queue CTS lists (then: 16,680 Pass / 7,080 NotSupported and 12,798 Pass / 9 NotSupported, 0 Fail), the two-client close test (kernel_resident back to its start), three s2idle cycles with item 1's compute.cull_mdi after each. The same pass lines. This one replaces the 12-01 row.

J773g: not needed. T8132 runs g16/ with its own jobs, fences and graph. From g17/ it uses only sync_input, sync_output and status, which this doesn't touch.

J616s (author), at this exact head merged into main, without the test-kernel set: Cyberpunk 2077 cold and warm with the same kprobes (links about 1.4, other references about 16 per command, 0 submit failures, 0 recoveries), dEQP synchronization.* and synchronization2.* (6,213 cases), and life.fault from item 4, which is the failure path none of the runs has had. T604x has no Mac in our lab, so this is the only T604x coverage. Please put the result in the body with the full SHA.

Not covered by any row: a command cancelled because a same-queue producer on the other engine failed while its public fence was still waiting. The KUnit cases and the comparison cover it.

@erikwb

erikwb commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

We carry this PR in our unified daily kernel across J716c (M5 Max, T6050), J713 (M4 Air, T8132), and J313 (M1 Air, T8103) alongside #4020.

Pruning transitively reached publications and checking cross-engine producer failures through the per-engine failure log eliminates the O(N^2) producer fence/publication clique on deep mixed render/compute queues, cutting submission overhead and unlocking smooth async compute on J716c (contributing to 60.14 FPS in Cyberpunk 2077 2.5 T2 with zero GPU faults).

Booted and verified on J716c, J713, and J313 (5/5 Vulkan CTS smoke pass on all three Macs, zero GPU errors).

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s (M5 Pro, G17S B1, SLC ON 16 planes) #3681 c1fae1db7ecce96c97052d6e71c13f454dcf7dde on origin/main 37a630623169 (merge eb9eb397aef6, tree d21439ef8ff3, mode all, build-ids base=1871205af8d0 head=21505d3acb74 lockdep=b19476f3563d): PASS (ABBA PASS cull_mdi d8 267.38->267.52us +0.05% CRC 07f6c861, render.light d8 27.35->27.02us -1.21%, rt.scene d2 67.75->67.57 FPS -0.27%; CTS 15551/15557 Pass / 6 NS / 0 Fail across base, head, and lockdep with 0 diffs; GTA V headless 5-pass rtgen2n31rc20 links p50 57->1 p99 167->6 mean 64.90->1.74, FPS 69.986->70.773 +1.12% [60.12,65.98,69.80,81.60,72.43]->[60.32,66.02,70.16,83.96,73.40]; 240s gpubench-stress-vk incl. life.fault 8/8 PASS faults_device_lost=0 failed_hist=1589 on head and 1441 on lockdep, 0 GPU faults/BUG/oops/refusals). Note: lockdep boot logged 1 pre-existing origin/main missing-nesting splat (possible recursive locking on two distinct g17::ComputeCell::queue instances under g17::Backend::outer_compute in untouched g17/runtime.rs::publish_compute_on).

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo, T8140, G17P) at c1fae1db7ecc: passes on correctness and no hang, with one stated deviation (life.fault)

One one-shot trial boot on 2026-12-03, head only: main 37a630623169 + this PR (merge e56a2dd47eaa, tree d21439ef8ff3, no conflict), release 7.3.0-pr3681-c1fae1db, stock aurora_defconfig. Prepared::activate and FailureLog::begin are symbols in the packaged aurora.ko.

The kit's own verdict was FAIL, and it was wrong. It failed its check that life.fault ran, because it read a bare metric name (faults_ignored) while GPUBench prints it as faulter.faults_ignored. The recorded value is 92 (with faulter.faults_device_lost: 0, 716,479 iterations), so the test did run. I re-read the saved receipt: every other check in the row passed. The later kit for the same test reads both names.

Check Result
Item 1, item 4: GPUBench, every case checked PASS. cull_mdi d1/d2/d8 CRC 07f6c861 each, also after each sleep. render.light d1/8/32, render.postfx d1/2, compute.light d1/8, compute.heavy d1/4 and rt.scene medium all valid
Two-client close PASS. kernel_resident 236 → 222 MiB, at most +16 MiB allowed, both rounds (6 and 7 s after the close)
The 12-01 CTS lists, absolute 23,760 of 23,760 and 12,807 of 12,807 recorded, 0 cases that are not Pass, NotSupported, QualityWarning or CompatibilityWarning. No failing case, so nothing to re-run on stock
Stress (240 s budget, seed 3681) all 8 tests pass, 0 errors: cr.concurrent, xq.order, xq.chain, sync.dense, queue.depth, compute.long, life.churn, life.fault
life.fault The client stores through an unmapped address over and over. 92 stores were ignored and 0 devices were lost: the GPU dropped them, with no failure and no recovery. Deviation (stated): this client never reports device lost here. The checked client had 0 errors, 0 GPU lines in its window, and a fresh device worked afterwards (cull_mdi d1/d2/d8 in a new process, CRC 07f6c861)
s2idle × 3, each followed by cull_mdi PASS. Success 0 → 3, fail 0, panel, 6 CPUs and the GPU back, 0 failed units
Kernel log 0 WARN, BUG, Oops or lockup lines, 0 GPU fault, recovery or lost-device lines, 0 G17: refused a submission, 0 boot hits. Firmware online, not crashed in all 9 capacity samples
Watchdog armed throughout

Not measured

  • fps against a base: there is no base arm on the J700, so this row is about correctness and hangs. The times are recorded, not judged.
  • CTS case-identity: also no base arm. The case counts differ from the 12-01 row (now 4,266 Pass and 19,494 NotSupported of 23,760; then 16,680 and 7,080). The 1,378 messages that the run printed say "Concurrent requires more than 1 queue family": stock Mesa 26.3.0-30 here exposes one, and the 12-01 row used another ICD. The same stock pre-check on the stock kernel gave 5 Pass and 25 NotSupported of 30. I did not trace every NotSupported case.
  • Links per command: stock aurora_defconfig refuses a kprobe on aurora.ko's Rust functions (they have no ftrace location, and KPROBE_EVENTS_ON_NOTRACE is off), so the review's link and failure counters could not be armed.
  • Not covered: the failure path where a same-queue producer fails while its public fence still waits, and the case that a life.fault client loses its device.

How it ran: the first two attempts stopped before any check of the PR (kit bugs: the kprobes, then a GPUBench multi-queue command without --verify that crashes in the test tool). Dead-man-only recovery, 30-minute dead-men.

Stock restored: boot-ctxr.bin byte-identical to before, no trial marker left, stock 7.3.0-41, PMU boot-error count 00.

@DjDeveloperr
DjDeveloperr merged commit 13dc5a7 into aurora-silicon:main Dec 3, 2026
28 checks passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s #3681 (c1fae1db7ecc) re-audit of saved gpubench-stress-vk life.fault JSONL with corrected GPUBench 7a0dfcf metric keys (faulter.faults_device_lost, faulter.faults_ignored): b1-head faulter.faults_device_lost=0, faulter.faults_ignored=96, errors=0, iterations=616075, g17row/failed/hist=1589; lockdep-head faulter.faults_device_lost=0, faulter.faults_ignored=98, errors=0, iterations=497475, g17row/failed/hist=1441 (a1-base/a2-base did not run stress). No check changes; PASS stands.

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) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants