Repository navigation
drm/asahi: g16: drop redundant same-VM TA barriers and lower compute fan-out threshold to 140 us - #3483
Conversation
g16 posts a barrier on TA(N-1)'s stamp ahead of every pipelined TA whose plan does not already wait on the previous FS. Every render's TA work goes on the one firmware TA queue, whose works the firmware runs in ring order: macOS posts no barriers on that ring at all, and in our J773g captures of Metal running the postfx and bindless-UBO tests each pass's tiling still starts after the previous pass's tiling has ended. For a predecessor of the same VM, which shares the render's parameter buffer and UMA slot only through that order, the barrier re-checks a stamp the ring implies, and the firmware can hold the new record on it until a later event. Post it only when the ring's order does not cover it: behind another VM's render, and whenever this render or a live flight carries InitBM. Folded members always belong to the first member's VM, so only the first member can follow another VM's render. The stats file counts the barriers posted and the ones left to ring order. The publication selftest covers the decision, and checks that it is taken after every InitBM producer is known. Signed-off-by: DjDeveloperr <hey@djdev.me>
Barrier-free compute of one queue stays on its pipe, where the horizon fold can merge it, until the queue counts as heavy and fans out across two pipes. A queue is heavy when its retired CDM time EWMA reaches COMPUTE_HEAVY_EMA_US (200 us), or when a sole single-command flight of it has run for COMPUTE_HEAVY_INFLIGHT_NS (180 us). A stream of ~185 us dispatches sits between the two limits. The in-flight probe promotes it while one of its flights runs alone on a pipe, but stops applying once a second flight shares that pipe, and the EWMA stays under 200 us, so the queue drops back to one pipe and serializes. Whether such a stream fans out depends on submit timing. Use one crossover for both decisions and put it at 140 us. Dispatches of that size clear it with room to get faster, while light dispatches, a few tens of microseconds each, still stay on one pipe and fold. The publication selftest now takes both limits from hw.rs and checks the probe and EWMA boundaries at 140 us. Signed-off-by: DjDeveloperr <hey@djdev.me>
Stage `ta_prev` and `ta_order` counts on `Prefix` during `prefix_render` and commit them to `self.engine.stats` only after `publish_producer` publishes the TA producer index, so an unpublished prefix rejected by `recovery_pending()` (-EAGAIN) or an earlier publication error never advances the barrier counters. Also update `test-publication.py` to cover the -EAGAIN and TA-publication failure paths and record the actual passed test count in `publication.json`. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: FINISH, then merge at 766141ca
Blockers:
- Missing second-generation G15 (
T6030/T8122) hardware row and exact-head J773g smoke on766141ca(as listed under "Not yet"). - Wait for the 19 queued CI checks and rerun the 2 cancelled checks so CI is green at head.
Checked:
drivers/gpu/drm/asahi/g16/engine.rs: verifiedta_ring_orders_prev(cross_vm_prev, producer_initbm)elides the TA->TAprev_barrieronly for consecutive same-VM renders with noInitBMproducer/consumer, while preserving cross-VM andInitBMbarriers and stagingta_prev/ta_orderstats onPrefixso they commit only afterpublish_producersucceeds.drivers/gpu/drm/asahi/g16/hw.rs:1298-1306: verifiedCOMPUTE_HEAVY_EMA_US = 140andCOMPUTE_HEAVY_INFLIGHT_NS = COMPUTE_HEAVY_EMA_US as u64 * 1000unify the probe and EWMA crossover cleanly.tools/testing/selftests/drivers/gpu/asahi-m4/test-publication.py: verified 91/91 tests cover ring ordering,-EAGAIN/TA-failure stat staging, and the 140 us crossover.- Verified J773g M4 ABBA results (
compute.uber uniform d4-5.1%,render.postfx msaa=4-2.1%, 88/88 exact CRCs, 0 GPU faults).
Evidence
- Diff reviewed at
766141ca(4 files, 386 lines). - Code is clean; ready for approval once the G15 row, exact-head smoke, and green CI land.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict at 766141ca428d55cd83c4f1a341a3c6d6116d0729
CODE-CLEAR. The TA counters now advance when firmware can see the new TA producer. Retrying a prefix rejected before that write leaves both totals intact.
Blockers
The earlier J773g result covers the tree before the counter fix. Merge requires a J773g run at this head and one G15 run on T6030 or T8122 with the 26B123 handoff selecting this backend. Exercise consecutive same-VM render passes and barrier-free compute, and report output checks, counter deltas and GPU faults or recoveries.
Checked
The omitted TA barrier and its ring-head advance are paired. Cross-VM and InitBM paths retain the wait. The fragment wait on its own TA, compute dependencies, producer write barriers and retirement cursors stay in place. Both the TA optimization and the 140 µs compute threshold reach G15 and G16 through the same backend.
Evidence
All 26 M4 host test scripts passed locally. The publication harness reported 91 passed and its JSON agreed. Its new test covers recovery before publication, a failed TA producer write, and a successful write. The clean merge into 55184f00a33d produced tree 3f6069024e08, matching GitHub. Strict checkpatch on the three formatted commits reported one warning about a long commit-message line in 766141ca428d, with zero errors and zero checks.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
satchlj
left a comment
There was a problem hiding this comment.
Code review PASS at 766141ca42.
Verified:
ta_ring_orders_prev(cross_vm_prev, producer_initbm)conservatively preserves the explicit TA->TAprev_barrierfor cross-VM predecessors and any InitBM producer/consumer, dropping it only for same-VM non-InitBM renders already serialized by the single firmware TA ring.- Decision runs after
producer_initbmis finalized, andta_prev/ta_orderstats are staged onPrefixand committed only on TA publication. - Lowering
COMPUTE_HEAVY_EMA_USto140and tyingCOMPUTE_HEAVY_INFLIGHT_NS = COMPUTE_HEAVY_EMA_US * 1000keeps the probe/EWMA crossover aligned. Signed-off-bypresent.
|
J516s (MacBook Pro 16" M3 Pro, T6030, G15S) row at
|
|
Merge-train note: this conflicts with main. Per Dj (relayed by ORCH5 23:01), the G16 order is #3483 -> #3499 -> #3503, and Dj's combined resolution applies cleanly on main 6c869fd; it must keep main's removal of the old TA-wave constants. Please push that resolution here (normal push). It then needs the App review at the new head and CI, and a J773g smoke at that head. The ABBA rows carry over if the wire changes are unchanged. |
Keep the removed TA-wave constants out of the publication fixture and read the compute-heavy thresholds from the production definitions. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: HOLD at 139d9f3b pending hosted checks and forward-merge hardware evidence.
Blockers: Provide current-head J773g/G16 and J516s/G15 verification or a source-equivalence receipt for the earlier runs. Keep #3483 ahead of #3499 and #3503.
Checked: The forward merge retains the removal of the old TA-wave constants. The barrier stays in place across VMs or when InitBM is involved. The TA counters are still published only after the producer update succeeds. Both compute thresholds still use the same 140 µs crossover. The earlier J773g and J516s runs cover both GPU families at the prior head.
Evidence
Checked the driver hunks on the forward merge onto 6c869fdf, and the J773g and J516s results at 766141ca.
Preserve shared compute UMA prefix accounting alongside TA ordering and carry the checked publication host fixture. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: HOLD at bfa0e654 pending hosted and hardware checks.
Checked: The forward merge's parents are the previously reviewed head and main at af1413dd. The PR still changes only G16 engine, hardware constants and polling plus the publication host fixture. The current diff preserves cross-VM and InitBM waits, records the TA counters after producer publication, keeps the 140 us crossover, and does not restore the old TA-wave constants.
Blockers: Fresh hosted CI and the requested J773g and J516s receipts remain. The linked older J516s run predates the newer base, and I found no row for this head. Keep the landing order #3483, #3499, then #3503.
|
Hardware rows at head
That covers the second-generation G15 row this PR was waiting on. |
There was a problem hiding this comment.
Verdict: MERGE at bfa0e654ff42
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: The forward merge's parents are the previously reviewed head and main at af1413dd. The PR still changes only G16 engine, hardware constants and polling plus the publication host fixture. The current diff preserves cross-VM and InitBM waits, records the TA counters after producer publication, keeps the 140 us crossover, and does not restore the old TA-wave constants.
Follow-ups (not blocking): fresh hosted CI, J773g/J516s receipts; landing order #3483, #3499, #3503
Keep both ring ordering predicates and counters, and commit the counts only after TA producer publication. Exercise both counters in the publication harness. Signed-off-by: DjDeveloperr <hey@djdev.me>
DjDeveloperr
left a comment
There was a problem hiding this comment.
No code blockers at ba4bc3220354. Main’s old TA-wave constants remain absent. The TA change preserves #3499’s FS decision. Each planned same-ring wait increments exactly one counter for its ring. Cross-VM and InitBM waits, the paired TA→FS barrier, and compute↔render dependencies remain intact in the shared G15S/G16G path.
All 91 publication tests passed, including both 140 µs compute boundaries. Recovery EAGAIN and a failed TA producer write leave all four counters unchanged. The suite omits one partial-publication case. I injected an FS write failure after a successful TA write in the host harness and confirmed all four counts stayed committed exactly once.
A peer maintainer can approve the code. Hosted CI is pending. The latest posted J773g smoke is on the previous head, bfa0e654ff42.
|
J773g (M4 mini, G16G B0) hardware row at One-shot boot of |
|
J516s (M3 Pro, T6030, G15S B1) second-generation GPU smoke at One-shot boot of Both GPUBench Vulkan passes matched all 10 pinned CRCs for Stock |
RyanTheTide
left a comment
There was a problem hiding this comment.
Approve at ba4bc32 under the merge bar. G16 perf change with two-generation exact-head rows (J773g M4 mini and J516s M3 Pro: 10/10 pinned CRCs, SLC intact, 0 GPU faults), an independent review, host selftests 26/26 and no failing checks.
Bring in main up to 1b2c361. engine.rs: keep main's compute UMA slot conflict (compute_uma_conflict and Flight::compute_uma_mask) in needs_engine_drain(). Keep the TA and FS ring order of #3483 and #3499: same-VM TA->TA and FS->FS barriers are still left to the rings and counted. With every render of another VM drained first, the predecessor on the rings is always of the same VM, so the cross_vm_prev input of ta_ring_orders_prev() and fs_ring_orders_prev() goes away. Main's multisampling rule stays covered: this branch already replaces it with the wider cross-VM drain. test-publication.py: keep main's compute UMA, ring-order and TA producer stats tests on the new signatures. Drop the multisampling fold and VM-mark tests, whose code this branch removes. Signed-off-by: DjDeveloperr <hey@djdev.me>
…r-pairs-on-3201 Bring in #3370's branch, which now carries #3353's branch and main up to 1b2c361. Main changed the one render graph that this series splits into pairs. Each pair now takes main's layout: its FS fw_stamp comes from the firmware-cached ring allocator, it has its own ASC-cached FS notifier page, and the shared scheduling context, now allocated in Graphs::finish(), is handed to every pair there. Pair 0 keeps the allocation order, and later pairs share its legacy_empty and registration barrier as before. Retirement keeps main's model per pair: the uncached TA and FS service stamps gate it, the recovery-suspect path falls back to the stage fw_stamps, and the notifier records are never read. The pair's own targets and the latched per-flight TA/FS channel receipts of this series take the place of main's single-pair queue_passed() and queue_receipt(). Progress, the recovery snapshot and the report read each pair's FS user_stamp[1], as main does for its one pair. Render barriers: behind a render on another pair, the stage-order waits on that pair's fw_stamps are always posted. Behind a render on this pair, which is always of the same VM, the TA->TA and FS->FS barriers are left to the ring's order as in #3483 and #3499, and counted. The counters still commit only on TA producer publication, now on the pair's queues. needs_engine_drain() keeps main's compute UMA slot conflict. Selftests: the mocks index render pairs and read the service stamps. This series' pair tests now set the service stamps instead of the notifier, and main's tests carry the pair fields. Signed-off-by: DjDeveloperr <hey@djdev.me>
What
Two independent
g16performance improvements based cleanly onmain(ff59991a6c98):480d4b59d5dd, counter staging fix766141ca428d): Elide the redundant TA->TAprev_barrier(op 4 onTA(N-1)fw_stamp) for consecutive same-VM renders, keeping the barrier across different VMs or wheneverInitBMis involved. Stageta_prevandta_ordercounts onPrefixand commit them toself.engine.statsonly afterpublish_producersucceeds on the TA ring so an unpublished-EAGAINprefix cannot skew stats.140 us(af6c6e4423f5): Unify the compute EMA and in-flight probe fan-out crossover at140 us(down from200 us/180 us) so ~180–185 us compute dispatches (compute.uber uniform d4) remain fanned out across pipes instead of serializing onto one pipe.Tested
766141ca428d55cd83c4f1a341a3c6d6116d0729):scripts/checkpatch.pl --strict:0/0/0on480d4b59d5ddandaf6c6e4423f5;0 errors / 1 warning / 0 checkson766141ca428d(commit message line wrap; code diff0/0/0).tools/testing/selftests/drivers/gpu/asahi-m4/test-*.py: 26/26 pass (test-publication.py: 91 passed, 0 failed, including-EAGAINand TA-producer-failure counter staging tests and dynamicpublication.jsoncount).drivers/gpu/drm/asahi/compiles cleanly with 0 errors and no new warnings.T8132/G16G B0) exact-head smoke at766141ca428d55cd83c4f1a341a3c6d6116d0729(7.3.0-ARCH-m4kgpr3483-766141ca, module build IDbc7b4e262d493a6c82a531d5661f7f83fb03b795, SLC ON 2 planes, 0 GPU faults/recoveries/hang kills/quarantine,gpubench-vk ae90a40, Mesa90211df6816):compute.uber uniform d4:177.94 us(b022fbaf);render.postfx msaa=4 d1/d2:775.19 / 714.29 us(668d6f0a);render.bindless_ubo 512 d2:165.02 us(1af53d5c);render.deferred tile msaa=4 d2:348.43 us(6dc74b48).ta_prev(barriers, ring_ordered):(7, 0) -> (7, 56135)(delta+0barriers /+56,135ring-ordered).mainff59991a6c98vsf1dfa4fe1428prior to the zero-wire-change counter-staging delta766141ca428d; 4 fresh boots x 2 passes, 120 timed rows, 88/88 exact CRCs, SLC ON 2 planes, 0 faults/recoveries/hang kills/quarantine):compute.uber uniform d4: -5.16% / -5.09% (187.6/187.4 -> 177.9/177.9 us, CRCb022fbaf)render.postfx msaa=4 d1: -2.79% / -1.50% (807.8/803.9 -> 785.3/791.8 us, CRC668d6f0a)render.postfx msaa=4 d2: -2.15% / -1.44% (730.0/731.0 -> 714.3/720.5 us, CRC668d6f0a)render.bindless_ubo 512 d2: -1.55% / -1.58% (166.4/167.6 -> 163.8/164.9 us, CRC1af53d5c)ta_prev.ring_orderedadvanced+86,709/+84,482(B1) and+85,488/+84,338(B2),barrierdelta+0.Full J773g ABBA table (120 timed rows, 88/88 exact CRCs)
compute.uber uniformd4b022fbafrender.postfx msaa=4d1668d6f0arender.postfx msaa=4d2668d6f0arender.bindless_ubo 512d21af53d5crender.bindless_ubo 512d11af53d5crender.mdi 1024d4f69c5f55render.deferred tile msaa=4d26dc74b48compute.light procsd4/d8/d16compute.light queued64Risk
Two-way door (low risk): both changes are self-contained inside
drivers/gpu/drm/asahi/g16/and cleanly revertible without UAPI or on-disk impact. Cross-VM renders and any live/pendingInitBMproducer or consumer retain the explicit TA->TAprev_barrier, and all FS/compute barriers are unchanged. Lowering the compute fan-out threshold from180–200 usto140 usonly widens the existing multi-pipe compute fan-out path already exercised for heavier compute workloads;compute.lightrows stayed flat to slightly faster. Both changes touch sharedg16paths bound on T8132 (G16) and T6030/T8122 (G15).Not yet
T6030/T8122) hardware verification row prior to merge.