Skip to content

drm/asahi: g17: skip own-pair fragment wait in J813 CrossPairOrder - #3253

Merged
RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
m0d16l14n1:j815/pr-cross-pair-context
Nov 29, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
m0d16l14n1:j815/pr-cross-pair-context

Conversation

@m0d16l14n1

Copy link
Copy Markdown
Contributor

What: Skip the pair's own previous fragment kick (last.qid() == qids[1]) in CrossPairOrder::dependency() for CrossPairOrder::All on J813/J815 while keeping the LAST_FRAGMENT wait for every other pair, allowing same-context TA/3D pipelining across render passes without weakening cross-context VM-slot isolation.
Tested: J815 MacBook Air 15" M5 (T8142, G17G), kernel 7.3.0-aurora-j815-dev (aurora.ko 800d72d3 with runtime A/B knob m5_ab_cross_pair matching this exact logic, Borealis git-a40cc98b1a, m5_fw_cross_waits=1): Godot TPS 1080p FSR2 voxel GI (knob-fast.sh 4 s × 12 cycles, round-robin inside one process): base (All) 46.73 fps (gpu_p50 20.776 ms) → CrossContext (skip own pair) 47.81 fps (+1.08 fps / +2.3%, 95% CI [+0.02, +2.07], gpu_p50 20.255 ms = −0.521 ms/frame); 114,133 own-pair waits skipped, 0 GPU faults. Regression line: 0 SELinux denials (N/A on this image), 0 failed units, 0 new kernel errors.
Risk: two-way door · J813/J815 (T8142) M5 Macs; all other chips already use CrossPairOrder::TaskAfterTask, which already skipped qids[1].
Not yet: Multi-client concurrent render stress (e.g. 8 simultaneous clients) on this exact branch tip; J813 (13" Air) hardware row.

Details

CrossPairOrder::All was added on J813 because running a tiling kick beside another context's fragment kick caused ISP parameter fetch faults (requestor 0x9a) through the wrong VM slot. Because CrossPairOrder::dependency() only filtered last.qid() != qids[1] for TaskAfterTask, All also inserted a TA dependency on the same pair's own previous fragment kick (qids[1]), serializing every render pass's TA behind the previous render pass's 3D within a single client (31.5 render passes/frame in Godot TPS).

Filtering d.qid() != qids[1] unconditionally in CrossPairOrder::dependency() keeps every cross-pair (cross-context) LAST_FRAGMENT dependency intact while allowing same-context TA/3D overlap. cross_pair_order_tests is updated to assert that CrossPairOrder::All still emits a dependency for another pair (word(9) on [4, 5]) and returns None for its own pair (word(5) on [4, 5]).

Evidence

Machine: J815 MacBook Air 15" M5 (T8142, G17G), kernel 7.3.0-aurora-j815-dev, Borealis git-a40cc98b1a, m5_fw_cross_waits=1.

knob-fast.sh cp 4 12 -- base:base cc:m5_ab_cross_pair=1 tt:m5_ab_cross_pair=2:

arm n fps gpu_p50 (ms) delta vs base (95% CI)
base (All) 24 46.73 20.776 —
cc (skip qids[1], keep cross-pair) 24 47.81 20.255 +1.08 fps (+2.3%) [+0.02, +2.07]
tt (TaskAfterTask) 30 47.89 20.252 +1.16 fps (+2.5%) [+0.09, +1.59]

m5_ab_state: cross_pair_added=261777 cross_pair_skipped=114133, 0 GPU faults.

On J813/J815, CrossPairOrder::All serialized every render's tiling kick
behind global LAST_FRAGMENT, including the same pair's own previous
fragment kick (last.qid() == qids[1]). The requestor 0x9a ISP parameter
fetch fault occurred when tiling ran beside another context's fragment
kick, which is always on a different pair; a pair's own tiling ring
already shares one VM slot and orders its own kicks.

Skip own-pair fragment kicks in CrossPairOrder::dependency() for All as
well as TaskAfterTask so same-context TA/3D can pipeline across render
passes while keeping cross-context TA/3D isolation intact. Update
cross_pair_order_tests to cover both own-pair skipping and other-pair
ordering on CrossPairOrder::All.

Signed-off-by: Nick <nekreshen@yandex.ru>
@m0d16l14n1
m0d16l14n1 requested review from a team and DjDeveloperr as code owners November 26, 2026 13:30
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at a50ecc21: not ready yet

Check Detail
CI at head ok 18 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at a50ecc21
Conflicts ok none
PR text ok Risk: two-way · J813/J815 (T8142) M5 Macs; all other chips already use CrossPairOrder::TaskAfterTask, which already skipped qids[1].

Areas: area:gpu

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

@gig3m

gig3m commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

J813 (MacBook Air 13" M5) at a50ecc21f63e: boots and runs GL load with no GPU faults. The fps gain isn't measured here.

Kernel: main 255761f1 (this branch's base differs only in a CI script) plus our local XRGB8888 primary-plane patch for Hyprland, LLVM. GPU firmware 26B123, G17G. A/B on the same kernel, one boot per arm, with aurora.ko from main and aurora.ko from this head; the drivers/gpu/drm/asahi tree matches a50ecc21f63e exactly.

Check This head main
Boot Initialized aurora, Hyprland desktop, 0 failed units same
GL load: glmark2-es2-drm --off-screen at 2560x1664, 2 full runs plus 3 runs of terrain/refract/jellyfish/shadow/build at 15 s each, about 15 min done done
GPU fault, timeout or recovery lines in the kernel log 0 0

The g17 host tests in tools/asahi pass at this head (37 of 37).

Not run: Godot TPS or another workload with many render passes per frame, so the own-pair skip isn't measured. Multi-client concurrent render stress wasn't run either.

Assisted-by: LLM (Claude:Opus 5.5)

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Nov 26, 2026
@term-guy

Copy link
Copy Markdown
Contributor

J704 (MacBook Pro 14" M5, T8142, G17G) at a50ecc21: boots and runs a GL load with no GPU faults, so no regression. There is one A/B, one boot per arm.

  • Kernels: the base is 7.3.0-t28+ = main + linux#2093 70682eb1 + linux#2603 (the J704 GPU and display). 7.3.0-t30+ is the same tree with this head merged. That merge has no conflicts, and the drivers/gpu/drm/asahi change is exactly this PR's render.rs.
  • Setup: the same DTB on both (byte-identical), aura main + aura#409 + aura#545, Fedora 44 KDE, GPU firmware 26B123, Mesa 26.3.0-devel. GL_RENDERER = Apple M5 (G17G C0).
  • Load: glmark2-es2-drm --off-screen (3024x1964), one full run, then terrain/refract/jellyfish/shadow/build at 15 s each. Both boots: about 8 min, with KWin running.
base this head
glmark2 score (33 scenes) 2376 2376
terrain 15 s / full run 4 / 4 fps 7 / 4 fps
refract 15 s / full run 3 / 4 fps 5 / 3 fps
jellyfish / shadow / build (15 s) 2165 / 854 / 2890 2165 / 855 / 2887
every other scene within ±1 %
kernel log lines during the load (GPU faults, timeouts, recoveries) 0 0
failed units / AVC 0 / 0 0 / 0

The J704 is also on CrossPairOrder::All, because j813_forms() is chip_id == 0x8142. So this change applies to it as well, and the Risk line could name it beside J813/J815.

terrain and refract run at single-digit fps on the J704 with or without this PR, while every other scene runs at 850-2900 fps. At that rate glmark2's whole-number FPS cannot tell 4 from 7 reliably, so I would not read a gain into those two lines. I'm looking into the stall itself separately. Not run: Godot or any other workload with many render passes per frame, and multi-client stress.

@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

Thank you guys!

@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: MERGE at a50ecc21

Blockers: none (note: cancelled KUnit CI jobs need a rerun to turn green before merge).

Checked: no Apple material, no AI attribution, no new chip/SoC/board/firmware gates, no cmdline hacks, human Signed-off-by, algebraically identical for CrossPairOrder::TaskAfterTask, preserves cross-context LAST_FRAGMENT isolation on CrossPairOrder::All while skipping own-pair qids[1], unit tests updated, exact-head hardware rows on J813 and J704 plus J815 A/B performance row, apple-build and host-tests green.

Evidence
  • Code inspection: drivers/gpu/drm/asahi/g17/queue/render.rs:741 filters d.qid() != qids[0] && d.qid() != qids[1] unconditionally. For CrossPairOrder::TaskAfterTask this is identical to the prior (self != Self::TaskAfterTask || last.qid() != qids[1]); for CrossPairOrder::All it drops only the same pair's own fragment kick while retaining cross-pair dependencies.
  • Unit test cross_pair_order_tests verifies both All.dependency(word(9), [4, 5]) == Some(word(9)) and All.dependency(word(5), [4, 5]) == None.
  • Hardware rows at exact head a50ecc21: J813 (gig3m, 15 min glmark2-es2-drm, 0 GPU faults/timeouts) and J704 (term-guy, 8 min glmark2-es2-drm with KWin, 0 GPU faults/timeouts), plus J815 TPS A/B (+2.3% fps, 0 faults).
  • CI at a50ecc21: apple-build, host-tests, pr-text, readiness PASS; KUnit asahi and remaining KUnit jobs were cancelled and need rerun before merge.
  • Non-blocking note: multi-client concurrent render stress (e.g., 8 simultaneous clients on J813/J815) is listed under Not yet and is worth running as a follow-up check if any cross-context regression surfaces.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train status at a50ecc21 (App approval noted): I've re-run the cancelled KUnit jobs. Two items remain for the 6-point rule. First, a regression row on a second family: g17/queue/render.rs is shared with the A18 Pro (Neo, G17P), so please run a Neo row at this head (normal GPU workload, CTS sync subset, 0 GPU faults or recoveries); we can run it on our Neo if you'd like. Second, the code-owner ping (@DjDeveloperr) at least an hour before merge. Then I merge with the rationale and revert line.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 28, 2026
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

J815 (MacBook Air 15" M5, G17G): skipping the pair's own fragment wait makes the gpubench-vk geometry test 41 % faster per submit and the full-screen fill test 6 % faster. No GPU faults.

Kernel: our J815 tree (drivers/gpu/drm/asahi = main at 96ef580d6199 plus local J815 commits and #3389's four commits), not this head. It carries the runtime parameter m5_ab_cross_pair. At 1 it selects CrossPairOrder::CrossContext, the same dependency rule as this PR (the own pair's last fragment kick is skipped, every other pair's is kept). At 0 it keeps All. The parameter is read when a context is created, so both arms ran in the same boot, alternating, with a new process per run. m5_fw_cross_waits=1, GPU firmware 26B123, Mesa aurora-wip (Borealis).

gpubench-vk render.heavy, queue depth 4, 1080p, median µs per submit (and GPU µs), three alternating rounds:

Test This rule (CrossContext) All
kind=geom (262,144 small opaque triangles) 224.4 / 212.9 / 214.4 (GPU 211 / 209 / 210) 368.7 / 360.8 / 372.0 (GPU 359 / 360 / 363)
kind=fill (16 blended full-screen layers) 268.8 / 264.6 / 264.0 (GPU 261 / 262 / 261) 281.5 / 278.7 / 292.4 (GPU 278 / 277 / 277)

Means: geometry 367.2 → 217.2 µs (−40.8 %), fill 284.2 → 265.8 µs (−6.5 %). The GPU time drops as much as the submit time, because under All each pass's tiling waits for the previous pass's fragment work, so the two engines run back to back instead of overlapping. An earlier boot on another module (without #3389) gave the same split: 202–210 µs against 344–361 µs, with m5_fw_cross_waits at either 0 or 1.

Kernel log during the runs: 0 GPU lines. Failed units: 0.

@RyanTheTide We have no A18 Pro (Neo) here, so we'd take you up on running the Neo row on yours, thank you. @DjDeveloperr code-owner ping for g17/queue/render.rs, ahead of the merge.

@RyanTheTide

Copy link
Copy Markdown
Contributor

code-owner ping @DjDeveloperr: closeout merge at a50ecc21. App approved at this head, CI 20/20 green, rows at head on J813 and J704 plus the J815 A/B. Only CrossPairOrder::All (T8142) changes; TaskAfterTask boards, Neo included, are unchanged, so no Neo row is needed. Merging under the 6-point rule 1 h from now unless you object. 8-client concurrent render stress on T8142 goes to a known-gap issue.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging under the 6-point rule (Ryan 09:29, permanent), at a50ecc21. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J813+J704@head;T8142-only(CrossPairOrder::All). (5) There's no blocking review. (6) Dj was pinged here 64 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 03e2864 into aurora-silicon:main Nov 29, 2026
25 of 55 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merged. Thanks @m0d16l14n1! The 8-client concurrent render stress on T8142 is tracked in #3576.

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) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants