- edited description
Vectorization Under Sleef
Hi Kraus,
I’ve found the SIMD extension via custom functors to be an easy way to extend the library, including zeroing negative nans from parallelized KL divergence calculation and, more recently, using vectorized forms of libm functions.
In particular, I don’t use icc and it doesn’t work on most of my software, and the closed-source/cost of use nature of icc complicates distribution of software using it. However, the Sleef library (https://github.com/shibatch/sleef) provides very fast vectorized forms of essentially all libm functions.
I’ve only implemented log thus far (see this branch), as it was what I needed most immediately. I may not finish complete support for it, but it does work thus far and it might be worth considering for future inclusion.
I imagine this is partially a request for comments, a suggested enhancement, and a work-in-progress eventual pull request.
Best,
Daniel
Comments (10)
-
reporter -
reporter - edited description
-
Hi Daniel!
Thanks a lot for pointing us to the sleef library. It definitely looks like a very useful extension for Blaze, given that Blaze currently doesn’t officially support the Intel compiler due to its problems with C++14 features. We look forward to a pull request. Thanks,
Best regards,
Klaus!
-
The first review comment would be to separate SVML and Sleef code as much as possible:
#if BLAZE_SVML_MODE # if BLAZE_AVX512_MODE // All SVML AVX512 code # elif BLAZE_AVX_MODE // All SVML AVX code # elif BLAZE_SSE_MODE // All SVM SSE code # endif #else BLAZE_SLEEF_MODE # if BLAZE_AVX512_MODE // All Sleef AVX512 code # elif BLAZE_AVX_MODE // All Sleef AVX code # elif BLAZE_SSE_MODE // All Sleef SSE code # endif #endif
This will improve readability and will guide future extensions. Thanks!
-
reporter - edited description
-
reporter Hi Klaus,
Thanks for the feedback! I followed your instructions and see why it’s easier to understand this way.
I tried to open a pull request on bitbucket, but it told me I couldn’t with my current account, but the completed branch is available here: https://github.com/dnbaker/blaze-lib/compare/48f55121eecd32cfea25d3027be834f74a513e88...Sleef. I’ve also imported it to Bitbucket (https://bitbucket.org/dnbaker/blaze-lib/src/Sleef/), but still can’t open the pull request.
The only functions it doesn’t support which SVML does are div, invcbrt, and invsqrt, which are not provided by Sleef.
I defaulted to higher-precision functions when given the option (u10 vs u35, usually), though it might be worth it to consider lower-precision options, though that would require more work and somehow adding a flag to select which versions of functions to use.
I imagine some testing is necessary, though I haven’t gotten around to adding anything besides simply seeing that it compiles on my machine both with and without Sleef.
-
Hi Daniel!
Thanks a lot for your effort! We haven’t experienced any problem to create a pull request so far, therefore we hope that this is just a temporary hiccup. We are currently in the process of wrapping up Blaze 3.7. anyway, so perhaps you can try again to create a pull request in a couple of days. A pull request would definitely be advantageous for us, but of course we can also grab the code from your fork. Thanks again,
Best regards,
Klaus!
-
reporter I figured out how to. I needed to fork the repository on Bitbucket, push my changes there, and then make the request here, but it’s done now.
-
Thanks, Daniel, for creating the pull request. We’ll deal with this first thing after the release of Blaze 3.7. Please don’t take this short delay as a sign that this isn’t important for us, we feel that this is a very valuable addition to Blaze. Thanks,
Best regards,
Klaus!
-
- changed status to resolved
Pull request #42 introduces the vectorization by means of the Sleef library. The feature is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.8.
- Log in to comment