Skip to content

drm/asahi: accept FRAGMENT_BARRIERS on G13 and G14 - #2637

Closed
RyanTheTide wants to merge 1 commit into
integration/aurorafrom
gpuperf/legacy-fragment-barriers-rebase-20261121
Closed

RyanTheTide wants to merge 1 commit into
integration/aurorafrom
gpuperf/legacy-fragment-barriers-rebase-20261121

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Replaces #1811, rebased onto current integration/aurora (conflicts in drivers/gpu/drm/asahi/queue/render.rs: the base moved the render flag and size checks from submit_render() into get_tiling_params(), so FRAGMENT_BARRIERS is added to the accepted flags there. Only the net commit 6a743fa is carried; the two cpufreq commits and their reverts cancel out and are dropped).

G13/G14: the legacy queue puts a render's wait for earlier renders on its vertex (tiling) queue, so the tiling of render N+1 cannot start before the fragment work of render N has finished, even when only the fragment half of N+1 depends on it.

This advertises the existing DRM_ASAHI_FEATURE_FRAGMENT_BARRIERS on the G13/G14 backend. For a render with DRM_ASAHI_RENDER_FRAGMENT_BARRIERS, the wait named by vdm_barrier only refers to earlier fragment work of the same queue (index 0 is the queue's last fragment event, later indices are renders of the same submission). The fragment workqueue already runs that work first, so no barrier is added. Each fragment half still waits for its own vertex half, and compute dependencies keep ordering the vertex half. Renders without the flag are unchanged.

Userspace: mesa Borealis sets the flag on serialized G13/G14 queues only when the recorded dependencies show the vertex half reads nothing an earlier render produced (aurora-silicon/mesa#265).

Results (gpubench 0dae261, us per submission, lower is better; same boot, Mesa with the flag off vs on, two interleaved runs each, which agree within 1%):

row M1 Pro (G13X) off -> on M2 (G14G) off -> on
render.heavy geom 1080p d16 339 -> 162 553 -> 294
render.tvb 32k tris d4 3378 -> 2049 5102 -> 2717
render.heavy fill 720p d16 210 -> 139 315 -> 256
render.heavy fill 1080p d16 391 -> 312 643 -> 577
render.light tri d16 49.9 -> 46.0 62.7 -> 56.0
depth-1 rows, compute.light, compute.heavy unchanged unchanged

Vulkan CTS 1.4.7.0: a 2,402-case render-ordering subset (synchronization2 graphics write -> vertex/fragment/indirect reads, pipeline barriers, transform feedback, renderpass2 suballocation, occlusion queries) is case-for-case identical with the flag off and on, on both Macs (833 Pass / 1569 NotSupported / 0 Fail). On the M2 a 46,515-case broad run (api, query_pool, synchronization, synchronization2, ubo, glsl, texture, graphicsfuzz, ssbo, transform_feedback.simple, draw indirect) is also case-for-case identical (20947 Pass / 25564 NotSupported / 4 QualityWarning in both / 0 Fail).
vkmark: M1 Pro 10463 -> 10492, M2 8541 -> 8641. 0 AVC denials, no GPU faults or timeouts.

Rebased onto integration/aurora c3d01cb (2026-11-21): drivers/gpu/drm/asahi/ builds for arm64 (LLVM=1, W=1, defconfig + asahi.config) with no warnings in the touched files; KUnit asahi* on arm64 qemu 323/324 passed (1 unrelated skip), including asahi_render_tiling_params 4/4; run-host-tests.py --only legacy-frequency 1/1, agx-stats-busy 2/2, asahi-stats-raw 1/1; checkpatch.pl --strict clean.

Assisted-by: LLM (Claude:Opus 5.5)

The legacy queue puts a render's wait for earlier renders on its vertex
queue, so the tiling of render N+1 cannot start until the fragment work
of render N has finished, even when only the fragment half of N+1
depends on it.

Advertise DRM_ASAHI_FEATURE_FRAGMENT_BARRIERS on the G13/G14 backend.
For a render carrying DRM_ASAHI_RENDER_FRAGMENT_BARRIERS that wait names
only earlier fragment work of the same queue, which its fragment
workqueue already runs first, so no barrier is added at all. The
fragment half still waits for its own vertex half, and compute
dependencies keep ordering the vertex half.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Looks good; approve once the soak row below is posted.

I checked the barrier handling in drivers/gpu/drm/asahi/queue/mod.rs at 7450be6. events[SQ_RENDER][0] is this queue's own q_frag event (mod.rs:1125-1128), and later entries are renders of the same submission. That means that with FRAGMENT_BARRIERS set, the dropped wait only names fragment work that the in-order fragment workqueue already runs first. The barrier index is still validated before the continue at mod.rs:1252-1258. Compute (cdm_barrier) waits still go on the vertex queue, and renders without the flag still get the same vertex-queue barrier, now added after the command is parsed.

  1. mod.rs:1240-1244: the comment says that with DRM_ASAHI_RENDER_FRAGMENT_BARRIERS the wait "goes on the fragment queue", but the code at mod.rs:1299-1306 drops it entirely, as the second comment says. Fix the first comment so it describes what the code does.
  2. Nit: the barrier construction at mod.rs:1306-1328 duplicates mod.rs:1262-1285 field for field. A small helper taking (queue_job, event) would keep the two copies from drifting apart.

The commit message carries an Assisted-by: LLM trailer; noted only.

HW row: M1 Pro (G13S) and M2 (G14G), this kernel with Mesa setting the flag. Run at least 1 h of concurrent short-lived multi-context rendering, e.g. several deqp-vk render-ordering and gpubench render.heavy processes in parallel. Pass if there are 0 GPU faults, firmware crashes or timeouts, and the regression run shows 0 AVC denials, 0 failed units and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merge-train adversarial review (MERGETRAIN-LINUX2) at 7450be6: BLOCKERS.

Not merging until the blockers below are fixed or answered; the details give file:line and a failure case.

Full review

#2637 drm/asahi: accept FRAGMENT_BARRIERS on G13 and G14 @7450be6a

VERDICT: BLOCKERS

Blockers

  1. Commit hygiene: 7450be6 carries an Assisted-by: LLM trailer in the commit message. Our rule is human-only commit trailers (Assisted-by belongs as the last line of the PR body only). Reword the commit to drop it; Signed-off-by: Ryan Murray stays.

Code checks

  • queue/mod.rs:1125-1128: index 0 is the queue's own q_frag event. mod.rs:1342-1350: later SQ_RENDER entries are this submission's fragment events. So dropping the vertex barrier when the flag is set (mod.rs:1299-1306) only removes a wait on in-order fragment work. That matches uapi asahi_drm.h:1620-1634.
  • The barrier index is still validated before the continue (mod.rs:1252-1258).
  • cdm_barrier still goes on the vertex queue.
  • Renders without the flag still get the vertex barrier, now added after the render command is parsed but still before submit_render.
  • render.rs:55-59 accepts the flag.
  • backend_feature_flags applies only to #[versions(AGX)] = G13, G14 and G14X (rust/macros/versions.rs:95). G15/G16/G17 override feature_flags themselves.

Nits

  • mod.rs:1240-1244: the comment still says the wait "goes on the fragment queue", but the code drops it. The reviewer raised this on 11-21 and the head is unchanged.
  • mod.rs:1306-1328 duplicates the barrier construction at 1262-1285 field for field. Factor it into a helper.
  • Advertising also reaches G14X (M2 Pro/Max), which is not in the title or rows.

Missing rows

  • The 1 h concurrent multi-context soak the reviewer asked for on M1 Pro (G13S) and M2 (G14G) is not posted. This change adds vertex/fragment overlap on G13, where the known G13S TE/fw-crash trigger is short-lived contexts rendering concurrently (memory note g13s-te-fault). The rows need 0 GPU faults, firmware crashes and timeouts, plus regression counts (AVC, failed units, new kernel errors).
  • No rows for M1 base (G13G), M1 Max/Ultra (G13C/D) or M2 Pro/Max (G14X).
  • The perf and CTS rows predate the rebase onto c3d01cb. No hardware row at 7450be6 itself.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Clarification to my merge-train review above: the commit-trailer point is a nit, not a blocker (already-pushed history stays as it is, no force push). The other blockers listed there still stand.

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

Pre-PR checklist review (§1–§6) at 7450be6a5aa3: REQUEST_CHANGES.

Blockers

  1. §4 Attribution (hard): Commit 7450be6a5aa3 carries an Assisted-by: LLM trailer in the commit message. Per §4, commits must carry human author/committer and human Signed-off-by: only, with zero Co-Authored-By: or Assisted-by: trailers in commits (Assisted-by: belongs only at the end of the PR body).
  2. §5 Evidence & §1 multi-Mac proof (missing rows):
    • All posted gpubench / Vulkan CTS / vkmark rows predate the rebase onto integration/aurora c3d01cbd; no hardware run is posted at the live head 7450be6a5aa3.
    • Missing the requested >= 1 h concurrent short-lived multi-context soak on M1 Pro (G13S) and M2 (G14G) with 0 GPU faults, firmware crashes, or timeouts, plus complete §5 regression counts (0 AVC denials, 0 failed units, 0 new kernel errors — the PR body omits failed-unit and new-kernel-error counts).
    • #[versions(AGX)] (rust/macros/versions.rs:95) also advertises DRM_ASAHI_FEATURE_FRAGMENT_BARRIERS on G14X (M2 Pro/Max), which is not mentioned in the title/commit message and has no hardware row (nor do M1 base G13G / M1 Max/Ultra G13C/D).

Verified code & checks

  • drivers/gpu/drm/asahi/gpu.rs:388-394,1550-1552: backend_feature_flags() defaults to 0 and is overridden only on #[versions(AGX)] impl Gpu for GpuManager::ver; m3/g15 override feature_flags(), and g16/g17/g18/m5 inherit 0.
  • drivers/gpu/drm/asahi/queue/render.rs:54-60: DRM_ASAHI_RENDER_FRAGMENT_BARRIERS is validated in get_tiling_params(), covering both the TVB pre-pass and submit_render().
  • drivers/gpu/drm/asahi/queue/mod.rs:1245-1353: events[SQ_RENDER][0] is the queue's prior q_frag event (mod.rs:1125-1128) and subsequent entries are this submission's fragment events (mod.rs:1342-1353); invalid vdm_barrier indices still fail with EINVAL before deferring render_wait; cdm_barrier still attaches to job.get_vtx()?; non-FRAGMENT_BARRIERS renders still emit the vertex barrier before submit_render(); FRAGMENT_BARRIERS renders rely on in-order q_frag execution plus each render's own vertex->fragment barrier (render.rs:343-361).
  • CI: host-tests is green on 7450be6a5aa3 (local arm64 LLVM=1 W=1 build and KUnit 323/324 reported in PR body).

Nits

  • drivers/gpu/drm/asahi/queue/mod.rs:1240-1244: the comment still says the wait "goes on the fragment queue", contradicting lines 1299–1302 and the code, which drops the explicit barrier entirely.
  • drivers/gpu/drm/asahi/queue/mod.rs:1306-1329: duplicates the explicit barrier allocation/init/add block from lines 1260–1285 verbatim; factoring a small helper avoids drift.
  • Update title/commit message to reflect G14X coverage as well as G13/G14.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #2785: one clean commit on integration/aurora f5f023b (human identity + Signed-off-by only), title/commit now name G14X, the stale comment is fixed and the duplicated barrier block is one helper. Builds clean with W=1. Rows at the new head (M1 Pro + M2: gpubench, CTS subset, >= 1 h multi-context soak, full regression counts) will be posted on #2785. Closing this one; no force push here.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide deleted the gpuperf/legacy-fragment-barriers-rebase-20261121 branch November 27, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants