Skip to content

drm/asahi: m3: default to render batches of two - #2090

Open
freber wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
freber:t8122-render-batch-2
Open

freber wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
freber:t8122-render-batch-2

Conversation

@freber

@freber freber commented Nov 16, 2026 •

Copy link
Copy Markdown

Claude Code wrote this up from my tests.

asahi.m3_render_batch_size goes from 1 to 2, so the M3 runtime publishes up to two render passes per batch by default. The sysfs override m3_render_batch_override still wins when it's set.

Only the M3 Airs are affected. The parameter exists only with CONFIG_DRM_ASAHI_M3_T8122 and its one reader is next_batch() in m3_runtime.rs. That runtime starts on the J613 and J615 and nowhere else. M3 Pro and Max (T6030, T6031) go to the G15 backend or get refused and never read it.

The first render draw is still published alone for InitBM. The T8122 pipeline depth of 2 and the 4000 µs batch budget cap every batch as before.

Why

On my J615 (15-inch M3 MacBook Air) Chromium drops frames when it scrolls an image-heavy page at batch 1. I measured it on 14 November with the stock aurora16 module and changed only m3_render_batch_override at runtime. The page is about 21000 px tall with 101 images and a synthetic scroll runs down and back up for 20 s. Each row is the median of three runs.

Render batch Dropped frames p99 frame interval p50 frame latency
1 (today's default) 2.2 % (26 of 1190) 33.3 ms 83.5 ms
2 0 % 16.7 ms 67.4 ms
4 0.1 % 16.7 ms 67.4 ms

Two control runs at batch 1 in the same session dropped 2.6 and 2.4 percent. At batch 2 the worst of the three runs dropped a single frame. Frame latency (from vsync until the frame is on screen) fell by one refresh. Batch 4 gave the same frame pacing in Chromium, so I went with the smaller step.

To check that batching happened, I ran a burst of eight small draws. At batch 2 the runtime retired 1.6 render commands per retirement against 1.0 at batch 1. The burst's median fell from 4.53 to 4.00 ms and GPU mailbox interrupts per run dropped from 320 to 200.

Throughput in gpubench held (220.4 fps before, 222.4 after) and idle power didn't rise (7.6 W against 8.3 to 9.1 W in the batch 1 runs, one sample each). The kernel log had no GPU errors during these runs.

On 7.3, built from this head

On 2026-11-22 I booted a 7.3 kernel built from integration/aurora 24dc42277 with this commit, #1985, #2199 and #2203 merged, on the default command line. The comparison boot was the same kernel with aurora.m3_render_batch_size=1. Same images scene, 3 runs of 20 s under balanced at panel scale 1.6.

Default (batch 2) Booted with batch size 1
Dropped frames, median of 3 runs 11.77 % 15.55 %
p50 frame latency 83.5 ms 100.0 ms
Render commands per retirement (8-draw burst) 1.52 1.00
Firmware error events 0 0

The drop rates are higher than on 7.2 above, where the runs used t8122_pstate_cap=5 and the runtime override. The 7.3 build carried #2203, so its GPU ceiling could rise to state 8.

Daily use

Batch 2 has been my everyday setting since 14 November at 16:28, through a tmpfiles.d entry that writes the override at boot. That was seven boots when I opened this PR. The first two ran the stock aurora16 kernel (7.2.11-16-1-ARCH). The other five ran my J615 test kernel (7.2.11-16-1-j615-ARCH), which is aurora16 plus my J615 power and display patches with the same next_batch().

The kernel logged no GPU faults or timeouts in any of those boots. hyprland-preview-share-picker failed once, on the test kernel on 16 November, with these two lines before it crashed in libvulkan_asahi.

asahi 292400000.gpu: M3: cannot allocate 4096 KiB of GPU memory
asahi: GPU work of a client failed (ENOMEM, reported at m3/m3_submit.rs:101); the client sees a lost device

The same two lines and the same crash showed up twice on 13 November on the stock kernel at batch 1, before I had changed anything. So I don't think batching causes it.

Testing

Only my J615 has run this. The J613 (13-inch M3 Air) runs the same runtime and gets the same default, but I don't have one to try it on.

My 7.2 runs used asahi.t8122_pstate_cap=5 and the 7.3 build carried #2203, so batch 2 at the ceiling of 2 that applies without #2203 is untested.

  • python3 -I tools/asahi/run-host-tests.py --only m3 passes 6 of 6 (m3-batching-tests 12, m3-runtime-tests 81, m3-firmware-tests 21 plus the three m3 Python tests). None of them read M3_RENDER_BATCH_SIZE, so they only show that nothing else moved.
  • The 7.3 kernel above is a full build with this commit merged.

How to test

On a J613 or J615 you can try it today without this patch. On 7.3 the module is aurora.ko, so the parameters live under /sys/module/aurora.

echo 2 | sudo tee /sys/module/aurora/parameters/m3_render_batch_override

Then scroll a long page full of images in Chromium. With the patch nothing needs setting. Writing 1 to the override or booting with aurora.m3_render_batch_size=1 goes back to batch 1.

I asked about the default on omacom/linux-aurora#385 and didn't hear back, so I'm proposing it here. If anyone has a J613, a run with the override set to 2 would cover the one board I can't test.

Assisted-by: LLM (Claude:Opus 5.5)

@freber

freber commented Nov 18, 2026

Copy link
Copy Markdown
Author

Claude Code wrote this up from my tests.

I repeated the A/B with 7.3 on my J615 (15-inch M3 Air). The kernel is integration/aurora 59b02d5ef with this PR, #1985, #2145 to #2157 and a port of omacom/linux-aurora#410, #491 and #500 on top of #2147. Same images scene as in the description, Chromium 156.0.8078.79 full screen on the built-in panel. I switched m3_render_batch_override at runtime in the order 1, 2, 1, 2, with four 20 s runs per leg.

The gain depends on the CPU governor. Under schedutil, which the balanced and power-saver profiles use, batch 2 cuts dropped frames by about a quarter. Under the performance governor neither size drops any.

Batch 1 Batch 2 Batch 1 Batch 2
schedutil, dropped frames 8.4 % 6.7 % 9.9 % 6.8 %
schedutil, latency p95 117 ms 101 ms 117 ms 100 ms
performance, dropped frames 0 % 0 % 0 % 0 %
performance, latency p50 42 ms 42 ms 34 ms 34 ms

The schedutil runs were on a kernel without #2199, where every profile ends up on schedutil. The performance runs had #2199 added. The first performance pair ran a few minutes after boot and both sizes sat at 42 ms there.

In an earlier boot where the memory floor from #1985 had stopped, the schedutil A/B gave 23.7, 17.3, 23.2 and 17.0 % dropped frames. gpubench throughput didn't move (batch 1 320 fps against batch 2 312 fps in the same hour), as on 7.2.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 3.

  1. drivers/gpu/drm/asahi/m3/m3_runtime.rs:248-253: the comment that keeps the first draw alone records that on J613 a second pass in the same batch failed with firmware error event 4 (draw=2 batch=2). With this change every J613 publishes render batches of two by default, and the PR has no J613 run. Holding back only the InitBM draw may well be enough, but that needs a J613 boot at the new default with the Chromium scene and a multi-draw burst before it ships there.
  2. Every measurement here ran with asahi.t8122_pstate_cap=5 on the command line and set the batch size through the runtime override, and no kernel was built from this branch. Show the change on the default command line (default p-state cap, no override written, no tmpfiles entry), with a kernel built from this head. That is the configuration this default ships in.
  3. Commit 154eedd carries Assisted-by: LLM, Co-Authored-By: Claude Opus 5.5 and a Claude-Session: URL. Keep only the human Signed-off-by in the commit. In the PR body, drop the session link and the "Generated with Claude Code" line, and end it with Assisted-by: LLM (<Vendor>:<Model>).

The code change itself is a one-literal default (drivers/gpu/drm/asahi/m3/m3_params.rs:209). render_batch_size() still clamps it to the pass-layout slots, and the pipeline depth and batch budget still bound each batch (m3_runtime.rs:260-269), so nothing else moves.

HW row: J613 and J615, kernel built from this head, default command line (no t8122_pstate_cap, no m3_render_batch_override): Chromium images scene, 3x20 s under the balanced profile, dropped frames and p95 latency against the same kernel booted with asahi.m3_render_batch_size=1; an 8-draw glprobe burst showing >1 render command per retirement with no firmware error event; a gpubench run; then 0 AVC, 0 failed units, 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

The M3 runtime publishes one render pass at a time unless
asahi.m3_render_batch_size or the writable m3_render_batch_override
asks for more. On a J615 (15-inch M3 MacBook Air) that costs frames
while Chromium scrolls an image-heavy page. Make the boot default 2.

Measured on a J615 with the stock 7.2.11 aurora16 module, whose
next_batch() and render_batch_size() match this tree's, booted with
asahi.t8122_pstate_cap=5 and setting m3_render_batch_override at
runtime. Chromium images scene, median of three runs:

  batch   dropped frames   p99 frame interval
  1       2.2 %            33.3 ms
  2       0 %              16.7 ms
  4       0.1 %            16.7 ms

Two same-session control runs at batch 1 dropped 2.6 % and 2.4 %. With
2, a burst of eight glprobe draws retired 1.6 render commands per
retirement instead of 1.0, its median fell from 4.53 ms to 4.00 ms and
GPU mailbox interrupts per run fell from 320 to 200. gpubench
throughput and idle power stayed within noise. The kernel log had no
GPU errors.

Only T8122 is affected. This parameter exists only with
CONFIG_DRM_ASAHI_M3_T8122, its only reader is the runtime's
next_batch(), the runtime's only SoC table is T8122 and it starts only
on the J613 and J615. T6030 and T6031 keep the G15 backend or the
probe refusal. The first render draw is still published alone for
InitBM, and the T8122 pipeline depth of 2 and the 4000 us batch budget
still bound every batch. m3_render_batch_override=1 restores the old
behaviour at runtime, asahi.m3_render_batch_size=1 at boot.

A 7.3 kernel built from this head with aurora-silicon#1985, aurora-silicon#2199 and aurora-silicon#2203 merged
then booted on a J615 with the default command line. In the same
Chromium scene under the balanced profile at panel scale 1.6, median
of three runs, 11.8 % of frames dropped at the
default of 2 against 15.6 % on the same kernel booted with
asahi.m3_render_batch_size=1. The eight-draw glprobe burst retired
1.52 render commands per retirement against 1.00. The kernel log had
no GPU errors. aurora-silicon#2203 raises that build's ceiling to state 8.

The J613 runs the same runtime and gets the same default but was not
tested. Neither was a 7.3 build at the T8122 ceiling of 2 that
applies without aurora-silicon#2203.

Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
freber added a commit to freber/linux that referenced this pull request Nov 22, 2026
…mplete die key list

States 6 to 8 were reachable only with asahi.t8122_pstate_cap and
asahi.m3_thermal=on. The measured behaviour needed two more boot
parameters. A machine should not need boot options to run as intended.
The behaviour belongs to the hardware description.

Make the ceiling default to 8 on a T8122 whose device tree has a node
with apple,soc-die-keys-complete while the thermal limit is on, which is
the default. The property says that the firmware provides every key in
apple,soc-die-keys. The hwmon driver then registers the macsmc_soc_die
zone only with all of them present. In the tree only the J615 sets it.
J613 and J504 list the same keys through t8122.dtsi but are not
confirmed to provide them all, so they keep the old ceiling of 2. So
does an unset cap with asahi.m3_thermal=off or hold.
asahi.t8122_pstate_cap still sets any ceiling from 1 to 8 and is now
only an override.

The ceiling goes to the firmware in the InitData before the GPU starts,
when the hwmon driver may not have probed yet. So the default follows
the property, not whether the zone exists at that point. The runtime
cap still starts at 2 and falls back to 2. It rises only while the
limit reads a usable temperature from that zone, so a J615 whose zone
did not register stays at 2.

The limit's thresholds follow the same rule. With the property, hot
defaults to 90 C and the cool gap to 3 C. Elsewhere the old 80 C and
10 C stay, so the other M3 boards are unchanged.
asahi.m3_thermal_hot and asahi.m3_thermal_cool_gap are overrides.
Sysfs shows "default" while they are not given.

The choice of 90 C with a gap of 3 C comes from the J615 measurements.

  hot, gap   throughput   sustained 600 s   combined peak
  80, 10     218 fps      80.0 fps          95.8 C
  85, 10     272 fps      79.9 fps          not run
  90, 3      289 fps      88.1 fps          94.4 C
  92, 3      295 fps      95.2 fps          93.9 C

At 90 C with a gap of 3 C a 600 s GPU load held the hottest GPU key at
93.8 C with no missed frames. With a gap of 10 C the cap never left
state 2 under a sustained load, because the die settles a few degrees
under hot but above hot minus 10. The 85 C of the released form gave no
sustained gain while 80 C cost throughput. 92 C is a little faster, but
the GPU keys then reach 95.9 C, above the 94 C GPU die target in the
boot firmware's tree. 90 C is the highest value that stays under it in
the measurements. Critical is then 98 C, below the 110 C trip of the CPU
thermal zones. Critical or any loss of a reading returns the cap to 2.

This was measured on a J615 only, the one board that sets the property.
A 7.3 kernel built from this branch with aurora-silicon#1985, aurora-silicon#2090 and aurora-silicon#2199 merged
booted there with the default command line. The cap rose from 2 to 8
once the die reading arrived and gpubench w4 gave 322 fps. Of three
600 s w10 loads at the default, two ran to the end at 126 and 122 fps
with the hottest die key at 93.0 C. The third stopped at the test's
95 C guard after 416 s when one die reading reached 99.2 C, where the
98 C step returned the cap to 2. A half-second trace of the same jump
on a later load showed a one-second burst on every CPU core, which
lifted the CPU keys by 13 to 16 C while the GPU keys rose about 4 C.
The host tests in tools/asahi/m3-runtime-tests.rs cover the new
defaults and that the old defaults remain without the property.

Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
@freber
freber force-pushed the t8122-render-batch-2 branch from 154eedd to a8969bf Compare November 22, 2026 13:41
freber added a commit to freber/linux that referenced this pull request Nov 22, 2026
The 15-inch M3 MacBook Air (J615) has the J613's SoC, DRAM, PMP tables
and PACC0 request layout. Its device tree is a legacy handoff tree. The
report binds the generic "apple,t8122-pmp-v2-report" and names its PMP
with apple,pmp. This driver starts that PMP, which runs the 14.x
firmware (3B18C886-4C70-349B-B1C4-70F35DE2C5CD). Without a memory floor
nothing raises the DRAM or fabric state for the CPUs. A 4-thread membw2
read then reaches 19.8 GB/s.

Give its report apple,cpu-memory-floor = <0x21 2 0x25 4>. The levels
come from the J615 runs of the earlier J615 floor patch, not from the
J613 tree. That patch stored DCS 4 in bits 51:48 and fabric level 2 in
bits 35:32 of the PACC0 request, word 0x2004000200000000. Those are the
lanes of request classes 0x25 and 0x21, so these pairs build the same
word. The 14.x PMP answered it with DVFS-STATE 0x24 within 5.1 ms. That
is class 0x25 at 4 in the low nibble with class 0x21 at 2 in the high
nibble. In one boot it confirmed 39 of 39 raises and 38 of 38 releases.
With the floor the same membw2 read reached 68.2 GB/s. The levels equal
the J613's because the SoC, DRAM and PMP tables are the same, but they
were measured on this board.

The driver needs no change. pmp_floor_probe() runs for any report with
the property. pmp_floor_find_pmp() takes the report's apple,pmp without
an availability check, so it does not matter that the PMP is still
disabled when the report probes. The start work waits for the report to
read READY. It does once the PMP runs, which apple_pmp_start_init()
arranges when the display asks for it. Admission then reads the tables
m1n1 fills in on the PMP node. Run on this board's live tables, the
upstream check admits 2 CPU clients and puts the PACC0 update alias at
+0x10888, where the earlier patch wrote it. pmp_floor_word_of() builds
0x2004000200000000 from the pairs. The binding already allows the
property on apple,t8122-pmp-v2-report.

The generic T8122 report does not set floor_confirm. Raises and
releases are published without the DVFS-STATE check, as on every report
but the J613 25G83 one.

The experimental t8122-j615-25g83 tree includes this file. It binds the
native J613 report, where the floor has not run on a J615. It deletes
the property so that it stays uncovered, as it was before.

Tested by building both J615 trees. Decompiled, the J615 report carries
the property while the 25G83 report has none. pmp-report.o builds with
clang 18. The floor ran on a J615 with the 14.x firmware on a 7.2.11
kernel carrying the earlier patch. A 7.3 kernel built from this tree
with aurora-silicon#2090, aurora-silicon#2199 and aurora-silicon#2203 merged then booted on a J615 with the 14.x
firmware and the default command line. The report admitted the floor
from the property with the PACC0 update alias at +0x10888. During three 4-thread membw2 reads the floor was up,
DVFS-STATE read 0x24 each time and the read reached 69.3 GB/s. The
boot logged no floor fault or refusal. On a later boot of the same
kernel the read gave 21.6 GB/s with the floor's enable attribute at 0
and 69.3 GB/s with it at 1.

Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
@freber

freber commented Nov 22, 2026

Copy link
Copy Markdown
Author

Claude Code wrote this up from my tests.

Here's the J615 half of the row on a kernel built from this head. The J613 half is still open.

The kernel is integration/aurora 24dc42277 with this PR's commit merged, together with #2199, #1985 and #2203 (the reworked versions of the last two). I built it before today's rewrite of the commit message, which left the tree as it was, so the pushed head has the same code. It also carries a LOCAL TEST ONLY commit that keeps the DRM name asahi because my installed Mesa doesn't accept aurora yet. The default boot had no aurora.* or pmp_report.* words, so no t8122_pstate_cap. m3_render_batch_override read 0 on both boots. My old 7.2 tmpfiles entry is still installed, but it writes to /sys/module/asahi/parameters/m3_render_batch_override, which doesn't exist on this tree, so it wrote nothing. The comparison boot was the same kernel with aurora.m3_render_batch_size=1 (the module is aurora.ko here).

The Chromium test is the images scene from the description, 3 runs of 20 s under balanced at panel scale 1.6. The glprobe burst test is 20 bursts of 8 render passes.

Default (batch 2) Booted with batch size 1
Dropped frames, median of 3 runs 11.77 % 15.55 %
Dropped frames per run 12.02, 10.76 and 11.77 % 15.55, 16.13 and 15.46 %
Latency p95 116.6 ms 116.7 ms
Latency p50 83.5 ms 100.0 ms
Render commands per retirement 1.52 (202 in 133) 1.00 (202 in 202)
Burst p50 (clear plus glFinish) 4.79 ms 5.41 ms
Firmware error events 0 0

Batch 2 cuts the median drop rate from 15.55 to 11.77 percent and takes one refresh off the p50 latency. The p95 doesn't move. A fourth run on each boot gave 11.26 and 16.01 percent. The retirement counts cover every render on the GPU during the burst, Hyprland's frames too. gpubench throughput on the default boot was 321.8, 322.5 and 322.1 fps. The drop rates are higher than in the A/B in the PR description, which ran on 7.2 with t8122_pstate_cap=5 and the runtime override, so the two sets don't compare directly.

This build carries #2203, which by default lets the J615's runtime cap rise to state 8 while the die stays under the 90 C limit. Without #2203 the default ceiling is 2, so batch 2 at ceiling 2 is still unmeasured. I can boot a kernel without #2203 if you want that row as well.

HW row: J615, kernel built from this head merged into integration/aurora 24dc42277 (with #2199, #1985 and #2203), default command line (no t8122_pstate_cap, no override written): Chromium images scene, 3 runs of 20 s under balanced, 11.77 % dropped and p95 116.6 ms against 15.55 % and 116.7 ms on the same kernel booted with aurora.m3_render_batch_size=1; 8-draw glprobe burst 1.52 render commands per retirement (1.00 at batch 1) with no firmware error event; gpubench throughput 322.1 fps; 0 AVC denials, 1 failed unit, 2 new kernel errors on both boots.

The failed unit is speakersafetyd. My boot loader passes no amp levels, so the kernel turns the speakers off. The two new kernel errors were logged at boot both times, before the tests started. The video encoder finds no preloaded firmware and the camera firmware doesn't answer. Neither touches the GPU.

For the J613 I still need someone with the 13-inch Air. @satchlj or @r0mish, would one of you have time to boot a kernel built from this head with the Chromium scene and the 8-draw burst? If the firmware error event 4 from the comment in m3_runtime.rs still happens at batch 2, the burst is where it would show up.

The commit now carries only my Signed-off-by and the description ends with Assisted-by: LLM (Claude:Opus 5.5) with no session link. The description also has these rows now, where it used to say the branch was host-tested only.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the 7.3 rows.

Rows still missing: the J613 as above, and the J615 at the ceiling of 2.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 gpubench row on a kernel without #2203, for the "J615 without #2203" item above.

The kernel is the current J615 fleet default, 7.3.0-aurora-fleet81: integration/aurora plus open heads, including #2781 but neither this PR nor #2203. It booted on the default command line. The batch size was switched at runtime with m3_render_batch_override (next_batch() reads the override ahead of the default), in the order 1, 2, 1, 2, and set back to 0 afterwards. I used gpubench ae90a40 with system Mesa, headless. The table gives µs per submit at queue depth 8.

Row Batch 1 Batch 2 Batch 1 Batch 2
render.light tri 500.0 360.8 500.0 361.3
render.light clear 394.3 370.9 395.6 393.7
render.heavy fill 1080p 634.5 595.2 628.1 595.2
compute.light 394.3 390.6 394.3 373.1

There were 0 firmware error events and 0 GPU failures in the boot log before and after the four legs.

Batch 2 cuts light render submits by 28% and the 1080p fill by 6%. Compute doesn't move, as expected, because the change touches only render batches. The same J615 on its previous default, which carried this PR together with #2147 and #2203, measured 361 µs for render.light tri. The fleet kernel without this PR measured 500 µs. So the fleet kernel's slower light rendering on the J615 comes entirely from this PR not being in it.

Still open: the J613 row, which needs a J613. This row also doesn't repeat the Chromium scene or the 8-draw burst on a kernel without #2203.

Assisted-by: LLM (Claude:Opus 5.5)

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