roaringbitmap
roaringbitmap copied to clipboard
Apple M1 does not support -march=native
As reported in https://github.com/andreasvc/disco-dop/issues/68#issuecomment-1367505212_
@BrettRey are you using gcc? See [1]. From [2] it seems it might be an issue with clang.
[1] https://github.com/andreasvc/disco-dop/#mac-os-x [2] https://stackoverflow.com/questions/65966969/why-does-march-native-not-work-on-apple-m1/66333485
Observations:
- Clang 15 supports
-march=native
, see https://stackoverflow.com/a/72597669 - gcc can be installed on M1 with homebrew, which may or may not support
-march=native
. Documentation says it is only supported on Linux: https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html - a workaround is to remove both
-march=native
and-mtune=native
for non-Linux systems, but this may be undesirable as a default, since optimizations probably have a large impact for this datastructure. This is done by https://github.com/Ezibenroc/PyRoaringBitMap/blob/cdea52c55bdb3a517f75151ebddaaf37b30e8b8e/setup.py - another option is to detect the architecture and specify the appropriate
-march=...
option for the most common cases, but this seems like a can of worms, and I'd rather leave this to the compiler.
Also see https://stackoverflow.com/questions/52653025/why-is-march-native-used-so-rarely
python3 setup.py install --with-mtune
worked for @BrettRey
Note that CRoaring supports runtime dispatching and it does not need specific compiler directives.
That is, you do not march=native when compiling CRoaring to get good performance at runtime.
I recommend updating CRoaring and dropping the march=native.
@lemire Correct me if I am wrong, but I think this library does not depend on CRoaring, this is a full reimplementation in Cython.
@Ezibenroc I think you are correct.