Commit 96cfdf2
authored
chore: simplify dot implementation to use auto-vectorization (#2645)
This change makes the auto-vectorization version of dot(f32) as fast as
manually written SIMD.
Run benchmarks via
```
export RUSTFLAGS="-C target-cpu=native"
git checkout main
cargo bench --bench dot -- --save-baseline dot_main f32
git checkout lei/simplify_dot
cargo bench --bench dot -- --baseline dot_main f32
```
On Macbook M2 Max
```
Dot(f32, auto-vectorization)
time: [88.812 ms 89.654 ms 90.306 ms]
change: [-2.5819% -1.6876% -0.6964%] (p = 0.01 < 0.10)
Change within noise threshold.
```
AMD 5900X
```
Dot(f32, auto-vectorization)
time: [172.50 ms 176.41 ms 179.41 ms]
change: [-2.3545% +0.6133% +3.5448%] (p = 0.69 > 0.10)
No change in performance detected.
```
Intel Sapphire
```
Dot(f32, auto-vectorization)
time: [331.36 ms 331.62 ms 331.93 ms]
change: [-2.3160% -1.1226% -0.3451%] (p = 0.04 < 0.10)
Change within noise threshold.
```
Graviton3
```
Benchmarking Dot(f32, auto-vectorization): Warming up for 3.0000 s
Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 8.8s or enable flat sampling.
Dot(f32, auto-vectorization)
time: [160.62 ms 160.70 ms 160.76 ms]
change: [-1.1157% -0.6868% -0.2951%] (p = 0.00 < 0.10)
Change within noise threshold.
Found 1 outliers among 10 measurements (10.00%)
1 (10.00%) low mild
```1 parent c7dce32 commit 96cfdf2
1 file changed
Lines changed: 1 addition & 54 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
| |||
142 | 138 | | |
143 | 139 | | |
144 | 140 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 141 | + | |
195 | 142 | | |
196 | 143 | | |
197 | 144 | | |
| |||
0 commit comments