Commit cbfd6b7
SupernodalLU: hand-rolled panel solve kernels below a size cutoff (-27 to -42%) (#1112)
The solve sweeps issued BLAS trsv/gemv per supernode panel, but the
panels are tiny: on a 2D Poisson factorization the pivot block width np
has mean ~12 and median 6, so a 12x12 unit-triangular solve (~72 flops)
measured ~260 ns through BLAS - almost entirely call overhead. BLAS
thread count is irrelevant at these sizes (123.1 us at 1 thread vs
122.8 us at 64).
Below PANEL_BLAS_CUTOFF (64) the four panel operations now use
column-oriented @inbounds/@simd kernels written out in-package
(_unit_lower_solve!, _upper_solve!, _panel_gemv!, _panel_gemv_sub!);
at or above the cutoff BLAS is used unchanged. This follows PureKLU's
#38/#39/#40, where hand-written per-column kernels beat generic library
dispatch at these sizes.
Measured single-RHS solve, BLAS pinned to 1 thread:
poisson2d_20 n=400 27.92 -> 16.18 us (-42%)
poisson2d_40 n=1600 123.15 -> 75.92 us (-38%)
poisson2d_60 n=3600 286.33 -> 187.43 us (-35%)
poisson2d_100 n=10000 843.54 -> 568.36 us (-33%)
poisson3d_16 n=4096 491.79 -> 358.23 us (-27%)
That moves solve from ~1.8x behind UMFPACK to ahead of it at scale
(568 vs 703 us at n=10000; 187 vs 200 us at n=3600).
Accuracy is unchanged (relative error vs backslash 3.8e-16 at n=400 to
4.9e-14 at n=10000, same as the BLAS path). The new testset checks
single- and multi-RHS agreement and asserts that a 3D factorization
actually has panels wider than the cutoff, so both branches stay
exercised.
GROUP=Core passes.
Co-authored-by: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 9e21194 commit cbfd6b7
2 files changed
Lines changed: 145 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
15 | 88 | | |
16 | 89 | | |
17 | 90 | | |
| |||
26 | 99 | | |
27 | 100 | | |
28 | 101 | | |
29 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
30 | 107 | | |
31 | 108 | | |
32 | 109 | | |
33 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
34 | 115 | | |
35 | 116 | | |
36 | 117 | | |
| |||
50 | 131 | | |
51 | 132 | | |
52 | 133 | | |
53 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
54 | 144 | | |
55 | | - | |
56 | 145 | | |
57 | 146 | | |
58 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
27 | 44 | | |
28 | 45 | | |
29 | 46 | | |
| |||
181 | 198 | | |
182 | 199 | | |
183 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
184 | 236 | | |
185 | 237 | | |
186 | 238 | | |
| |||
0 commit comments