Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use -march=haswell or similar flags instead of -march=native #21

Open
aminya opened this issue Dec 4, 2023 · 4 comments
Open

Use -march=haswell or similar flags instead of -march=native #21

aminya opened this issue Dec 4, 2023 · 4 comments

Comments

@aminya
Copy link
Contributor

aminya commented Dec 4, 2023

The CMake file uses -march=native, which generates binaries that are not usable on other machines that might lack the instruction set.
I think the better approach would be to use -march=haswell, which is a good default these days.

For avx512, a CMake option could be exposed.

despacer/CMakeLists.txt

Lines 17 to 19 in 579530b

target_compile_options(despacer PRIVATE /arch:native)
else()
target_compile_options(despacer PRIVATE -march=native)

-march=haswell includes AVX2 and older SSE instruction sets :
https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html

@sharpobject
Copy link

I think it makes a lot of sense to build this on the machine you intend to run it on.

@lemire
Copy link
Owner

lemire commented Dec 4, 2023

@aminya

Intel recently disable AVX on some processors due to a vulnerability. So you cannot count on haswell to work on nearly all systems today.

The real solution is to use runtime dispatching.

@aminya
Copy link
Contributor Author

aminya commented Dec 4, 2023

There's also the libsimdpp, which already handles the runtime dispatch, and it could also fix the issue for supporting more architectures like Arm Neon (#4)

https://github.com/p12tic/libsimdpp

The dispatching part can be reused in case we don't want to rewrite the functions.
https://github.com/p12tic/libsimdpp/tree/master/simdpp/dispatch

@lemire
Copy link
Owner

lemire commented Dec 4, 2023

Well, I know how to do the runtime dispatching. That's not a problem.

The question is whether anyone is planning to use this software for something serious. If so, they should get in touch with me and we can put in the effort.

I just wrote this code for research purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants