Repository navigation
drm/asahi: overlap cross-engine commands with timestamped producers on G17 - #2552
Conversation
7f9a3a2 to
9f50a76
Compare
|
No blockers. Checked
HW row: J716c (or any M5) on this head versus its base: Assisted-by: LLM (Claude:Opus 5.5) |
…n G17 Allow a G17 queue's render or compute command that writes no timestamps to overlap a cross-engine producer carrying host-written timestamps via firmware dependencies instead of stalling on the producer's host completion fence, while preserving ordered timestamp publication and deferred producer error propagation: - Use ordered host publication (`Publication`) for G17 compute commands as well as renders whenever the command writes timestamps or inherits host predecessors (dropping the `!compute &&` guard in `Completion::new`). Previously compute commands always used `HostOutput::Immediate`; using `Publication` lets overlapping cross-engine consumers chain completion and error propagation behind a timestamped compute producer and lets compute consumers chain behind earlier publications. A compute command with outputs and no predecessors clears its sentinel at activation and still publishes synchronously on finish with no extra delay. - Require host waits whenever a cross-engine consumer writes timestamps or accesses pending queries, and on the same engine for query-accessing compute and timestamp-writing renders behind an active publication chain (so a render's fragment-end window write cannot race with a transitive producer's host write or bypass an inherited error; timestamp-writing NO_QUERY_ACCESS compute chains publication on the same engine). - Chain host publication (`Publication`) across cross-engine and same-engine successors, keeping failed covered publications that survive frontier pruning (`status <= 0`) so a predecessor error arriving between pruning and link collection still propagates. - Extract `EnqueueOrdering::build()` and `HostOutput::new()` so the production ordering and publication selection logic are covered by KUnit tests for shared timestamp slots in both directions, transitive render window writes, post-prune predecessor failure propagation, standalone timestamped compute publishing immediately on finish, and timestamp-free compute chaining ordered publication behind a render. - Document DRM_ASAHI_COMPUTE_NO_QUERY_ACCESS by what the command touches: no timestamp or availability word whose host publication is still pending. A command may copy or reset queries whose words are already published. Signed-off-by: Erik Bourget <[email protected]>
9f50a76 to
086a909
Compare
|
Note 🤖 Gemini 4 Neon responding on behalf of erikwb Addressed both items and rebased onto
|
|
Re-checked at 086a909.
No new issues from the rebase or the
Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review of 086a909d against the pre-PR checklist.
Checklist summary
- Code / ordering logic: 0 blockers. Audited
HostOutput::new()(drivers/gpu/drm/asahi/g17/completion.rs:229-242),Completion::new()(completion.rs:486-503),Scheduler::enqueue()(job.rs:591-644),Queue::has_pending_publication()(queue/mod.rs:202-210),sourcesgating (queue/mod.rs:259-279),firmware_sourcegating (queue/mod.rs:575-579), andEnqueueOrdering::build()(queue/mod.rs:684-785) across all engine/timestamp/query_access/host_waitscombinations:- Compute commands with outputs and no predecessors clear the publication sentinel at activation and still publish synchronously in
finish()with no extra delay. - Same-engine
NO_QUERY_ACCESScompute chaining behind a render→compute publication chain remains safe for shared timestamp slots because compute timestamps are written on the host after the publication chain drains (and errors propagate through the chain). - Timestamp-writing renders host-wait on covered same-engine and cross-engine publications, preventing GPU fragment-end window writes from racing with deferred host publication or bypassing inherited errors.
- Keeping
status() <= 0covered publications handles predecessor failures arriving betweenprune_frontier()and predecessor collection, and!self.has_pending_publication()prevents exporting afirmware_sourcewhose completion could still be held or failed by an earlier publication. terminalfence still releases DRM scheduler credits independently of delayed host publication.
- Compute commands with outputs and no predecessors clear the publication sentinel at activation and still publish synchronously in
- §1–§4, §6 & CI: Pass — capability-gated via
host_producer_waits(), default cmdline, human author/committer + humanSigned-off-by:only, PR body carriesAssisted-by:, naming clean,host-testsgreen.
§5 Evidence owed before approval
No code, CI, or attribution blockers remain; only hardware/runtime evidence on current head 086a909d vs base 606d37ec is owed:
- J716c (M5):
dEQP-VK.query_pool.*anddEQP-VK.synchronization*.timeline_semaphore.*pass/fail counts unchanged, same-machine Cyberpunk 2077 T2 A/B on Borealis, and 0 GPU recoveries / 0 new kernel errors / 0 failed units / 0 SELinux denials. - One G17P Mac (M4 Pro or A18 Pro/Neo): same two dEQP groups with unchanged pass/fail counts and 0 GPU recoveries / 0 new kernel errors (
host_producer_waits()is false on non-M5 G17 too, and computeImmediate→Publicationapplies to all G17).
Assisted-by: LLM (Gemini 4 Neon)
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR review at 086a909dc8c6439ff59e7efc86c6b4691b12e1b9 (re-verified against live integration/aurora 70a00e583b03; formalizing the §5 hold from the earlier COMMENTED review): REQUEST_CHANGES.
Audit Summary (§1–§4, §6)
- Code correctness & ordering: 0 blockers. Audited
HostOutput::new()(drivers/gpu/drm/asahi/g17/completion.rs:229-242),Completion::new()(completion.rs:486-503),Scheduler::enqueue()(job.rs:591-644),Queue::has_pending_publication()(queue/mod.rs:202-210),sources/firmware_sourcegating (queue/mod.rs:259-279, 575-579), andEnqueueOrdering::build()(queue/mod.rs:684-785):- Standalone timestamped compute commands clear the sentinel at activation and still publish synchronously in
finish(). - Cross-engine timestamp writers and query-accessing compute retain host waits; same-engine query-accessing compute and timestamp-writing renders retain host waits behind active publication chains.
- Covered failed publications (
status() <= 0) are preserved across post-prune link collection, and!self.has_pending_publication()prevents exporting afirmware_sourcebehind an unresolved publication.
- Standalone timestamped compute commands clear the sentinel at activation and still publish synchronously in
- §1–§4, §6 & CI: PASS — not superseded on
integration/aurora,mergeable: clean,host-testsgreen, capability-gated viahost_producer_waits(), human author/committer + humanSigned-off-by:only, PR body carriesAssisted-by:, naming clean.
Blockers (§5 Evidence)
- Missing exact-head (
086a909dc8c6) hardware A/B, conformance, and regression evidence (still listed under## Still to runin the PR body):- J716c (M5) on
086a909dc8c6vs. base:dEQP-VK.query_pool.*anddEQP-VK.synchronization*.timeline_semaphore.*pass/fail counts unchanged, same-machine Cyberpunk 2077 T2 A/B fps on Borealis, and0 GPU recoveries, 0 SELinux denials, 0 failed units, 0 new kernel errors. - One G17P Mac (M4 Pro or A18 Pro/Neo): same two
dEQP-VKgroups with unchanged pass/fail counts and0 GPU recoveries, 0 new kernel errors(host_producer_waits()is false on G17P,DRM_ASAHI_FEATURE_COMPUTE_NO_QUERY_ACCESSis now advertised on G17P onintegration/aurora, and computeImmediate->Publicationapplies to all G17).
- J716c (M5) on
Assisted-by: LLM (Gemini 4 Neon)
|
Note 🤖 Claude Sonnet 5.5 responding on behalf of erikwb @DjDeveloperr @RyanTheTide, the J716c A/B you asked for is done and recorded under
What is left is the G17P regression check ( |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Checked cross-engine timestamped producer overlap on G17, clean commit history, green host-tests CI, and the J716c A/B verification row. No blocking findings.
Commit 4fa08b4 ("soc: apple: mailbox: drain G17 receive interrupts in hard IRQ") moved the ASCWrap v6 GPU receive path out of the oneshot IRQ thread: normal completions are now drained in hard IRQ, and the thread runs only when the receive budget saturates. The thread was doing more than adding a wakeup. It is an RT task, so while it runs schedutil raises its CPU cluster to the top frequency, and the G17 driver steers that through apple_mbox_set_rx_util_min(): Port::rx_update() keeps the RT default for host-bound streams and lowers it only while the GPU is the bottleneck. Since 4fa08b4 the completion of every light submission runs without that boost, from whichever CPU takes the interrupt. On the MacBook Neo (J700, A18 Pro) gpubench-vk compute.light regressed with that commit alone. Built on its own parent with only its merge reverted, 6 reps each: row with reverted 7.3.0-41 compute.light queue/d2 (us) 52.3 35.3 35.5 submit CPU (us) 12.0 9.6 9.7 latency (us) 110 64 64 reps that lose the overlap 6/6 0/6 0/6 compute.light queue/d1 (us) 106.0 102.1 102.3 render.light queue/d1 (us) 137.8 122.1 127.0 Bisected on J700 from 7.3.0-41 (6f618bc, rebuilt with the same toolchain and config as every other point) to 7c9d9ad: the regression first appears in 3989d21..19ae312, and reverting merge 99ebf93 (aurora-silicon#2980) alone removes it, while reverting aurora-silicon#3015 alone, or aurora-silicon#2552, aurora-silicon#2553 and aurora-silicon#2207 together, or aurora-silicon#2520, aurora-silicon#3010 and aurora-silicon#915 together, does not. Restore the threaded receive handler for ASCWrap v6 G17 mailboxes. Keep that commit's exclusion of ASCWrap v8 (T8152) from apple_mbox_is_g17(), so the T8152 GPU mailbox stays on apple_mbox_recv_irq() with its storm guard as it is now, and keep a KUnit case for that exclusion. With "drm/asahi: g17: keep G17P work nodes and compute descriptors firmware-cached" on origin/main 16da002, a one-shot J700 boot gives compute.light d2 34.5 us (submit CPU 9.5 us, 0/9 reps losing the overlap), d1 104.1 us, render.light d1 124.9 us; the multi_queue CTS family 4266/0 three times, compute CRCs 5/5, Geekbench 6 Vulkan 8/8, and no GPU fault, WARN or AVC. Signed-off-by: Diljit Singh <[email protected]>
Problem
On G17 GPUs, a render or compute command that writes no timestamps still stalls on a cross-engine producer's host completion fence whenever that producer carries host-written timestamps, even when the consumer does not access pending query words (pairs with aurora-silicon/mesa#578).
Change
Allow a G17 queue's render or compute command that writes no timestamps (and for compute, sets
DRM_ASAHI_COMPUTE_NO_QUERY_ACCESS) to overlap a cross-engine producer carrying host-written timestamps via firmware dependencies on the producer'sscheduledfence instead of stalling on its host completion fence, while preserving ordered timestamp publication and deferred producer error propagation. Applies across G17 backends wherehost_producer_waits()is false (M5 withg17d_forms/completion_inputs, G17P).Publicationfor G17 compute: Drop the!compute &&guard inCompletion::new(viaHostOutput::new) so compute commands with timestamps or host predecessors use an orderedPublicationinstead ofHostOutputKind::Immediate. This lets overlapping cross-engine consumers chain completion and error propagation behind a timestamped compute producer and lets compute consumers chain behind earlier publications. A compute command with outputs and no predecessors clears its sentinel at activation and still publishes synchronously onfinish()with no extra delay.Publicationacross cross-engine and same-engine successors, keeping failed covered publications that survive frontier pruning (status() <= 0) so a predecessor error arriving between pruning and link collection still propagates.DRM_ASAHI_COMPUTE_NO_QUERY_ACCESSby the words a command touches (no timestamp or availability word whose host publication is still pending; queries whose words are already published may still be copied or reset).EnqueueOrdering::build()andHostOutput::new()with KUnit coverage for shared timestamp slots in both cross-engine directions, transitive render fragment-end window waits, post-prune predecessor failure propagation, standalone timestamped compute publishing immediately onfinish(), and timestamp-freeNO_QUERY_ACCESScompute chaining ordered publication behind a timestamped render.Testing
Verified on head
086a909dc8c6(rebased ontointegration/aurora606d37ec77a5; merges cleanly onto275d59d3bc82):host-tests: 452/452 passed.drivers/gpu/drm/asahi/.kunitconfig,asahi_*): 340 tests ran — 339 passed, 1 pre-existing skip (j713_accepts_all_loaded_images), 0 failed:asahi_g17_cross_engine_timestamps: 5/5 passedasahi_g17_publication_order: 1/1 passedasahi_g17_timestamp_window: 2/2 passedCONFIG_KUNIT=nbuild (ARCH=arm64 LLVM=1 drivers/gpu/drm/asahi/): built cleanly with 0 new warnings.tools/asahi/run-host-tests.py):g1790/90 passed,asahi-m41/1 passed (full suite: 450/452 passed; 2 pre-existing unrelated failures inapple-dcpandpmp-floor-testson host GCC).J716c (M5 Max) same-machine A/B on
27.2 (26B123)firmwareBoth arms compose
integration/aurora(275d59d3bc82) +#2185(d8ad1c90969e) +#2187(a56f2a5df8db) +#2207(80220ba4d402) (trial tip58bd01fd8d15), soBoard::completion_inputs()is on (host_producer_waits() == false) and firmware cross-engine waits are active on both. They differ only in#2552(086a909dc8c6, applied unchanged on arm B: identicalgit patch-id; trial tipe53b8da4512e). Same arm64 kernel config (LLVM=1,clang23.1.4), same Borealis builds, same machine, default kernel command line via one-shotaura-try, 140 W AC,performancegovernor. Both arms used the byte-identical#2208DTB (37fee82e714e) with J716c fan control and hotspot monitoring enabled so the fans could be held at their maximum (5,349 and 5,777 RPM); the kernel code on the two arms differs only by#2552. Each arm reportedDRM_ASAHI_FEATURE_COMPUTE_NO_QUERY_ACCESS=1andDRM_ASAHI_FEATURE_COMPUTE_VISIBLE_COMPLETION=1(features=0x13e7cfe7c07).#2207only,58bd01fd8d15)#2207+#2552,e53b8da4512e)dEQP-VK.synchronization*.op.multi_queue.timeline_semaphore.*(8,538 cases)dEQP-VK.query_pool.*(18,270 cases)dEQP-VK.compute.*(5,000 sampled cases)2560x1600, Borealislibvulkan_asahi.sosha256d73d401491d22c7a51279ade2bec791bf525484413d400fc9f9a09c03266b877), FPS per run (c0,w1,w2)dmesgGPU, MMU or recovery linesaurora-peripherals.service(also fails on the default kernel)journalctl -k -b -p err..emerg)CTS counts are identical on both arms. Cyberpunk T2 mean FPS differs by -0.11 (-0.3%), inside the run-to-run spread (
31.51-33.91on arm A), so no performance change shows on this title. The first T2 run on each arm followed a fresh boot; arm B'sw1/w2were separated by 4-minute pauses and arm A's ran back to back, and neither arm showed any power-brake clamp.Still to run
086a909dc8c6(M4 Pro or A18 Pro / Neo; shared G17 submission and computePublicationpath, wherehost_producer_waits()is alreadyfalse):dEQP-VK.query_pool.*anddEQP-VK.synchronization*.timeline_semaphore.*pass/fail counts unchanged