[CPU] Gate the AVX10.2 paths on compiler support (#58133)

Signed-off-by: R <Ganesh.R@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
This commit is contained in:
Ganesh R
2026-09-24 18:07:53 +08:00
committed by GitHub
co-authored by Cursor Li, Jiang <jiang1.li@intel.com>
parent cfd5c20286
commit f34a0e0797
3 changed files with 31 additions and 0 deletions
+18
View File
@@ -173,6 +173,18 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64" OR ENABLE_X86_ISA)
set(AMX_FP8_SUPPORTED FALSE)
message(STATUS "AMX-FP8 disabled by ENABLE_AMX_FP8=OFF")
endif()
# AVX10.2 arrived in GCC 15, so the target attribute, the fp8 convert
# intrinsics and __builtin_cpu_supports("avx10.2") are all hard errors on
# the 12.3+ the backend otherwise supports. Probe instead of assuming.
check_cxx_compiler_flag("-mavx10.2" COMPILER_SUPPORTS_AVX10_2_FLAG)
if (COMPILER_SUPPORTS_AVX10_2_FLAG)
set(AVX10_2_SUPPORTED TRUE)
else()
set(AVX10_2_SUPPORTED FALSE)
message(STATUS "AVX10.2 disabled: compiler does not support -mavx10.2 (compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION})")
endif()
list(APPEND CXX_COMPILE_FLAGS_AVX2
"-mavx2")
elseif (POWER9_FOUND OR POWER10_FOUND OR POWER11_FOUND)
@@ -629,6 +641,12 @@ if (ENABLE_X86_ISA)
message(STATUS "AMX-FP8 (Diamond Rapids) enabled")
endif()
# For the sgl-kernels AVX10.2 fp8 quantize paths
if (AVX10_2_SUPPORTED)
target_compile_definitions(_C PRIVATE "-DCPU_CAPABILITY_AVX10_2")
message(STATUS "AVX10.2 enabled")
endif()
# AVX512F
define_extension_target(
_C_AVX512