Skip to content

drm/asahi: g17: Fix M5 Max GPU work running before the work it waits for - #1070

Merged
DjDeveloperr merged 1 commit into
funkzy/t6050-gpu-on-integrationfrom
j716c/m5-max-host-producer-waits
Nov 10, 2026
Merged

DjDeveloperr merged 1 commit into
funkzy/t6050-gpu-on-integrationfrom
j716c/m5-max-host-producer-waits

Conversation

@erikwb

@erikwb erikwb commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What this is

On the M5 Max, #1012's driver can run GPU work before the work it waits for has finished:

  • Without the G17D forms (the M5 Max), a compute kick's implicit parent is pipelined: the next kick on a ring may start while its predecessor still runs. The M5 Max needs it that way; with the G17D forms' completion parent, its compute kicks never complete.
  • Input conversion replaces a compute input's completion wait with ring order. A consumer published behind its producer on the same queue therefore ran alongside it and read memory the producer had not finished writing.
  • Leaving other-engine producers to firmware waits also lost devices to submission timeouts under load.

This adds a backend query that holds for an M5 board without the G17D forms. On those boards, compute inputs keep their completion fences, and other-engine prefix producers are waited for on the host, with their errors checked before publication. The M5 Ultra and the other GPUs keep their firmware dependencies; the M5 Ultra passes the same CTS sample without this change.

This fixes the multi-queue synchronization known issue from #1056 (now part of #1012), apart from the MMU faults below.

Testing (J716c, bare metal)

Tested on the previous #1012 head (d078ca1) with #1056 and the GPU device tree, with the same Mesa build throughout. The patch rebased onto this head unchanged. It is rebased again onto #1012's current head (0dd0833), unchanged, and runs in the J716c daily on current integration/aurora, which passes an 18,427-case sample of the Vulkan default list (9,694 passes; only the two driver-ID/conformance metadata failures; no GPU recoveries).

  • Three synchronization2.op.multi_queue cases that returned wrong memory contents on every run: 15/15 passes.

  • The 65 synchronization cases (multi-queue, cross-instance, timeline semaphore) that failed or crashed in the drm/asahi: g17: Run the M5 Max (J716c) GPU on bare metal #1056 sample: 195/195 passes over three runs, on two boots.

  • A 1-in-100 sample of the Vulkan CTS default list (17073 tests, 8557 not supported):

    Pass Fail Crash Job timeouts
    Without this change 8345 23 52 17
    With it, three runs 8401 / 8387 / 8387 4 / 14 / 0 38 / 43 / 40 0 / 0 / 0
  • Turning off only the input conversion still left 24 and 60 job timeouts in two samples, so both halves are needed.

  • Builds with integration's defconfig + asahi.config, with KUnit.

Known issues

GPU MMU faults remain (0, 1 and 5 recoveries in the three samples above). They are being investigated separately.

🤖 Generated with Claude Code

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

Approved. This works on the M5 Pro too, and it fixes a real M5 Pro bug.

host_producer_waits() holds on J714, which has no G17D forms, so this commit changes the M5 Pro's behaviour as well. I compared the same kernel, Mesa (15eb7b7be4) and boot flow with and without it; #1177 was also in the "with" kernel. The commit cherry-picks cleanly onto 0dd0833. Results on J714sAP, bare metal:

without with
multi_queue.timeline_semaphore write_copy_buffer_read_ssbo_geometry.buffer_16384_concurrent and write_copy_image_read_blit_image.image_64x64x8_r32_sfloat_exclusive Fail 3/3 each Pass 3/3 each
every 20th synchronization2.op.multi_queue.timeline_semaphore case (214) 175 Pass, 34 Fail, 5 DeviceLost 208 Pass, 0 Fail, 6 DeviceLost
dEQP s0 smoke 109 Pass, 2 NotSupported 109 Pass, 2 NotSupported
compute 65,536 words / 256x256 triangle PASS / crc32 d5e4bea9 same

Every DeviceLost case in both runs is a 128x128 RGBA32F image case in the vertex or tessellation stages. That is the M5 Pro firmware's ~12 ms vertex-phase limit, which this change doesn't affect.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Leaving this open: it is based on #1012 (funkzy/t6050-gpu-on-integration) and needs its firmware-27 display/GPU code, and #1012 isn't being merged in this round. It can be retargeted to integration/aurora once #1012 is in.

🤖 Generated with Claude Code

DjDeveloperr commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Update: I am handling this rebase directly as part of the owner's M5 integration work. The freshly pinned #1070 head is 26d82876dbcf (the earlier form already contained in #1411); it rebases cleanly onto #1406 at d2566e93444f, with unchanged range-diff and Erik Bourget's authorship preserved. The original remote head is retained for rollback. The corrected branch will be published with an exact force-with-lease after the reconciled M5 stack passes its fresh build and hardware gate.

Without the G17D forms, an M5 compute kick's implicit parent is
pipelined: the next kick on a ring may start while its predecessor still
runs. The M5 Max needs it that way; with the G17D forms' completion
parent its compute kicks never complete. Converting a compute input
fence into ring order therefore let a consumer run alongside its
producer on the same queue. Leaving other-engine producers to firmware
waits also lost devices to submission timeouts under load.

On those boards, keep compute inputs as completion fences, and wait on
the host for other-engine producers to complete, checking their errors
before publication. Boards with the G17D forms keep their firmware
dependencies.

On the M5 Max, three synchronization2 multi-queue cases returned
incorrect memory contents on every run, and the 17,073-case CTS sample
recorded 17 job timeouts. With this change, 195 repeats of 65
previously failing synchronization cases pass, and three samples record
no job timeouts. Disabling only the input conversion still left 24 and
60 timeouts in two samples.

Developed with Claude Code.
Signed-off-by: Erik Bourget <erik@ebourget.net>
@DjDeveloperr
DjDeveloperr changed the base branch from funkzy/t6050-gpu-on-integration to j716c/t6050-gpu-merge-integration November 10, 2026 09:10
@DjDeveloperr
DjDeveloperr force-pushed the j716c/m5-max-host-producer-waits branch from 26d8287 to e962ea2 Compare November 10, 2026 09:10
@DjDeveloperr
DjDeveloperr changed the base branch from j716c/t6050-gpu-merge-integration to funkzy/t6050-gpu-on-integration November 10, 2026 10:20
@DjDeveloperr
DjDeveloperr merged commit 1e7c03b into funkzy/t6050-gpu-on-integration Nov 10, 2026
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