simd branch ready for review

Geoffrey Mainland mainland at apeiron.net
Tue Feb 5 00:19:18 CET 2013


On 02/04/2013 10:12 PM, Johan Tibell wrote:
> On Mon, Feb 4, 2013 at 2:09 PM, Geoffrey Mainland <mainland at apeiron.net> wrote:
>
> I'd like to figure out how to properly support having the set of
> available primops depend on the dynamic flags before adding too much
> more. I'll be speaking to Simon PJ about it tomorrow.
>
> Could we use a fallback, like we did for e.g. popcount? I don't think
> have conditionally defined primops is a good idea. How would you use
> them in programs? You'd have to do something like:
>
> #ifdef ???
> -- use primops
> #else
> -- use fallback
> #endif
>
> and everyone would write their own fallback. It would be better if GHC
fell back to some generic implementation.
>
> -- Johan

What would a sensible fallback be for AVX instructions? What should we
fall back on when the LLVM backend is not being used?

Maybe we could desugar AVX instructions to SSE instructions on platforms
that support SSE but not AVX, but in practice people would then #ifdef
anyway and just use SSE if AVX weren't available.

The current idea is to hide the #ifdefs in a library. Clients of the
library would then get the "best" short-vector implementation available
for their platform by using this library. Right now this library is a
modified version of primitive, and I have modified versions of vector
and DPH that use this version of the primitive library to generate SSE
code.

I am certainly open to alternative designs.

Geoff




More information about the ghc-devs mailing list