Repository navigation
Conversation
|
Review at 95f042d. Thanks, the measurements are clear (denoise-640 cold-SLC 20.0 -> 10.4 ms, fabric 4 flat, P-cluster floor no effect), and the change uses the existing H17 busy hook, so the floor is released by the same idle/error/power-down paths as on T6040/T8140. Points:
|
The H17 ANE driver on T8142 (M5) already requests an ANE CLPC handle
via apple_clpc_ane_get() and publishes activity via
apple_clpc_ane_set_active(), and the T8142 device trees already declare
"apple,t8142-clpc", but drivers/soc/apple/clpc.c neither lists
"apple,t8142-clpc" in apple_clpc_ane_providers[] nor configures a floor
in apple_clpc_hw_t8142.
When the CPUs are idle or lightly loaded, both the DRAM controller (DCS)
and SoC fabric stay at low states while ANE inference runs, throttling
memory- and fabric-bound workloads. Register "apple,t8142-clpc" as an
ANE CLPC provider and set apple_clpc_hw_t8142.ane to DCS 7 (top DCS
state) and fabric 3 (a measured policy choice below top fabric state 4).
Measured on J813 (MacBook Air 13" M5; J815 and J704 share the
compatible and were not tested) via /sys/kernel/debug/ane-h17/.../
execute, CLPC ane_states, and macsmc_hwmon Total System Power:
- Cold-SLC denoise-640 firmware time (CPU fixed at 1 GHz, pre-exec
floor 0): 20.02 ms at (0, 0) -> 16.02 ms at (7, 0) -> 15.79 ms at
(7, 1) -> 11.71 ms at (7, 2) -> 10.37 ms at (7, 3); (7, 4) is
10.36 ms (no gain).
- Cold-SLC mm-512x2048 firmware time: 782 us at (0, 0) -> 728 us at
(7, 0) -> 560 us at (7, 2) -> 526 us at (7, 3); (7, 4) is 552 us.
- Controlled A-B-A sweep (CPU pinned at min freq so ANE owns the floor)
across three workload classes shows fabric 3 saturates firmware time
while fabric 4 adds 71-121 mW with zero speedup:
* denoise-640 (conv UNet): 16.48 ms (0, 0) -> 11.67 ms (7, 2) ->
10.33 ms / 4.284 W (7, 3) vs 10.35 ms / 4.405 W (7, 4) (+121 mW).
* unet-320 (conv UNet): 3.94 ms (0, 0) -> 2.79 ms (7, 2) ->
2.46 ms / 3.944 W (7, 3) vs 2.46 ms / 4.035 W (7, 4) (+91 mW).
* mm-512x2048 (GEMM): 627 us (0, 0) -> 493 us (7, 2) ->
420 us / 3.948 W (7, 3) vs 420 us / 4.019 W (7, 4) (+71 mW).
- Default schedutil (warm SLC, 100 runs) denoise-640 firmware / p50
host latency: 11.60 / 15.43 ms at (0, 0) -> 10.35 / 13.90 ms at
(7, 3); (7, 4) adds +95 mW (4.841 vs 4.746 W) with no fw speedup.
- Sustained 10.5 min (631 s, 45,164 runs) continuous denoise-640 soak
on fanless J813: 4.717 W mean total system power, SoC die plateaued
at 31.7 C (21.8 C ambient), 0 CLPC update errors, bit-exact sha256.
Closing /dev/accel/accel0 drops the floor to 0x0 within 1 s and
returns idle system power to 2.48 W (vs 2.52 W median pre-soak).
Under combined ANE + 10-core CPU load, PMP fast-die-effort (lane1)
still engages cleanly at 96.7 C and holds die temp <= 99.6 C.
- Pinning CPU P-cluster frequency from 1.0 to 4.46 GHz does not change
ANE firmware time (10.25 vs 10.24 ms), so no CPU cluster floor is
needed.
Update the apple-clpc-gpu KUnit suite to assert T8142's DCS 7 / fabric
3 ANE demand instead of expecting no ANE floor on T8142.
Signed-off-by: Bartosz Nitka <niteria@gmail.com>
95f042d to
07effed
Compare
|
Thanks for the review! Updated at
Re-ran |
|
Re-checked at 07effed. The delta from 95f042d is the comment above
Nothing else from my side. LGTM. Assisted-by: LLM (Claude:Opus 5.5) |
Problem
On T8142 (M5), the H17 ANE driver already calls
apple_clpc_ane_get()and publishes in-flight work viaapple_clpc_ane_set_active(), and the T8142 device trees already declare"apple,t8142-clpc". However,drivers/soc/apple/clpc.cneither lists"apple,t8142-clpc"inapple_clpc_ane_providers[]nor sets a floor inapple_clpc_hw_t8142.ane. When the CPUs are idle or lightly loaded during ANE inference, both the DRAM controller (DCS) and SoC fabric drop to low states, throttling memory- and fabric-bound workloads (for example, cold-SLCdenoise-640firmware time degrades from10.37 msto20.02 ms).Change
{ .compatible = "apple,t8142-clpc" }toapple_clpc_ane_providers[].apple_clpc_hw_t8142.aneto{ [APPLE_CLPC_DCS] = 7, [APPLE_CLPC_SOC] = 3 }with a comment documenting that DCS 7 is T8142's top DCS state and fabric 3 is a measured policy choice below top fabric state 4, backed by three workload classes (denoise-640,unet-320conv UNet,mm-512x2048GEMM) and the measured power cost of fabric 4.apple-clpc-gpuKUnit suite to verify T8142's DCS 7 / fabric 3 ANE demand instead of assertingapple_clpc_hw_t8142.ane[APPLE_CLPC_DCS] == 0.This applies to every T8142 Mac declaring
"apple,t8142-clpc"(t8142-j813,t8142-j815,t8142-j704) with no DT changes and no kernel command-line parameters. Only J813 (MacBook Air 13" M5) was tested on hardware. Pinning P-cluster CPU frequency from 1.0 to 4.46 GHz does not change ANE firmware time (10.25 msvs10.24 ms), so noane_cluster_khzfloor is set.Testing
Tested on MacBook Air 13" M5 (J813, T8142) on a one-shot NixOS boot of
95f042dcd43f(7.3.0-air-m5-95f042dcd43f, identical object code to07effed23425which updates only the comment and commit message) on the default kernel command line (noane_statesoverride):agent1 floor: 0x00000000 honoured: 0x00000000. During ANE execution with both CPU clusters votingdcs 0 soc 0, CLPC votes0x00000037(reason_bits 0x20,ane=32), PMC reportsagent1 floor: 0x00000037 honoured: 0x00000037, and after inference completes + hold expiry it drops cleanly back to0x00000000(update errors: 0).(0, 0)fw / host p50(7, 3)fw / host p50denoise-640(cold SLC, 1 GHz CPU)20023 us/25443 us(ioctl mean)10371 us/14076 us(ioctl mean)-48.2%mm-512x2048(cold SLC, 1 GHz CPU)782 us/2112 us(ioctl mean)526 us/1532 us(ioctl mean)-32.7%denoise-640(defaultschedutil, 100 runs)11597 us/15426 us10353 us/13984 us-10.7%denoise-320(defaultschedutil, 100 runs)3767 us/4429 us3576 us/4136 us-5.1%mm-512x2048(defaultschedutil, 100 runs)435 us/736 us416 us/712 us-4.4%unet-320(defaultschedutil, 100 runs)2495 us/2728 us2440 us/2610 us-2.2%xf-l-256(defaultschedutil, 100 runs)738 us/774 us680 us/700 us-7.8%xf-a-128(defaultschedutil, 100 runs)259 us/270 us235 us/242 us-9.5%(7,3)->(7,4)->(7,3)viamacsmc_hwmonTotal System PowerPSTR, CPUs pinned at min frequency so ANE owns the floor):(0, 0)fw / power(7, 2)fw / power(7, 3)fw / power (A-B-A mean)(7, 4)fw / power(7, 4)vs(7, 3)denoise-640(conv UNet denoiser)16484 us/3.490 W11665 us/4.179 W10328 us/4.284 W10345 us/4.405 W0%fw,+121 mW(+2.8%)unet-320(conv UNet)3939 us/3.352 W2787 us/3.843 W2462 us/3.944 W2463 us/4.035 W0%fw,+91 mW(+2.3%)mm-512x2048(GEMM)627 us/3.378 W493 us/3.901 W420 us/3.948 W420 us/4.019 W0%fw,+71 mW(+1.8%)Under default
schedutilondenoise-640,(7, 4)likewise adds+95 mW(4.841 Wvs4.746 WA-B-A mean at(7, 3)) with no firmware speedup.schedutil, defaultane_states = 7 3, ambientTAOL21.8 C):PSTR)macsmc_soc_die)agent1floor / thermal30 s2.600 Wmean (2.524 Wmed)27.0 -> 26.8 C0x00000000(28/30),ane: active 0denoise-640soak631 s(10.5 min,45,164runs)4.717 Wmean (steady4.70-4.75 W)26.8 -> 31.7 C(plateaued31.5-31.7 C)0x00000037held,cool=0,0,dcs limit: 0/7,err=0fw_p50steady10342-10355 us, exact sha256close(/dev/accel/accel0))0-90 s2.475-2.477 W(30-90 ssteady)31.7 -> 27.2 C0x00000000within1 s,ane: active 0,err=0denoise-640+ 10-core CPU burn)75 s(6,366ANE runs)31.39 Wpeak ->26.61 Wthrottled96.7 Ctrigger, held<= 99.6 Clane1engaged (33..96), P-cluster4464 -> 3720-4020 MHz,err=0PM: suspend exit,H17 ANE: resume ok: parked until the next request). Post-resumedenoise-640(50 runs) ran at10310 usfirmware /13906 usp50 with bit-for-bit sha256 match, raisingagent1 floorto0x00000037(honoured: 0x00000037,reason_bits 0x20) and returning cleanly to0x00000000at idle (update errors: 0).07effed23425:scripts/checkpatch.pl --strict --git HEAD~1..HEAD(0 errors, 0 warnings, 0 checks),tools/asahi/clpc-gpu-demand-tests.py(pass),tools/asahi/clpc-high-power-cleanup-tests.py(pass), arm64 KUnitapple-clpc-gpu(11/11 passed), full arm64 J813 kernel build.Still to run
t8142-j815MacBook Air 15" M5 andt8142-j704MacBook Pro 14" M5), which share"apple,t8142-clpc"(only J813 was tested).Minimal DCS / fabric state sweep on J813 (cold SLC and warm SLC)
All per-phase timings read from
/sys/kernel/debug/ane-h17/420000000.ane/execute(mean microseconds).Cold SLC (64 MiB eviction + 250 ms idle wait before each EXECUTE, CPUs fixed at 1.0 GHz, pre-exec CLPC floor
0x0)ane_states(DCS, SOC)denoise-640firmwaredenoise-640copy_outdenoise-640ioctlmm-512x2048firmwaremm-512x2048copy_outmm-512x2048ioctl(0, 0)20023.13893.525442.8781.7937.12111.5(7, 0)16020.82421.019778.5727.7672.41759.8(7, 1)15787.52423.219741.7721.4674.71750.5(7, 2)11710.12359.315430.7559.6657.81575.6(7, 3)10371.02328.014076.2525.9655.21531.6(7, 4)10361.82322.714112.6552.1646.81568.2(0, 3)10381.32728.714442.9538.2747.51648.7(4, 3)10351.92407.814076.6529.7663.91559.5(6, 3)10360.02380.714131.5533.7662.21549.4(0, 4)10378.52745.814443.0532.9747.71683.5(6, 4)10360.92361.314047.9539.3660.91558.5Warm SLC (40 runs each, CPUs fixed at 1.0 GHz, pinned to
cpu1)ane_statesxf-l-256fwmm-512x2048fwunet-320fwdenoise-320fwdenoise-640fw(0, 0)837.1453.22771.04097.811783.9(7, 0)839.9454.12765.14048.711816.7(7, 2)839.3454.82767.94048.011756.1(7, 3)772.1388.72441.63580.310316.5(7, 4)774.8389.82446.83712.010307.7CPU cluster frequency control (
ane_states = 7 4)denoise-640firmwaredenoise-640copy_in + copy_outmm-512x2048firmware1.00 GHz / 1.00 GHz / cpu110250.2 us3585.9 us389.5 us4.46 GHz / 1.00 GHz / cpu110299.1 us3522.9 us388.3 us4.46 GHz / 2.96 GHz / cpu010244.9 us583.5 us403.4 usCPU frequency changes only host-side
copy_in/copy_out, not ANE enginefirmwaretime.CLPC / PMC debugfs capture (boot, post-close, and post-resume on 7.3.0-air-m5-95f042dcd43f)
Assisted-by: LLM (Gemini 4 Neon)