AuburnSounds / intel-intrinsics

The Dlang SIMD library
https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#techs=MMX,SSE,SSE2,SSE3,SSSE3,SSE4_1
Boost Software License 1.0
67 stars 11 forks source link

AVX2 #122

Open p0nce opened 1 year ago

p0nce commented 1 year ago

179 TODO 159 TODO 142 TODO 132 TODO 112 TODO 100 TODO 87 TODO 76 TODO 62 TODO 49 TODO

p0nce commented 1 year ago

AVX super annoying to do since efficiently doing the instructions without 256-bit vectors is involved

p0nce commented 1 year ago

Even when AVX is disabled, if all intrinsics are implement with proper splitting when needed, you can speed up with AVX "intrinsics". Of course, doesn't work everytime but often enough to speed things up in general.

Let's measure time to make 81920000 atan2 operations.

With -mattr=+avx2 (AVX enabled)

- Naive (std.complex.arg):       1581.3 ms
- Written with AVX intrinsics:     61.5 ms
- Written with SSE intrinsics:    103.6 ms

Without -mattr=+avx2 (AVX disabled)

- Naive (std.complex.arg):       1499.6 ms
- Written with AVX intrinsics:    102.9 ms
- Written with SSE intrinsics:    119.9 ms

(EDIT: though, it's not systematic either, if SSE intrinsics don't win over D code often the AVX semantics also don't win)