Skip to content

drm/asahi: g17: admit A18 Pro mesh renders one client at a time - #2071

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
djdev/g17-mesh-exclusion
Nov 21, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
djdev/g17-mesh-exclusion

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What

On the A18 Pro (26A428 firmware), when two clients' renders with mesh shading are on the GPU at the same time, one of them loses part of its mesh output. Either whole mesh workgroups are not drawn, or one view's primitives are shaded with another view's per-primitive data. The second shape is the one behind the prim_query multiview CTS intermittent. The same renders are correct one after the other, and a single client never shows it. It does not depend on the tiler heap: it happens with the heap pre-sized (#2058) and 0 grow requests.

The same firmware build already needs ray-traversal commands run for one client at a time (g17/traversal.rs). This admits renders with mesh shading by the same rule:

  • They run for one client at a time, and other clients' compute commands wait for them, as for ray-traversal commands.
  • Renders without mesh shading never wait, so a compositor is not held.
  • Mesh renders are no longer published from the submit ioctl.
  • aurora.g17_mesh_exclusion (0644, default 1) turns it off for an A/B.
  • A18 Pro only, since traversal_exclusion is set for that firmware build alone. M4 and M5 are unchanged.

A mesh render is one flagged DRM_ASAHI_RENDER_MESH_OUTPUT (#2058; Borealis sets it since mesa#389), or an M5 render with a mesh program.

Evidence (Neo J700, hint Mesa = the aurora-wip tree with mesa#389)

Two-client stress: fresh mvstress --big processes (one draw of 32,768 mesh workgroups over a two-view target) beside 3-iteration victims, several hundred processes per arm, all on one boot.

Failing processes:

Kernel Fix on (g17_mesh_exclusion=1) Fix off (=0)
this commit (kit meshxf, integration 447bfc2 + 28845a5), one boot 0 / 2,729 (4 arms) 79 / 1,422 (5.6%)
the same rule as a test switch (kit meshx, integration 0b84dd9), one boot 0 / 1,893 (3 arms); every render one client at a time: 0 / 859 81 / 1,558 (5.2%)
  • Failure shapes with the rule off: whole 32-px mesh workgroup blocks missing in layer 0 or layer 1, and layer-0 pixels with view 1's colour.
  • Every arm had 0 tiler-heap grow requests.
  • Mesh victims beside a non-mesh render client (deqp-vk draw/multiview processes), and non-mesh victims (1,884 draw/multiview cases) beside the mesh stress: 0 failures with the rule on or off. So only mesh-vs-mesh overlap needs the rule.
  • CTS (cts-vk4: c71 sample3x + all 28,061 mesh-shader cases + so-mesh, the mesh prim_query multiview class x3, the one-process mesh loop), rule on vs off on the same boot: 0 regressions, KERNEL gpu-pattern=0 gpu-warn=0. The same on the test kit.
  • MERGE-GATE pair gate (gate-dk, kernel with the rule on + Mesa aurora-wip with mesa#389) vs base1: 0 regressions, KERNEL 0/0 (on both kits).
  • Compile: fedora-kcheck OK.

Cost

  • Two clients' mesh renders no longer overlap. In the stress, a victim process takes about 150 ms instead of 93 ms.
  • A single client: mesh renders now go through the scheduler instead of the submit ioctl. Cold tgvis (20 separately waited mesh draws per process) takes 226.3 ms instead of 222.8 ms (+1.6%, 10 runs each over two boots; about 0.17 ms per mesh submission). Renders without mesh shading keep the submit-ioctl path. A follow-up could admit a mesh render from the submit ioctl when no other client holds the admission state.
  • The CTS runs two worker processes, so its mesh parts take 2-3% longer.

Root cause, as far as it can be traced

In a trace of the stress, 32-46% of GPU jobs overlap another context's jobs on the GPU timeline without the rule, and 0% with it. Every failure happens in the overlapping regime. There is no macOS comparison: macOS on the Neo runs the 25G83 firmware, not 26A428, and no multi-client macOS trace exists.

🤖 Generated with Claude Code

On the A18 Pro (26A428 firmware), when two clients' renders with mesh
shading run on the GPU at the same time, one of them loses part of its
mesh output. Either whole mesh workgroups are not drawn, or one view's
primitives are shaded with another view's per-primitive data (the
view-1-in-layer-0 shape of the prim_query multiview CTS intermittent).
The same renders are correct when they run one after the other, and a
single client never shows it.

In a stress of two processes, each running a draw of 32,768 mesh
workgroups over a two-view target (fresh processes beside 3-iteration
victims), about 5% of the processes are wrong (81 of 1,558). In a trace
of that stress, 32-46% of the GPU jobs overlap another context's jobs on
the GPU timeline. With mesh renders admitted one client at a time, the
overlap is 0% and the processes are correct: 0 failing of 1,893. The
failure does not depend on the tiler heap: it shows with the heap
pre-sized and no grow requests at all.

The same firmware already needs ray-traversal commands run for one
client at a time (g17/traversal.rs). Admit renders with mesh shading
(DRM_ASAHI_RENDER_MESH_OUTPUT, or an M5 render with a mesh program; the
rule applies to the A18 Pro only) the same way: they run for one client
at a time, and other clients' compute commands wait for them as they do
for ray-traversal commands. Renders without mesh shading never wait, so
a compositor's rendering is not held. A mesh render is no longer
published from the submit ioctl.

Cost: two clients' mesh renders no longer overlap, so in the stress
above each victim process takes 150 ms instead of 93 ms. A single
client's mesh rendering is unchanged (cold tgvis 223.2 vs 225.9 ms
mean, within the run-to-run spread).

aurora.g17_mesh_exclusion (0644, default 1) turns it off at run time
for an A/B.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Diljit Singh <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 3.

What I checked: Backend::exclusive() (drivers/gpu/drm/asahi/g17/runtime/traversal.rs:113-118) sends a mesh render through the same admission path as a command that traces rays. Non-mesh renders still return before the lock. A mesh render is never published from the submit ioctl (:123-130). An admitted job has already had its dependencies resolved, so a mesh render waiting on another client's admitted job can't form a cycle. That part is sound.

  1. g17/mesh_exclusion.c:11-13 adds a module parameter, aurora.g17_mesh_exclusion, that turns the fix off at run time. The fix should simply be on wherever it applies. The test-switch kit already gives you the off arm of the A/B as a separate build, so please drop the parameter, mesh_exclusion.c and the extern "C" shim (traversal.rs:134-143).
  2. The exclusion rides on variant.traversal_exclusion, which is a per-firmware-build flag: true for the 26A428 G17P build (g17/fw/variant.rs:144), and false, with "Not measured on this firmware", for the M4 Pro build (:181) and the M5 build (:202). The M4 Pro has the same G17P GPU. If the overlap fault is in the GPU block, it needs the exclusion there too; if it is in the 26A428 firmware alone, the commit message should say so, backed by a clean run on the other firmware. Please run the two-client mvstress --big stress on the J616s (and an M5 if one is available), with and without the exclusion. Then either set the flag there or record in the commit why it is firmware-specific.
  3. The commit carries Co-Authored-By: Claude Opus 5.5 <[email protected]>. Commits should have only the human Signed-off-by. The PR body ends in the "Generated with Claude Code" line. Use Assisted-by: LLM (Claude:Opus 5.5) as its last line instead.

Nit: the single-client cost differs between the commit message ("223.2 vs 225.9 ms, within the run-to-run spread") and the PR body ("226.3 ms instead of 222.8 ms (+1.6%)"). Please use the newer measurement in both.

HW row: J616s (M4 Pro, G17P, M4 Pro firmware) on this head rebased onto current integration/aurora, with the same two-client mvstress, several hundred processes, base against head. Pass: 0 failing processes with the exclusion, or a clean base run that justifies keeping it 26A428-only. Also a regression row on the Neo after the parameter is dropped. Pass: 0 failing processes, 0 new kernel errors, 0 failed units, 0 AVC denials.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide merged commit a5f8dc6 into integration/aurora Nov 21, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the djdev/g17-mesh-exclusion branch November 27, 2026 13:21
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