Skip to content

drm/asahi: g17: allow direct publication for staged/compute-prefixed renders and drain reports after signal - #2769

Closed
DjDeveloperr wants to merge 2 commits into
mainfrom
perf/g17-direct-staged-and-reports
Closed

DjDeveloperr wants to merge 2 commits into
mainfrom
perf/g17-direct-staged-and-reports

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Summary

Two small, self-contained G17 runtime scheduling improvements (3 files, +70/-14) targeting host-side render-publication serialization and completion-to-kick latency on non-M5 G17 GPUs (G17P / G17S / G17C / G17D):

  1. drm/asahi: g17: allow direct render publication for compute-prefixed and staged renders (0a3ac24f1a53)
    • Resolves already-published compute prefixes (tiling_wait_through[1] and wait_through[1]) inside Firmware::lend_render() and extends Pair::own_dependencies() to collect render_tiling and tiling prefixes for staged renders, matching Registry::render_dependencies().
    • Removes the unconditional fallback from render_direct() to the global device mutex for compute-prefixed and staged renders. Unpublished compute prefixes still return EAGAIN (Ok(None)) and fall back cleanly to the device-mutex path; M5 continues to use the device-mutex path because its host-port transaction is part of publication.
  2. drm/asahi: g17: drain firmware telemetry reports after signaling completions on all G17 (2e05a592717c)
    • Drops the is_m5() gate around post-signal firmware.drain_reports() so trace/statistics ring draining and power-register reads always run after deferred.finish() signals DMA fences across all G17 parts.

Verification

Matched single-module A/B boot test on physical MacBook Neo (J700, Apple A18 Pro / T8140 / G17P B1) running neokit-7.3.0.n2607a with Borealis (Mesa 26.3.0-devel, git-d4ad4a4dce):

  • Arm A (baseline): aurora-base.ko built from 24dc422773c9b (sha256: 09c313dd52e0...)
  • Arm B (this PR): aurora-k4k5.ko built from 2e05a592717ce (sha256: 17f88b5bb3fa...)

Correctness & Stress (gpubench-stress-vk, 60 s budget per arm)

  • Both arms: 5/5 PASS (0 failures, 0 errors, 0 late frames) across xq.order, xq.chain, cr.concurrent, sync.dense, and render.first:
    • xq.chain: 136.5M verified checks on B-k4k5, max_chain_ms 12.26 -> 11.18 ms (-8.8%)
    • cr.concurrent: 88,723 checks, max_latency_ms 22.19 -> 18.40 ms (-17.1%)
    • sync.dense: 1,209 -> 1,230 rounds (+1.7%, 472,320 fences waited)
    • render.first: 77 -> 87 iterations (+13.0%), max_first_frame_ms 17.63 -> 17.04 ms
  • Kernel health: 0 GPU faults, 0 kernel BUG/WARN, 0 AVC denials, PMU 0xf701/0xf702 = 30 00 on every boot and clean restore to 7.3.0-41.fc44.aurora.aarch64.

gpubench-vk Pass-Overlap & Concurrent Compute/Render A/B (G17P B1, median us)

Benchmark Metric aurora-base.ko (24dc4227) aurora-k4k5.ko (2e05a592) Delta
overlap.passes kind=async_cr barrier_penalty_us 21.34 4.37 -79.5%
overlap.passes kind=async_cr barrier_us 987.65 945.63 -4.26%
overlap.passes kind=async_cr nobarrier_us 966.31 941.25 -2.59%
overlap.passes kind=render_render barrier_penalty_us 18.92 16.92 -10.6%
overlap.passes kind=render_render barrier_us 676.82 658.98 -2.64%
overlap.passes kind=render_render nobarrier_us 657.89 642.05 -2.41%
overlap.passes kind=comp_render barrier_penalty_us 17.28 15.87 -8.1%
overlap.passes kind=comp_comp barrier_us 1190.48 1190.48 0.00%
concurrent.cr mode=queues d=4 compute_alone_us 1286.17 1238.39 -3.72%
concurrent.cr mode=queues d=4 render_alone_us 657.89 631.91 -3.95%
concurrent.cr mode=queues d=4 compute_conc_us 1851.85 1785.71 -3.57%
concurrent.cr mode=queues d=4 render_conc_us 2116.40 2040.82 -3.57%

Assisted-by: LLM (Antigravity:Gemini 4 Neon)

…and staged renders

Resolve already-published compute prefixes while lending the render
pair in Firmware::lend_render() and extend Pair::own_dependencies() to
collect render_tiling and tiling prefixes for staged renders, matching
Registry::render_dependencies().

Previously render_direct() unconditionally fell back to the global
device mutex whenever a render carried a compute prefix or stage
prefixes, serializing host-side preparation and publication of
compute-to-render and staged render passes. Unpublished compute
prefixes still return EAGAIN and fall back cleanly to the device-mutex
path.

Signed-off-by: Diljit Singh <[email protected]>
…letions on all G17

Enable reports_after_signal() unconditionally across G17 so trace and
statistics ring draining and power-register reads run after
deferred.finish() signals DMA fences, reducing completion-to-kick
latency on non-M5 G17 parts as well.

Signed-off-by: Diljit Singh <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Read at 2e05a59.

Commit 1 looks right. lend_render() runs under the device mutex, so resolving the compute prefixes there (queue.dependency() with the current recovery state, EAGAIN falling back to the mutex path) reads the compute queue under the same lock the mutex path used. What is carried out of the lock is a dependency stamp, which a later retirement can only satisfy, and a recovery in between is caught by lease.is_current() before publication. Collecting render_tiling for staged renders in own_dependencies() matches Registry::render_dependencies().

Commit 2 needs a reason and a number. reports_after_signal() now returns true and drain_reports() runs after every signalled batch on every G17. The description says that includes power-register reads. On G17P this adds MMIO reads and ring walks to every completion's path, including idle-ish desktop work on the Neo, where it was skipped before. What does draining after the signal fix on non-M5 parts? If it's only the latency of telemetry, a cheaper trigger (drain when the report ring is non-empty, or on the existing timer) would keep the completion path as short as it was. Please add either the motivating case or a before/after on completion latency and idle package power/wakeups on the Neo.

Your stress rows cover correctness for both commits; the A/B numbers would be clearer per commit, since only commit 1 should change publication latency.

Assisted-by: LLM (Claude:Opus 5.5)

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: HOLD at 2e05a592.

Blockers: Resolve the base conflict against current main and reconcile render_direct() with merged #2955. The old branch still excludes all M5 by model, but main now has an M5 direct path. Preserve current host-port and recovery handling and use capability checks for any remaining restriction. The widened staged/compute-prefix path also needs the cross-pair protection tracked in #3301 or an equivalent check. Pair::own_dependencies() can only see the lent pair, whereas the registry path walks sibling pairs, including borrowed entries. Please exercise a single owner with a live sibling prefix in the staged path on a multi-pair part before landing.

Checked: Read both commits and compared the dependency collectors and newer direct-publication changes. The Neo receipt is useful for single-pair behavior. It cannot exercise sibling-pair ordering. Separate the telemetry change or show its effect on completion-to-kick latency and idle power, as previously requested. Remove the PR body attribution on the forward update.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@DjDeveloperr: stale-PR closeout. This is about 2.7k commits behind and conflicts with the #2955 M5 direct path. Everything that is open, in one list:

  1. Forward-merge, and reconcile render_direct() with drm/asahi: g17: enable M5 direct render submission and reduce direct submit/event lock overhead #2955: capability checks, no model exclusion.
  2. The cross-pair protection from drm/asahi: g17: refuse render_direct when a sibling pair holds prefix work #3301 for the staged/compute-prefix path, shown on a multi-pair part.
  3. Split out the report-drain change, or add its latency/idle-power numbers.
  4. Drop the Assisted-by trailer (org rule since 11-24).
  5. J700 and J714s rows at the new head.
    Do you still want to carry it? If we hear nothing in 24 h we close it, and it can be reopened after the rebase.

@github-actions

Copy link
Copy Markdown

Merge readiness at 2e05a592: not ready yet

Check Detail
CI at head ok 1 check passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 2e05a592, a Mac and a result in the PR body or a comment
Conflicts no merge conflicts with main: merge it in (no force push)
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:gpu

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

@RyanTheTide

Copy link
Copy Markdown
Contributor

@DjDeveloperr closing this as stale. The 11-29 consolidated list got no reply. Getting this onto current main is effectively a rewrite, since #3319 and #3443 now cover the publication path, and the widened staged/compute-prefix path still needs the cross-pair protection from that list. Reopen it, or open a fresh PR from main, whenever you want to pick it up again. The findings are all in the 11-29 comment above.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants