-
-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Version
No response
Platform
No response
What steps will reproduce the bug?
Hi there. I am trying to build ada in a wierd environment. Namely natively on mac and building for x86_64 in docker while on apple silicon.
When building in docker these flags throw a gcc unsupported error. This makes sense because we wouldn't have AVX instructions on mac silicon. However, Lots of x86_64 processors do not have AVX. So I would assume this happens in those cases too.
Can we check to see if these flags exist prior to using them? I do not think that it is suitable to check the SYSTEM_PROCESSOR field because not all x86_64 processors have AVX instructions. I am thinking of a few intel generations which just like - didn't. In my case we are building through docker on arm silicon and run into these being fed through (see CesiumGS/cesium-native#1131)
I think what happens is gcc throws an error that these flags are unsupported when the arch is x86_64 and there is no AVX
GPT throws out a solution like this? (big grain of salt...)
include(CheckCXXCompilerFlag)
# Check if the compiler supports the AVX-related options
check_cxx_compiler_flag("-mno-avx256-split-unaligned-load" HAS_NO_AVX256_SPLIT_UNALIGNED_LOAD)
check_cxx_compiler_flag("-mno-avx256-split-unaligned-store" HAS_NO_AVX256_SPLIT_UNALIGNED_STORE)
# Workaround for GNU GCC poor AVX load/store code generation
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$"))
if (HAS_NO_AVX256_SPLIT_UNALIGNED_LOAD AND HAS_NO_AVX256_SPLIT_UNALIGNED_STORE)
target_compile_options(ada PRIVATE -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store)
endif()
endif()
How often does it reproduce? Is there a required condition?
Be on a x86_64 system without AVX support
What is the expected behavior?
It compiles without AVX
What do you see instead?
It does not compile
Additional information
No response