It is possible to write SIMD-based vector library in Haskell using https://hackage.haskell.org/package/ghc-prim-0.4.0.0/docs/GHC-Prim.html#g:28 but will it make any sense? I've came across several papers devoted to automatic SIMD optimization in Haskell, but what the current status (2014)? E.g. will https://hackage.haskell.org/package/vector use SIMD or it is better to write optimized library manually using low-level SIMD primitives?
First: I had no idea GHC even had primops for SIMD. Nice find!
Anyway, that aside, my understanding is this:
there is absolutely no auto vectorization wrt SIMD in ghc at the moment. none
the current simd primops will trigger a GHC panic when used with the native code gen, though they will work with the -fllvm backend.
those simd primops crucially lack a good data model for data shuffling, the current data model will require a pretty substantial reworking to support simd shuffles properly.
the llvm backend MAY do certain auto vectorization optimizations on code, but i'd generally treat auto-vectorization as a bonus rather than a core assumption in how code gets optimized, it requires some careful auditing to validate!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With