Repository navigation
drm/asahi: g15: keep short-prefix VMs ahead while a flight has room - #2756
Conversation
|
Thanks, this is a clear write-up and a big win on the two-client case. I read it against What holds:
What it needs before merge:
Attribution: the commit carries Assisted-by: LLM (Claude:Opus 5.5) |
9ce9dd0 to
6f93a3b
Compare
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review at live head 6f93a3b3ec74dad6c9de32481ce665d42a4d2137: 0 functional code bugs, 0 §1/§3/§4/§6 blockers, and host-tests CI is green, but requesting changes for §2 checklist blockers and incomplete §5 performance/hardware evidence.
Technical check (code is sound)
- Scheduling & ordering (
g15/engine.rs:514-547, 629-670):pick_affine()preserves priority ordering (job.queue.priority > priorityskips strictly lower-priority jobs, so a lower-priority tail VM cannot preempt a higher-priority queue) and per-queue submission order (strictt < bttie-break keeps the oldest pending job of a queue first). Whenflightsdrains (!behind),affinity_runresets cleanly and multi-VM round-robin handoff stays symmetric across 2+ VMs. - Prefix EWMA (
g15/poll.rs:537-542,g15/vm.rs:192):stat_retire()only updatesVmState::prefix_nsonresult.is_ok()retirements, uses overflow/underflow-safeold - old / 4 + d / 4, and measures publication-to-retirement latency so queuing behind an in-flight prefix naturally tightens the gate under contention. - Attribution (§4): Clean on
6f93a3b3— human author/committer and humanSigned-off-byonly; PR body ends withAssisted-by:.
Blockers before APPROVE
- §2 Default command line & target tree (hard rule): All hardware numbers come from an older
7.2.11-14-1-ARCHpackage kernel booted withmodprobe.blacklist=asahiand a manuallyinsmod-loaded module; the PR has not been run onintegration/aurora(7.3) or on the default kernel command line. Please re-prove onintegration/aurorabooted normally with the default command line. - §2 Unjustified fairness constants (hard rule — no magic delay/depth):
AFFINITY_RUN = 8andAFFINITY_NS = 2_000_000(2 ms) are hardcoded fairness limits with no derivation or sweep in the commit message or PR body. Please either show a small sensitivity sweep (e.g.4/8/16prefixes and1/2/4ms across the two-client and heavy+light workloads) or tie them to a measured quantity such as cross-VM drain latency, and record the basis in the commit message. - §5 Performance A/B & evidence gaps:
- Re-run the heavy+light A/B under identical conditions for stock and patched (currently stock ran with Hyprland active while patched ran headless in a blacklist boot).
- Add a conformance check (
deqp-vksmoke / Vulkan CTS) confirming 0 new failures (currently under "Not tested"). - Add a compositor frame-time measurement under concurrent GPU load to verify the 2 ms gate protects desktop responsiveness.
- Include the §5 boot regression check (
0 SELinux denials, 0 failed units, 0 new kernel errors) on the normalintegration/auroraboot. - Ask for (or include) a two-client A/B on another G15 SoC (e.g. M3 T8122 Air or T6030/T6034) since this engine code applies across G15.
Assisted-by: LLM (Gemini 4 Neon)
publish() posts a second prefix behind a running one only if it belongs
to the same VM, and pick() serves the least recently served queue first.
With two or more GPU clients the two rules alternate the VMs on every
prefix: each prefix of another VM waits for the flights to drain and for
the host to see the retirement before it is published, so the second
flight is never used. On a J516C (T6031) two vkmark clients get 1143 fps
together where one alone gets 2099.
When the round-robin pick is another VM's job and a flight can still
take a prefix behind the tail, pick_affine() publishes the best ready
job of the tail's VM instead, at the round-robin pick's priority or
higher. It stops after AFFINITY_RUN (8) prefixes or AFFINITY_NS (2 ms)
from the first of a run, and applies only while the tail VM's prefixes
average under AFFINITY_NS from publication to retirement
(VmState::prefix_ns, a moving average updated in stat_retire()). Only
the order among independent queues changes; each queue's jobs stay in
submission order, and priority still wins. aurora-g15/stats counts these
picks as "affine".
Both limits bound how long another client waits: at most AFFINITY_NS
plus one prefix beyond the drain it already waited for. They come from
measurements on the J516C (aurora-g15/stats, vkmark):
- The drain costs about 0.4 ms per switch: two 3456x2234 clients
publish a prefix every 0.87 ms when each waits for the drain, one
client every 0.48 ms with two flights.
- Light clients' prefixes average 0.85-0.95 ms from publication to
retirement, an 8192x8192 blur's 3.9-5.0 ms. 2 ms keeps the first
ahead and the second on the alternation, with about 2x margin each
way, and is a quarter of a 120 Hz frame.
- A sweep, two clients, total fps (3456x2234 / 800x600): 4 prefixes
1805 / 3379, 8 1826 / 3414, 16 1840 / 3463; 1 ms 1524 / 3444,
2 ms 1826 / 3414, 4 ms 1948 / 3394. Heavy+light is 136-137 / 158-160
fps in every case. 16 prefixes gains 1% for twice the run; 1 ms
closes the gate for full-size prefixes; 4 ms gains 6% at 3456x2234
but doubles the other client's wait and admits the blur's prefixes.
integration/aurora, J516C, booted normally (Hyprland running), vkmark
shading=phong, total fps of all clients, mean of 3:
3456x2234 1 client 2099 -> 2088
2 clients 1143 -> 1826 (+60%)
3 clients 1100 -> 1792 (+63%)
800x600 1 client 3186 -> 3240
2 clients 2450 -> 3414 (+39%)
3 clients 2078 -> 3386 (+63%)
An 8192x8192 blur beside an 800x600 client: heavy 129 -> 136 fps,
light 150 -> 158 fps. Hyprland at 120 Hz with a vsync'd window: 120 fps
before and after beside two light clients, 41 -> 57 fps beside the blur.
Signed-off-by: Naeem Malik <[email protected]>
6f93a3b to
1d39569
Compare
|
Thanks @RyanTheTide and @DjDeveloperr. Pushed 1. Run on this tree, booted normally. The installed Omarchy Mesa (Oct 31) doesn't accept the 2. 8 prefixes and 2 ms. Both are tied to measurements, and a sweep picked them (one boot per variant, two clients, total fps at 3456x2234 / 800x600):
Heavy+light is 136 / 156–158 in every variant.
3. Compositor. Hyprland at 120 Hz, a vsync'd window plus headless clients. I measured present intervals from the DCP swap counter (
4. Other parts, conformance, regression.
Attribution: the trailer is gone from the commit, and the description ends with the Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-review against pre-pr-checklist.md (§1–§6) at verified live head 1d39569326220cbfa3ef7069f09061181a47c197: APPROVE (0 blockers, CI host-tests: pass, mergeable/clean).
Prior blockers — all resolved
- §2 Default command line & target tree: Re-proved on
integration/aurora(ffe545f, base + 28 non-asahi commits) on J516C (M3 Max, T6031, G15C), booted normally on the default command line with the driver loading on its own and Hyprland running; stock vs patched differ only inaurora.kounder identical conditions. - §2 Fairness constants (
AFFINITY_RUN = 8,AFFINITY_NS = 2 ms): Well-grounded by both cross-VM drain measurements (~0.4 ms/switch; light prefixes 0.85–0.95 ms vs 8K blur 3.9–5.0 ms) and the full4/8/16prefix and1/2/4ms sensitivity sweep across3456x2234,800x600, heavy+light, and compositor, recorded in both the commit message and PR body. No module parameters or switches added. - §4 Attribution: Clean — commit
1d395693carries human author/committer (Naeem Malik) and humanSigned-off-by:only, and the PR body ends withAssisted-by:. - §5 Evidence (complete for G15):
- Same-machine J516C A/B: 2-client
3456x22341143 → 1826 fps (+60%), 3-client 1100 → 1792 (+63%);800x6002-client 2450 → 3414 (+39%), 3-client 2078 → 3386 (+63%); 1-client within noise (−1% / +2%). - Heavy+light under matching conditions: heavy 129 → 136 fps, light 150 → 158 fps.
- Compositor (Hyprland
3456x2234@120 Hz, DCP swap counter): 120 fps / 8.33 ms p50 / 0 intervals > 12.5 ms beside 2 light clients; 41 → 58 fps (24.4 → 16.7 ms p50) beside 8K blur. - Conformance unchanged (
deqp-vkvulkan-cts-1.4.7.1, stock and patched identical, 0 failures acrossapi.smoke.*,synchronization.basic.*,compute.pipeline.basic.*,draw.renderpass.simple_draw.*). - Regression run: 0 failed units, 0 GPU errors, 0 new kernel errors (pre-existing BT/cpufreq identical across boots; SELinux disabled on Arch).
- Same-machine J516C A/B: 2-client
- §1 / §3 / §6: Clean. Code in
g15/engine.rs,g15/poll.rs, andg15/vm.rsis unchanged and verified sound (priority and per-queue FIFO ordering preserved, bounded affinity run resets on!behind, overflow-safe EWMA instat_retire()). The change is scoped to G15, and the author explicitly asked for confirmation runs on other G15 parts (T8122 Air / T6030 / T6034) they do not own, satisfying §1.
Assisted-by: LLM (Gemini 4 Neon)
|
Merge-train re-review (MERGETRAIN-LINUX3) at 1d39569: NO BLOCKERS. I checked that 1d39569 changes only the commit message against 9ce9dd0: the trees are identical (a125e69d), the parent is the same, and range-diff shows only message hunks. Our earlier review therefore holds at this head. Two nits, neither worth a re-push on its own. The commit message and the body give different fps figures (57 vs 58; 158-160 vs 156-158). The Signed-off-by uses a noreply address. Still to run: a two-client A/B on another G15 part and firmware, for example the M3 Air (G15G, 27.2 firmware). So far the only hardware row is J516C on 14.7. |
Summary
With two or more GPU clients, G15 never uses its second flight.
publish()(g15/engine.rs) posts a prefix behind a running one only if it is of the same VM, andpick()serves the least recently served queue first, so consecutive prefixes alternate VMs. Each prefix of the other VM then waits for the flights to drain and for the host to see the retirement before it is published. On a J516C onintegration/aurora, two vkmark clients get 1143 fps together where one alone gets 2099.This change keeps the tail's VM ahead while a flight has room, within bounds:
Engine::pick_affine(): when the round-robin pick is another VM's job and the flights can still take a prefix, publish the best ready job of the tail's VM instead (same order aspick(), at the round-robin pick's priority or higher).AFFINITY_RUN= 8 prefixes orAFFINITY_NS= 2 ms from its first pick, so the other client's queue is served next. Another client waits at mostAFFINITY_NSplus one prefix beyond the drain it already waited for.VmState::prefix_ns, a 1/4-weight moving average updated instat_retire()).aurora-g15/statscounts these picks asaffine Non thegaps …line.3 files, +89/−6:
g15/engine.rs,g15/poll.rs,g15/vm.rs.Results: MacBook Pro 16" M3 Max (J516C, T6031, G15C 40 cores)
integration/auroraffe545f(the PR base plus 28 commits, none indrivers/gpu/drm/asahi), booted normally on the default command line with the driver loading by itself and Hyprland running. Stock and patched differ only inaurora.ko(same kernel image, each in its own initramfs/UKI, one boot each). vkmarkshading=phong,duration=8, total fps of all clients, mean of 3:Clients stay evenly matched (e.g. 911 / 916 fps).
Heavy + light at the same time (
effect2d:kernel=blurat 8192x8192, besidephongat 800x600), same boots: heavy 129 → 136 fps, light 150 → 158 fps.Compositor: Hyprland at 3456x2234@120 Hz, a vsync'd (
fifo) 1280x800 vkmark window plus headless clients. Present intervals from the DCP swap counter (/sys/kernel/debug/dcp-j516c, polled every 0.5 ms), mean of 3:Why 8 prefixes and 2 ms
16 prefixes gains 1% for twice the run. 1 ms closes the gate for full-size prefixes. 4 ms gains 6% at 3456x2234 and kept the compositor beside the blur at 57 fps, but it doubles how long another client can be held and admits the blur's prefixes. The 4 ms 800x600 figure is from the full run; its sweep-only boot read 3681, which didn't reproduce.
Conformance and regression (same boots)
vulkan-cts-1.4.7.1), stock and patched identical:dEQP-VK.api.smoke.*8/8,dEQP-VK.synchronization.basic.*24 pass / 5 not supported,dEQP-VK.compute.pipeline.basic.*79 pass / 2 not supported,dEQP-VK.draw.renderpass.simple_draw.*4/4. 0 failures.Failed to read codec capabilities, cpufreqCannot enable BOOST). SELinux is not enabled on this install (Arch).Setup
integration/auroraffe545f+ this commit, built on the machine with clang/LLD 23.1.3 from the running kernel's config with debug info off (disk space),7.3.0-g15ab+. Booted as a Limine one-shot entry, so any reset returns to the default entry.mesa-aurora/vulkan-aurorad4ad4a4dce6fromaurora-silicon/alarm-auroratesting-20261121.4(the Oct 31 Omarchy build doesn't accept theauroraDRM name, so Vulkan and Hyprland don't start onintegration/aurorawith it).Not tested
Related
g15_max_inflight) and keeps the same-VM rule; it touches the samepublish()lines. The two combine: deeper flights make the affinity worth more, andAFFINITY_RUN/AFFINITY_NSstill bound the other client's wait.publish(); this change leaves long-prefix VMs on the existing alternation, which is the case drm/asahi: g16: accept the 8-core J713 loaded 25G83 image #389 targets, but the two need reconciling if both land.Assisted-by: LLM (Claude:Opus 5.5)