Repository navigation
soc: apple: clpc, drm/asahi: g17: busy-share memory floor and light effort for T604x - #1089
AxxzyWasTaken wants to merge 2 commits into
Conversation
On T6040 and T6041 any reported GPU work holds the top memory and fabric floor. At 120 Hz a scrolling browser keeps the GPU reported busy most of the time for a few percent of real execution, so light desktop use pays for the top DCS state. Let the GPU driver report its busy share per window with apple_clpc_gpu_set_busy() and pick the floor from a table: DCS 1, 2, 4 or 5 and fabric 0, 0, 0 or 2, split at gpu_busy_mid (160), gpu_busy_high (500) and gpu_busy_top (800) permille, all runtime parameters. A lower level must last 400 ms, a higher one applies at once. A GPU that reports no share, and every SoC without the table, keeps the top of the map. The CPU side had the same problem: a cluster at its own top speed asked for DCS 5 and fabric 2 even when that was the E cluster. Take the map quarters from 4.512 GHz for both clusters, and lower the T6040 map to DCS 1, 1, 3, 4 with fabric 0. On the M4 Max on AC, compared with the old table: scrolling 24.9 W to 22.1 W at 120 fps with no long frames, a page workload 23.84 W to 22.73 W for 0.9 % less score. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Sum the engine time every client is charged and report its share of a 200 ms window to CLPC, which then keeps the top memory and fabric floor for GPU work that really is busy. The same windows drive a light effort governor. Four quiet windows in a row (under 35 % busy, no job of 3 ms or more) drop the firmware to half effort, and 75 % busy or a 7 ms job goes back to full. Light effort runs the same work about twice as long, so the way out sits at about twice the way in, or work that fits light effort sticks at full. The share sent to CLPC is doubled at full effort so one floor table fits both. note_submission() returned effort_full, so the lockless path skipped the governor. It now takes the slow path when the governor wants light. g17_light_effort (65536 is full, 0 turns this off), g17_light_enter, g17_light_exit, g17_light_job_enter_us and g17_light_job_exit_us are runtime parameters. Effort sweep on the M4 Max with a 1080p30 clip: full 14.0 W, 32768 10.4 W, and below 50 % gained nothing. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
RyanTheTide
left a comment
There was a problem hiding this comment.
Merge-train review (overnight 11-07). Thanks, the busy-share floor reads well and the hysteresis is simple. Before this can merge it needs a J616s (T6040) run, because it changes the M4 Pro too, and not only through the GPU path:
- The T6040 CPU map drops.
mapgoes from DCS {1, 2, 5, 5} / SoC {0, 1, 2, 2} to {1, 1, 3, 4} / {0, 0, 0, 0}, andlevel_khz= 4.512 GHz rescales the quartiles for both clusters. That lowers the memory and fabric floor for CPU-only load on every M4 Pro, which is a separate change from the GPU busy share. We'll benchmark it on our J616s against fleet22: a memory-bound CPU workload (STREAM-style copy/triad, a kernel build), the GPU set (gpubench, glmark2, a dEQP slice) and idle/scroll package power. Perf changes need those numbers before merging, and none may regress. - Module parameters.
gpu_busy_top,gpu_busy_highandgpu_busy_midare runtime tunables (0644). We keep policy in the per-SoC tables, not in knobs. Could they be fields ofapple_clpc_hw(next togpu_busy) with these values for T6040/T6041? - Down-step timing.
apple_clpc_gpu_level()only moves down when it is sampled at least 400 ms after the last change, so the effective delay depends on when the CLPC sampler runs. That's fine as a floor, but the commit message should say "at least 400 ms". apple_clpc_status_show()callsapple_clpc_gpu_level(), so reading debugfs can move the level. It should readgpu->levelwithout updating it.
The J616s is busy until about 05:00 tonight. We'll post the numbers here, and if 2–4 are addressed and nothing regresses, it goes through the train.
|
Merge train 11-08 follow-up: #1137 (an ANE input for the CLPC on the T8140) just merged into integration/aurora and also edits |
RyanTheTide
left a comment
There was a problem hiding this comment.
host-tests fails on this head in clpc-gpu-demand-tests. The harness extracts apple_clpc_gpu_input_demand(), and that function now calls apple_clpc_gpu_level() and max_t(), which the extracted unit doesn't provide:
fixed.c:233: error: implicit declaration of function 'apple_clpc_gpu_level'
fixed.c:235: error: implicit declaration of function 'max_t'
To fix it, add static unsigned int apple_clpc_gpu_level( to the extracted items in tools/asahi/clpc-gpu-demand-tests.py, along with a max_t macro and the new struct apple_clpc_gpu fields (busy, busy_valid, level, level_since) in its stubs. A few cases for the busy-share table would help too: below gpu_busy_mid, between the thresholds, no share reported, and the 400 ms down-step hold.
The branch also still conflicts with integration/aurora in drivers/soc/apple/clpc.c, so it needs a merge or rebase as well.
|
Thanks for the review. All points are addressed in #1369 (head 1257b68, same title). The commit message change needed new history, so it's a new branch rebased onto current integration/aurora, and this branch stays as it was.
Tested on #1369's head: |
|
Replaced by #1369, rebased onto current integration/aurora with the review points addressed. |
Lowers power on the M4 Max in everyday use. On T6040/T6041, any reported GPU work holds the top memory and fabric floor, and the GPU runs at full effort for quiet work.
note_submission()no longer skips it.Effort sweep on a 1080p30 clip: full 14.0 W, half 10.4 W.
Tested: this logic has been the daily setup on my M4 Max since 5 Nov (7.3.0), with no GPU recoveries from it. Compared with that tree, I removed the trial debug parameters and moved the defaults to the values the Mac runs. This exact version is compile-tested on
integration/auroraand not booted.Please check:
aurora.g17_light_effort=0turns it off. Tell me if you'd rather have it scoped to T604x.