metal-linalg

Cholesky routing: Apple M5 Pro, 20 GPU cores

From 1 run(s): 20261010-e37928.

Answer

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

// device, GPU cores,   simd_max_n, blocked_min_n, blocked_max_batch,   gpu_max_n, gpu_min_batch_times_n, gpu_min_batch, gpu_min_n,   gpu_large_min_n, gpu_large_max_batch
{"Apple M5 Pro", 20,   32, 160, 0,   3072, 3072, 1, 1536,   4096, 0},

The GPU kernel

simd up to 32, blocked from 160 (batches of any size), the threadgroup kernel between. Against the best GPU kernel at every point:

rule geomean worst points over 10%
fitted 1.0077x 1.36x at [1, 24] 3 of 154
no simd 1.1694x 8.76x at [16384, 4] 30 of 154
blocked from 48 1.0077x 1.36x at [1, 24] 3 of 154

GPU or CPU

The GPU iff 1536 <= N <= 3072, batch x N >= 3072 and batch >= 1; or N >= 4096 in a batch of any size. Against the best backend at every point:

rule geomean worst points over 10% total time over best
fitted 1.0001x 1.02x at [16384, 2] 0 of 154 1.000x
GPU always 6.9484x 262.09x at [1, 2] 140 of 154 1.407x
CPU always 1.0569x 3.89x at [4, 4096] 12 of 154 2.024x
held out: fitted on half 1.0002x 1.02x at [16384, 2] 0 of 77 1.000x
held out: CPU always 1.0695x 3.89x at [4, 4096] 6 of 77 2.238x

Noise

Pass-to-pass ratio: median 1.024, p90 1.228, max 2.27 over 414 timings.

Probe point 512 x 512, batch 16, after the sweep over before: blocked 1.006x, cpu 1.007x, tg 1.008x.

Every point

Median ms, min over passes (the fastest in bold); routed is the fitted rule’s choice.

N batch cpu simd tg blocked best routed GPU’s best over CPU
2 1 0.001 0.142 0.154 — cpu cpu 0.00x
2 2 0.001 0.144 0.157 — cpu cpu 0.01x
2 4 0.001 0.138 0.148 — cpu cpu 0.01x
2 16 0.001 0.137 0.148 — cpu cpu 0.01x
2 64 0.002 0.135 0.148 — cpu cpu 0.01x
2 256 0.005 0.139 0.170 — cpu cpu 0.04x
2 1024 0.017 0.138 0.212 — cpu cpu 0.12x
2 4096 0.064 0.141 0.438 — cpu cpu 0.46x
2 16384 0.162 0.159 1.345 — simd cpu 1.02x
4 1 0.001 0.141 0.172 — cpu cpu 0.00x
4 2 0.001 0.137 0.151 — cpu cpu 0.01x
4 4 0.001 0.138 0.151 — cpu cpu 0.01x
4 16 0.001 0.131 0.153 — cpu cpu 0.01x
4 64 0.003 0.129 0.160 — cpu cpu 0.02x
4 256 0.008 0.140 0.177 — cpu cpu 0.06x
4 1024 0.028 0.146 0.227 — cpu cpu 0.19x
4 4096 0.108 0.149 0.467 — cpu cpu 0.72x
4 16384 0.126 0.166 1.454 — cpu cpu 0.76x
8 1 0.001 0.157 0.175 — cpu cpu 0.00x
8 2 0.001 0.152 0.153 — cpu cpu 0.01x
8 4 0.001 0.142 0.153 — cpu cpu 0.01x
8 16 0.002 0.148 0.151 — cpu cpu 0.01x
8 64 0.005 0.140 0.155 — cpu cpu 0.04x
8 256 0.017 0.152 0.246 — cpu cpu 0.11x
8 1024 0.067 0.143 0.247 — cpu cpu 0.47x
8 4096 0.142 0.153 0.507 — cpu cpu 0.93x
8 16384 0.142 0.201 1.604 — cpu cpu 0.71x
12 1 0.001 0.163 0.152 — cpu cpu 0.00x
12 2 0.001 0.164 0.162 — cpu cpu 0.01x
12 4 0.002 0.156 0.155 — cpu cpu 0.01x
12 16 0.003 0.154 0.156 — cpu cpu 0.02x
12 64 0.008 0.156 0.156 — cpu cpu 0.05x
12 256 0.031 0.153 0.163 — cpu cpu 0.20x
12 1024 0.120 0.172 0.255 — cpu cpu 0.70x
12 4096 0.111 0.199 0.546 — cpu cpu 0.56x
12 16384 0.215 0.404 1.864 — cpu cpu 0.53x
16 1 0.001 0.164 0.160 — cpu cpu 0.00x
16 2 0.001 0.184 0.158 — cpu cpu 0.01x
16 4 0.002 0.150 0.159 — cpu cpu 0.01x
16 16 0.003 0.166 0.154 — cpu cpu 0.02x
16 64 0.011 0.159 0.150 — cpu cpu 0.07x
16 256 0.040 0.169 0.171 — cpu cpu 0.24x
16 1024 0.154 0.170 0.254 — cpu cpu 0.91x
16 4096 0.095 0.228 0.645 — cpu cpu 0.42x
16 16384 0.284 0.496 2.072 — cpu cpu 0.57x
24 1 0.001 0.211 0.155 — cpu cpu 0.01x
24 2 0.002 0.154 0.157 — cpu cpu 0.01x
24 4 0.004 0.155 0.158 — cpu cpu 0.02x
24 16 0.005 0.157 0.160 — cpu cpu 0.03x
24 64 0.017 0.161 0.154 — cpu cpu 0.11x
24 256 0.065 0.163 0.179 — cpu cpu 0.40x
24 1024 0.164 0.197 0.279 — cpu cpu 0.84x
24 4096 0.147 0.332 0.769 — cpu cpu 0.44x
24 16384 0.544 0.880 2.465 — cpu cpu 0.62x
32 1 0.001 0.195 0.190 — cpu cpu 0.00x
32 2 0.002 0.179 0.158 — cpu cpu 0.01x
32 4 0.005 0.156 0.153 — cpu cpu 0.03x
32 16 0.007 0.170 0.161 — cpu cpu 0.04x
32 64 0.025 0.157 0.159 — cpu cpu 0.16x
32 256 0.097 0.171 0.183 — cpu cpu 0.56x
32 1024 0.100 0.218 0.295 — cpu cpu 0.46x
32 4096 0.267 0.452 0.867 — cpu cpu 0.59x
32 16384 0.894 1.172 2.806 — cpu cpu 0.76x
48 1 0.001 — 0.195 — cpu cpu 0.01x
48 2 0.005 — 0.187 — cpu cpu 0.03x
48 4 0.007 — 0.193 — cpu cpu 0.03x
48 16 0.014 — 0.258 — cpu cpu 0.05x
48 64 0.052 — 0.213 — cpu cpu 0.25x
48 256 0.188 — 0.331 — cpu cpu 0.57x
48 1024 0.140 — 0.852 — cpu cpu 0.16x
48 4096 0.589 — 2.827 — cpu cpu 0.21x
48 16384 1.859 — 10.453 — cpu cpu 0.18x
64 1 0.002 — 0.198 — cpu cpu 0.01x
64 2 0.005 — 0.193 — cpu cpu 0.03x
64 4 0.012 — 0.197 — cpu cpu 0.06x
64 16 0.026 — 0.239 — cpu cpu 0.11x
64 64 0.102 — 0.253 — cpu cpu 0.40x
64 256 0.217 — 0.364 — cpu cpu 0.60x
64 1024 0.258 — 1.002 — cpu cpu 0.26x
64 4096 0.898 — 3.220 — cpu cpu 0.28x
64 16384 3.346 — 11.734 — cpu cpu 0.29x
96 1 0.006 — 0.225 — cpu cpu 0.03x
96 2 0.017 — 0.224 — cpu cpu 0.07x
96 4 0.019 — 0.223 — cpu cpu 0.09x
96 16 0.093 — 0.261 — cpu cpu 0.36x
96 64 0.188 — 0.490 — cpu cpu 0.38x
96 256 0.483 — 0.729 — cpu cpu 0.66x
96 1024 1.665 — 2.098 — cpu cpu 0.79x
96 4096 6.394 — 7.406 — cpu cpu 0.86x
128 1 0.008 — 0.248 — cpu cpu 0.03x
128 2 0.018 — 0.249 — cpu cpu 0.07x
128 4 0.022 — 0.252 — cpu cpu 0.09x
128 16 0.118 — 0.267 — cpu cpu 0.44x
128 64 0.151 — 0.482 — cpu cpu 0.31x
128 256 0.498 — 1.233 — cpu cpu 0.40x
128 1024 1.673 — 3.930 — cpu cpu 0.43x
128 4096 6.657 — 14.341 — cpu cpu 0.46x
160 1 0.012 — 0.288 0.304 cpu cpu 0.04x
160 2 0.025 — 0.292 0.306 cpu cpu 0.08x
160 4 0.029 — 0.291 0.314 cpu cpu 0.10x
160 16 0.078 — 0.313 0.324 cpu cpu 0.25x
160 64 0.178 — 0.726 0.438 cpu cpu 0.41x
160 256 0.586 — 1.856 1.144 cpu cpu 0.51x
160 1024 2.038 — 6.277 3.825 cpu cpu 0.53x
192 1 0.017 — 0.346 0.329 cpu cpu 0.05x
192 2 0.030 — 0.337 0.328 cpu cpu 0.09x
192 4 0.033 — 0.344 0.335 cpu cpu 0.10x
192 16 0.093 — 0.412 0.353 cpu cpu 0.26x
192 64 0.214 — 0.912 0.526 cpu cpu 0.41x
192 256 0.708 — 2.643 1.590 cpu cpu 0.45x
192 1024 2.803 — 8.887 5.406 cpu cpu 0.52x
256 1 0.029 — 0.495 0.383 cpu cpu 0.08x
256 2 0.044 — 0.497 0.385 cpu cpu 0.12x
256 4 0.051 — 0.477 0.408 cpu cpu 0.12x
256 16 0.127 — 0.636 0.445 cpu cpu 0.29x
256 64 0.422 — 1.508 0.873 cpu cpu 0.48x
256 256 1.263 — 4.769 2.694 cpu cpu 0.47x
256 1024 4.626 — 16.511 9.645 cpu cpu 0.48x
384 1 0.058 — 0.938 0.506 cpu cpu 0.12x
384 2 0.082 — 0.937 0.516 cpu cpu 0.16x
384 4 0.103 — 0.984 0.534 cpu cpu 0.19x
384 16 0.304 — 1.252 0.711 cpu cpu 0.43x
384 64 0.921 — 3.430 1.837 cpu cpu 0.50x
384 256 3.574 — 11.160 6.355 cpu cpu 0.56x
512 1 0.100 — 1.501 0.632 cpu cpu 0.16x
512 2 0.142 — 1.526 0.695 cpu cpu 0.20x
512 4 0.210 — 1.612 0.732 cpu cpu 0.29x
512 16 0.545 — 2.139 1.077 cpu cpu 0.51x
512 64 1.781 — 6.286 3.263 cpu cpu 0.55x
512 256 6.341 — 20.188 11.845 cpu cpu 0.54x
768 1 0.227 — 3.969 0.934 cpu cpu 0.24x
768 2 0.383 — 4.042 1.040 cpu cpu 0.37x
768 4 0.614 — 4.277 1.165 cpu cpu 0.53x
768 16 1.597 — 5.617 2.392 cpu cpu 0.67x
768 64 5.422 — 15.730 8.198 cpu cpu 0.66x
1024 1 0.479 — 8.227 1.274 cpu cpu 0.38x
1024 2 0.789 — 8.516 1.445 cpu cpu 0.55x
1024 4 1.127 — 8.945 1.752 cpu cpu 0.64x
1024 16 3.670 — 11.685 4.360 cpu cpu 0.84x
1024 64 11.504 — 31.239 16.236 cpu cpu 0.71x
1536 1 1.418 — — 2.160 cpu cpu 0.66x
1536 2 2.914 — — 2.633 blocked blocked 1.11x
1536 4 6.011 — — 3.523 blocked blocked 1.71x
1536 16 24.805 — — 10.361 blocked blocked 2.39x
2048 1 2.961 — — 3.372 cpu cpu 0.88x
2048 2 6.037 — — 4.404 blocked blocked 1.37x
2048 4 11.882 — — 6.280 blocked blocked 1.89x
2048 16 48.067 — — 20.114 blocked blocked 2.39x
3072 1 9.090 — — 6.822 blocked blocked 1.33x
3072 2 18.150 — — 9.611 blocked blocked 1.89x
3072 4 39.505 — — 15.714 blocked blocked 2.51x
4096 1 29.444 — — 13.077 blocked blocked 2.25x
4096 2 59.829 — — 18.731 blocked blocked 3.19x
4096 4 123.871 — — 31.852 blocked blocked 3.89x