Skip to content

drm/asahi: enable GPU completion inputs on J716c - #2207

Open
erikwb wants to merge 1 commit into
integration/aurorafrom
j716c/gpu-completion-inputs
Open

erikwb wants to merge 1 commit into
integration/aurorafrom
j716c/gpu-completion-inputs

Conversation

@erikwb

@erikwb erikwb commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Whether a compute kick's explicit waits on other kicks take the completion class (held in firmware until the producer completes) was a per-board flag that only the J714 set. It is a property of the firmware interface and the host encodings, so Board::completion_inputs() now derives it from them and the field is gone:

  • Completion inputs are on for boards on the T6050 firmware's M5 graph layout (RootProfile::J714G17S26A428, matched positively) with the G17S/G17C host encodings. That keeps the J714 as it was and turns them on for the J716c (G17C). A board on any other layout keeps them off until its kicks are known to take that form.
  • The common interface (J813, both 26A428 and 26B123) keeps its own kick forms. It already gives explicit dependencies the completion class, but its kicks carry no submission sequence and no retired-parent relaxation, so its waits stay on the host.
  • The G17D (J775D) keeps its qualified tuple, entry-signal gate and pipelined firmware waits. The counted G17S form has not been run there, and a wrong kick form on that part never completes.

The reasons are commented next to Board::completion_inputs(). A compile-time check pins the result for every board: on for J714 and J716C, off for J775D, J813 and J813 on 26B123.

On the J716c every compute kick now takes the counted form (ordinal as submission sequence, completion-class parent while it runs), whatever the userspace. A wait on a producer that does not declare a visible completion (DRM_ASAHI_COMPUTE_VISIBLE_COMPLETION) still waits on the host. Only userspace that sets that flag gets firmware waits.

Testing on the J716c (an earlier head with the same effect on this board): in Cyberpunk 2077 at 3840×2160, High with FSR2 Balanced, the two control runs rendered 18.26 and 17.75 FPS. With completion inputs on, they rendered 22.52 and 22.61 FPS (+25.3% across the means). Both kernels passed 64 of 65 synchronization CTS cases, with one unsupported and zero failures. Two game launches with completion inputs on lost the Vulkan device while a render queue waited for its completion stamps.

Matched comparison on the J716c. Two kernels were built from the same tree, the J716c daily (integration/aurora with the board enablement below) plus this change. They differ only in that the control returns false from completion_inputs() on every board. Boots alternated (on, off, on, off), with the same Mesa build, the same settings, the desktop up and the 140 W adapter connected. Each boot ran Cyberpunk 2077 at tier T2 of issue #457 (2560×1600), with 5 launches on stock vkd3d-proton (one launch on the first boot didn't start because another benchmark held the lock) and 3 pairs of passes on the PR build of vkd3d-proton.

Completion inputs on Off (control)
Launches 21 22
Launches that lost the Vulkan device 0 0
GPU recovery, MMU fault or timeout lines in the kernel log 0 0
Stock vkd3d-proton, mean FPS (launches) 25.08 (9: 24.36–25.81) 20.34 (10: 20.19–20.80)
PR vkd3d-proton, mean FPS (passes) 30.04 (12: 29.94–30.16) 21.77 (12: 21.64–21.93)
Timeline-semaphore synchronization CTS (dEQP-VK.synchronization*.op.multi_queue.timeline_semaphore.*, 8,538 cases) 8,532 Pass, 6 NotSupported 8,532 Pass, 6 NotSupported

With completion inputs on, stock vkd3d-proton is 23.3% faster and the PR build 38.0% faster. Neither arm lost the device in these 43 launches, so the two earlier losses did not recur here, on either arm.

tools/asahi/run-host-tests.py on this head: 426 of 427 runs pass locally. The apple-dcp selftest run also fails, with the same 15 subtests, on a tree with the same base and without this change. The arm64 kernel with this commit builds with the J716c daily configuration.

To boot the J716c, the test kernel also included the board enablement in #1173, #1650 and #2185.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the Cyberpunk numbers; +25% is a big gain.

We try to select behaviour by a hardware or firmware property rather than by the board it was measured on. This flips the per-board flag for one more machine (drivers/gpu/drm/asahi/g17/fw/m5/initdata.rs:2470, completion_inputs: true on J716C), while J714 has it and J775D and J813 do not, and nothing in the code says why they differ.

Whether explicit waits can take the firmware's completion class is a property of the firmware interface, not of the board. Could you make it depend on that (the firmware build/layout that supports it), or turn it on for every M5 board and remove the field? If some board must keep it off, a comment with the reason would be the way. Before that, the two lost Vulkan devices you mention need the matched comparison with completion inputs disabled. We can help with rows on other machines.

Whether a compute kick's explicit waits on other kicks take the completion
class, held in firmware until the producer completes, was a per-board flag
that only the J714 set. It is a property of the firmware interface and the
host encodings, not of the board: derive it from them and drop the field.

Boards on the T6050 firmware's M5 graph layout (J714G17S26A428) with the
G17S/G17C host encodings take completion inputs. The layout is matched
positively, so a board on any other layout keeps them off. This turns
them on for the J716c (G17C) as well as the J714. The common interface
(the J813) keeps its own kick forms, and the G17D keeps its qualified
tuple and pipelined firmware waits; the reason for each is beside
Board::completion_inputs(). A compile-time check pins the result for
every board.

On the J716c every compute kick now takes the counted form. A wait on a
producer that does not declare a visible completion still waits on the
host.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb force-pushed the j716c/gpu-completion-inputs branch from 313543d to aa1abb9 Compare November 21, 2026 17:45
@erikwb

erikwb commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of erikwb

Thanks. The field is gone: Board::completion_inputs() is now derived from the firmware interface and the host encodings (aa1abb9). It matches the T6050 M5 graph layout (RootProfile::J714G17S26A428) positively, so a future board on another layout doesn't inherit it.

Why the four boards differed, from the history:

  • 8aee10d (M5 Pro firmware waits) added the flag and turned it on for the J714 only, because that is where the counted form (completion-class waits, the ordinal as submission sequence, the qualified dispatch base with auxiliary control only for a pipelined parent) was measured. The J716c and the J775D were left false. That commit measured only the J714 and gives no firmware reason for the other two.
  • 482acb1 and 4b06516 (J813 bring-up and its kicks) added the J813 with false. The J813 runs the common firmware interface (26A428/26B123 graph), not the T6050 one, and its kicks have their own forms (j813_forms): every dependency already takes class 1, there is a fixed completion identity, and there is no submission sequence.

What the code now says:

  • On: boards on that layout with the G17S/G17C host encodings. The J714 is unchanged and the J716c is turned on. The J716c runs the same T6050 firmware interface as the J714.
  • Off, common interface (J813): its kicks carry no submission sequence and no retired-parent relaxation, so the M5 graph's counted form isn't that interface's. Its waits stay on the host, as before.
  • Off, G17D (J775D): its compute only runs with the qualified tuple and the entry-signal gate, and its firmware waits take the pipelined class. The G17S counted form has never run on a G17D, and a wrong kick form there never completes. So it stays off until someone with a J775D tries it. We can't do that.

These reasons are now comments on Board::completion_inputs(), and a compile-time check pins the result for each board. Behaviour changes only on the J716c. There, every compute kick takes the counted form regardless of userspace. A wait on a producer that doesn't declare a visible completion still waits on the host.

On the two lost devices, the matched run is done:

Completion inputs on Off (control)
Launches 21 22
Launches that lost the Vulkan device 0 0
GPU recovery, MMU fault or timeout lines in the kernel log 0 0
Stock vkd3d-proton, mean FPS (launches) 25.08 (9: 24.36–25.81) 20.34 (10: 20.19–20.80)
PR vkd3d-proton, mean FPS (passes) 30.04 (12: 29.94–30.16) 21.77 (12: 21.64–21.93)
Timeline-semaphore synchronization CTS (dEQP-VK.synchronization*.op.multi_queue.timeline_semaphore.*, 8,538 cases) 8,532 Pass, 6 NotSupported 8,532 Pass, 6 NotSupported

With completion inputs on, stock vkd3d-proton is 23.3% faster and the PR build 38.0% faster. Neither arm lost the device in these 43 launches. The two earlier losses didn't recur on either kernel, so this run doesn't tie them to completion inputs; it also can't rule out a rare loss. The description has the same table.

Rows on other machines would help: a J714 with this head should see no change, and a J775D or J813 should see no change either.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, this resolves the review. Board::completion_inputs() now follows the firmware interface (the T6050 M5 graph layout) and the host encodings instead of a per-board field, and the comments give the reasons the J813 (common interface, no submission sequence in its kicks) and the G17D (pipelined-class waits, different kick tuple) stay off. The compile-time check pinning each board is a good touch. The matched run answers the stability question: 0 device losses in 43 launches on either side, identical timeline-semaphore CTS, and the gain holds with stock vkd3d-proton.

Since behaviour only changes on the J716c, where it is measured, we have no further rows to ask for.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train adversarial review (MERGETRAIN-LINUX2) at aa1abb9: NO BLOCKERS.

Code read only, nothing built here. Before the merge it still needs Dj's verdict at this head; the missing rows are listed below.

Full review

#2207 drm/asahi: enable GPU completion inputs on J716c @aa1abb9a

VERDICT: NO BLOCKERS

Checked:

  • One commit with only Signed-off-by: Erik Bourget. The PR body ends with Assisted-by: LLM (Claude:Opus 5.5).
  • The completion_inputs field is removed from every Board literal. The merged tree (b241e35 + head) has no leftover completion_inputs: initializer, and J813_26B123 has no explicit field.
  • completion_inputs() (initdata.rs:2939-2941 on the head) is graph.profile == J714G17S26A428 && !g17d_forms.
  • The const assert pins the result: J714 and J716C on, J775D, J813 and J813_26B123 off. J714, J775D and J813 behave as before.

Effects on J716C:

  • explicit_dependency → class 1.
  • counted_forms/parent_dependency → counted.
  • kick_tuple → NORMAL preempt offset + QUALIFIED dispatch base (compute.rs:154-170).
  • host_producer_waits false and firmware_sources_need_visible_completion true (runtime/backend.rs:128-133).
  • The uAPI feature DRM_ASAHI_FEATURE_COMPUTE_VISIBLE_COMPLETION is now advertised on J716C (g17/mod.rs:2546).
  • All of this is what was measured.

Nits:

  1. initdata.rs:2926-2930: the doc comment says the selection "follows the firmware interface the board runs". Board::graph is static, though: J714, J716C and J775D all point at M5_GRAPH, whose profile is always J714G17S26A428.
  2. On integration/aurora alone, the J716c's 27.2 (26B123) G17C firmware is not identified (drm/asahi: t6050: identify the M5 Max's 27.2 (26B123) G17C firmware (on #1650) #2185 is unmerged). The pinned production firmware therefore can't reach this code on the base yet, and all measurements used the unmerged stack.
  3. RootProfile::J714G17S26A428 is named after a board and a firmware build. This is existing naming, not added here, but it is the reason the "firmware property" reads like a board gate.

Missing rows:

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

Review at aa1abb9a8ce5: 0 code, CI, policy, or attribution blockers.

Checked:

  • Interface selection (§1): Removes the per-board completion_inputs field from Board and derives Board::completion_inputs() from matches!(self.graph.profile, RootProfile::J714G17S26A428) && !self.g17d_forms, with clear comments explaining why J813 (common interface, no submission sequence / retired-parent relaxation) and J775D (G17D qualified tuple + pipelined waits) stay off, plus a compile-time const assertion pinning all five board definitions so J714, J775D, and J813 are unchanged.
  • Attribution (§4) & CI: Commit aa1abb9a8ce5 carries human author/committer and Signed-off-by: only; host-tests is green.
  • Performance & conformance (§5): The alternating matched A/B on J716c is solid (43 Cyberpunk launches, 0 Vulkan device losses on either arm, 0 GPU recovery/MMU fault/timeout lines, +23.3% stock / +38.0% PR vkd3d-proton, and identical 8,532 Pass / 6 NotSupported timeline-semaphore CTS).

Non-blocking nit:

  • drivers/gpu/drm/asahi/g17/fw/m5/initdata.rs:2926-2930: the doc comment says the check "follows the firmware interface the board runs", whereas self.graph.profile is the static M5_GRAPH family (J714G17S26A428) even when runtime 27.2 selects M5_GRAPH_26B123 (works identically on 27.0 and 27.2, just slightly imprecise wording).

Still owed before approval/merge (§5):

  • Full regression counts on the default kernel command line (0 SELinux denials, 0 failed units, 0 new kernel errors).
  • A J716c confirmation row on integration/aurora once #2185 lands (since the A/B measurements were run on the unmerged #1173/#1650/#2185 stack).

Assisted-by: LLM (Gemini 4 Neon)

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.

3 participants