goankur commented on code in PR #13572: URL: https://github.com/apache/lucene/pull/13572#discussion_r1701126777
########## lucene/core/src/c/dotProduct.c: ########## @@ -0,0 +1,143 @@ +// dotProduct.c + +#include <stdio.h> +#include <arm_neon.h> + +#ifdef __ARM_ACLE +#include <arm_acle.h> +#endif + +#if (defined(__ARM_FEATURE_SVE) && !defined(__APPLE__)) +#include <arm_sve.h> +/* + * Unrolled and vectorized int8 dotProduct implementation using SVE instructions + * NOTE: Clang 15.0 compiler on Apple M3 Max compiles the code below sucessfully + * with '-march=native+sve' option but throws "Illegal Hardware Instruction" error + * Looks like Apple M3 does not implement SVE and Apple's official documentation + * is not explicit about this or at least I could not find it. + * + */ Review Comment: Simply having `-march=native` compiler flag and no `ifdef` directive makes clang (15.0) throw compilation error: `SVE support not enabled`, so guarding the SVE code with `ifdef` is necessary. That said there is no need for extra check on `__APPLE__` and I have removed that part from `ifdef`. ########## lucene/core/src/c/dotProduct.c: ########## @@ -0,0 +1,143 @@ +// dotProduct.c + +#include <stdio.h> +#include <arm_neon.h> + +#ifdef __ARM_ACLE +#include <arm_acle.h> +#endif + +#if (defined(__ARM_FEATURE_SVE) && !defined(__APPLE__)) +#include <arm_sve.h> +/* + * Unrolled and vectorized int8 dotProduct implementation using SVE instructions + * NOTE: Clang 15.0 compiler on Apple M3 Max compiles the code below sucessfully + * with '-march=native+sve' option but throws "Illegal Hardware Instruction" error + * Looks like Apple M3 does not implement SVE and Apple's official documentation + * is not explicit about this or at least I could not find it. + * + */ Review Comment: Simply having `-march=native` compiler flag and no `ifdef` directive makes clang (15.0) throw compilation error: `SVE support not enabled`. So guarding the SVE code with `ifdef` is necessary. That said there is no need for extra check on `__APPLE__` and I have removed that part from `ifdef`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org