Skip to content

Commit a4c1ecd

Browse files
cyyeverfacebook-github-bot
authored andcommitted
Use armv8.2-a+fp16fml (#4942)
Summary: X-link: facebookresearch/FBGEMM#1967 According to the [GCC documentation](https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html), the march armv8-a+fp16fml is invalid. A build failure was observed on PyTorch CI. FYI <img width="813" height="536" alt="image" src="https://github.com/user-attachments/assets/0d97821e-8017-4090-8f6f-81c012a9cbbb" /> but <img width="1094" height="493" alt="image" src="https://github.com/user-attachments/assets/58befd2a-ee9b-41c3-b73d-bbf876fe948d" /> Pull Request resolved: #4942 Reviewed By: cthi Differential Revision: D83512621 Pulled By: q10 fbshipit-source-id: 1d0e9a36186d9d68368e193948dcc75f3b884799
1 parent 8b7af65 commit a4c1ecd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ if(MSVC)
109109
set(MSVC_BOOL True)
110110
else(MSVC)
111111
set(MSVC_BOOL False)
112-
check_cxx_compiler_flag(-march=armv8-a+sve COMPILER_SUPPORTS_SVE)
113-
check_cxx_compiler_flag(-march=armv8-a+sve2 COMPILER_SUPPORTS_SVE2)
114-
check_cxx_compiler_flag(-march=armv8-a+fp16fml COMPILER_SUPPORTS_FP16FML)
115112
endif(MSVC)
116113

117114
################################################################################
@@ -290,6 +287,17 @@ endif()
290287
################################################################################
291288

292289
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
290+
check_cxx_compiler_flag(-march=armv8.2-a+fp16fml COMPILER_SUPPORTS_FP16FML)
291+
if(COMPILER_SUPPORTS_FP16FML)
292+
set(fbgemm_fml_flags "-march=armv8.2-a+fp16fml")
293+
endif()
294+
if(NOT COMPILER_SUPPORTS_FP16FML) # for clang
295+
check_cxx_compiler_flag(-mfp16fml COMPILER_SUPPORTS_FP16FML)
296+
if(COMPILER_SUPPORTS_FP16FML)
297+
set(fbgemm_fml_flags "-march=armv8.2 -mfp16fml")
298+
endif()
299+
endif()
300+
293301
if(NOT COMPILER_SUPPORTS_FP16FML)
294302
message(FATAL_ERROR "The current compiler does not support building FP16FML code")
295303
endif()
@@ -309,7 +317,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
309317
-ftree-vectorize
310318
-fno-trapping-math
311319
-Wignored-qualifiers
312-
-march=armv8-a+fp16fml
320+
-march=armv8.2-a+fp16fml
313321
DEFINITIONS
314322
${fbgemm_arm_defs}
315323
DEPS
@@ -330,6 +338,8 @@ endif()
330338

331339
set(FBGEMM_BUILD_SVE False)
332340
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64")
341+
check_cxx_compiler_flag(-march=armv8-a+sve COMPILER_SUPPORTS_SVE)
342+
check_cxx_compiler_flag(-march=armv8-a+sve2 COMPILER_SUPPORTS_SVE2)
333343
if(COMPILER_SUPPORTS_SVE2)
334344
set(FBGEMM_BUILD_SVE True)
335345
set(fbgemm_sve_flags "-march=armv8-a+sve2")

0 commit comments

Comments
 (0)