Skip to content

Commit c05ab8d

Browse files
committed
Add support for GCC 15 by disabling AVX10.2 target in Highway
1 parent 9371e3a commit c05ab8d

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2525
FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG 2a16a50ff61071bb25ddef0ce35d92b0e2b9c579 EXCLUDE_FROM_ALL)
2626
FetchContent_MakeAvailable(highway)
2727

28+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
29+
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
30+
# Gemma does not currently use AVX10.2-specific Highway paths, and GCC 15
31+
# builds in CI can reject Highway's AVX10.2 target attribute.
32+
target_compile_definitions(hwy PUBLIC HWY_DISABLED_TARGETS=HWY_AVX10_2)
33+
endif()
34+
2835
## Note: absl needs to be installed by sentencepiece. This will only happen if
2936
## cmake is invoked with -DSPM_ENABLE_SHARED=OFF and -DSPM_ABSL_PROVIDER=module
3037
FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 9045b2f60fa2b323dfac0eaef8fc17565036f9f9 EXCLUDE_FROM_ALL)

examples/hello_world/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
2020
include(FetchContent)
2121
FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG 2a16a50ff61071bb25ddef0ce35d92b0e2b9c579)
2222
FetchContent_MakeAvailable(highway)
23+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
24+
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
25+
target_compile_definitions(hwy PUBLIC HWY_DISABLED_TARGETS=HWY_AVX10_2)
26+
endif()
2327
FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 9045b2f60fa2b323dfac0eaef8fc17565036f9f9)
2428
FetchContent_MakeAvailable(sentencepiece)
2529

examples/simplified_gemma/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
2020
include(FetchContent)
2121
FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG 2a16a50ff61071bb25ddef0ce35d92b0e2b9c579)
2222
FetchContent_MakeAvailable(highway)
23+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
24+
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
25+
target_compile_definitions(hwy PUBLIC HWY_DISABLED_TARGETS=HWY_AVX10_2)
26+
endif()
2327
FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 9045b2f60fa2b323dfac0eaef8fc17565036f9f9)
2428
FetchContent_MakeAvailable(sentencepiece)
2529

0 commit comments

Comments
 (0)