metal-linalg

Triangular solve routing: Apple M5 Pro, 20 GPU cores

From 1 run(s): 20261010-b7aec3.

Answer

Row for kTuned[] (src/tuned/trsm.inc, generated):

// device, GPU cores,   gpu_min_n, gpu_min_rhs, gpu_max_batch
{"Apple M5 Pro", 20,   2048, 1024, 4},

GPU or CPU

The GPU from N = 2048 with at least 1024 right-hand sides in batches of at most 4. Against the faster path at every point:

rule geomean worst points over 10%
fitted 1.0055x 1.49x at [1, 4096, 1] 1 of 92
CPU always 1.0521x 3.99x at [1, 4096, 4096] 6 of 92
GPU always 15.1166x 670.19x at [64, 64, 1] 81 of 92
held out: fitted on half 1.0102x 1.49x at [1, 4096, 1] 1 of 46
held out: CPU always 1.0432x 2.37x at [1, 4096, 1024] 3 of 46

Noise

Pass-to-pass ratio: median 1.019, p90 1.224, max 2.33 over 194 timings.

Probe point after the sweep over before: blocked 1.003x, cpu 0.994x.

Every point

Median ms, min over passes.

N K batch cpu blocked GPU over CPU
64 1 1 0.001 0.223 0.00x
64 1 4 0.001 0.673 0.00x
64 1 16 0.004 2.177 0.00x
64 1 64 0.013 8.685 0.00x
64 1 256 0.052 — —
64 16 1 0.002 0.214 0.01x
64 16 4 0.014 0.821 0.02x
64 16 16 0.029 2.263 0.01x
64 16 64 0.112 9.261 0.01x
64 16 256 0.456 — —
64 64 1 0.002 0.191 0.01x
64 64 4 0.014 0.680 0.02x
64 64 16 0.033 2.272 0.01x
64 64 64 0.127 8.712 0.01x
64 64 256 0.461 — —
128 1 1 0.002 0.203 0.01x
128 1 4 0.013 0.767 0.02x
128 1 16 0.023 2.575 0.01x
128 1 64 0.091 10.202 0.01x
128 1 256 0.410 — —
128 16 1 0.004 0.241 0.02x
128 16 4 0.016 0.670 0.02x
128 16 16 0.054 2.527 0.02x
128 16 64 0.120 10.101 0.01x
128 16 256 0.468 — —
128 64 1 0.005 0.239 0.02x
128 64 4 0.019 0.666 0.03x
128 64 16 0.070 2.570 0.03x
128 64 64 0.128 10.354 0.01x
128 64 256 0.530 — —
256 1 1 0.008 0.264 0.03x
256 1 4 0.020 0.966 0.02x
256 1 16 0.119 3.645 0.03x
256 1 64 0.136 14.656 0.01x
256 1 256 0.443 — —
256 16 1 0.008 0.340 0.02x
256 16 4 0.021 0.940 0.02x
256 16 16 0.069 3.669 0.02x
256 16 64 0.151 14.692 0.01x
256 16 256 0.536 — —
256 64 1 0.011 0.309 0.03x
256 64 4 0.028 0.911 0.03x
256 64 16 0.115 3.661 0.03x
256 64 64 0.222 14.954 0.01x
256 64 256 0.798 — —
256 256 1 0.033 0.358 0.09x
256 256 4 0.072 0.921 0.08x
256 256 16 0.212 3.683 0.06x
256 256 64 0.622 13.711 0.05x
256 256 256 2.487 — —
512 1 1 0.034 0.378 0.09x
512 1 4 0.050 1.149 0.04x
512 1 16 0.138 4.412 0.03x
512 1 64 0.286 19.025 0.02x
512 16 1 0.022 0.336 0.07x
512 16 4 0.041 1.206 0.03x
512 16 16 0.116 4.600 0.03x
512 16 64 0.366 19.738 0.02x
512 64 1 0.030 0.439 0.07x
512 64 4 0.070 1.151 0.06x
512 64 16 0.210 4.971 0.04x
512 64 64 0.701 19.811 0.04x
512 256 1 0.094 0.471 0.20x
512 256 4 0.217 1.325 0.16x
512 256 16 0.647 5.142 0.13x
512 256 64 2.307 20.679 0.11x
1024 1 1 0.143 0.502 0.29x
1024 1 4 0.178 1.868 0.10x
1024 1 16 0.348 7.675 0.05x
1024 16 1 0.066 0.578 0.11x
1024 16 4 0.126 1.921 0.07x
1024 16 16 0.373 7.927 0.05x
1024 64 1 0.093 0.846 0.11x
1024 64 4 0.241 1.970 0.12x
1024 64 16 0.737 7.937 0.09x
1024 256 1 0.289 1.047 0.28x
1024 256 4 0.871 2.115 0.41x
1024 256 16 2.501 8.538 0.29x
1024 1024 1 0.948 1.021 0.93x
1024 1024 4 2.738 2.940 0.93x
1024 1024 16 12.196 11.424 1.07x
2048 1 1 0.620 1.195 0.52x
2048 1 4 0.906 3.180 0.28x
2048 16 1 0.218 0.975 0.22x
2048 16 4 0.572 3.264 0.18x
2048 64 1 0.326 0.913 0.36x
2048 64 4 1.050 3.436 0.31x
2048 256 1 0.860 1.522 0.57x
2048 256 4 2.405 4.316 0.56x
2048 1024 1 3.365 1.811 1.86x
2048 1024 4 10.875 6.708 1.62x
3072 1 1 1.820 1.750 1.04x
3072 16 1 0.539 1.373 0.39x
3072 64 1 0.766 1.416 0.54x
3072 256 1 1.703 2.284 0.75x
3072 1024 1 6.472 2.852 2.27x
4096 1 1 3.543 2.377 1.49x
4096 16 1 0.878 2.218 0.40x
4096 64 1 1.256 2.539 0.49x
4096 256 1 2.888 2.933 0.98x
4096 1024 1 10.279 4.346 2.37x
4096 4096 1 50.038 12.549 3.99x