Hi Klaus!
We have some code that isn’t easily applied to an entire DenseVector but we would like to perform using some SIMD operations (it’s a several nested root finds that need to be done pointwise in a mesh). With Sleef it seems like Blaze supports pretty much all the math functions we would need, and so it would be nice to avoid having to rely on yet another 3rd party library like XSIMD, NSIMD, etc. Before using what’s in math/simd directly I had a few questions:
- would you consider it reasonable to have the SIMD code in
math/simdbe user facing? I realize it’s still subject to refactors, etc. but basically do you consider it an implementation detail that users shouldn’t use or can we use it? - some of our operations are things like
max(a, 0.)which as far as I can tell (not being anywhere close to an expert on SIMD) we would do with something likemax(a, SIMDdouble{0.})ifSIMDdoublehad a constructorSIMDdouble(ValueType v) : value( __m256_set1_pd(v)) {}. Would it be reasonable to add support for this constructor? Do you have a suggestion on how to better do operations likemax(a, SIMDdouble{0.})? - we’ll need to have a
clampfunction. Is that something that could be added to themath/simdcode?
This is all really just exploring what our options are in terms of having some SIMD wrappers available to us. Like I said, ideally we’d just use Blaze+Sleef rather than having to add yet another 3rd party library
Thanks in advance!
Best wishes,
Nils
Hi Nils!
First, allow me to apologize for the late reply. Then allow me to address your questions:
SIMDdouble{1.}as semantically ambiguous. Should the entire SIMD vector be initialized to1or just the first element (as it would happen if it would be an array)? For that reason there is a couple of “factory functions” likeset():max(a, set(0));that perform the necessary SIMD operations (see for instance <math/simd/Set.h> or <math/simd/Setall.h>).clamp()? If yes, that would be very reasonable, if no we would have to try to implement this on our own and proof by benchmarks that it performs well.Best regards,
Klaus!