From 5179f7dfedbd9d20c928a1b451caa85388508df5 Mon Sep 17 00:00:00 2001 From: "nishant.prabhu" Date: Mon, 28 Oct 2024 17:13:53 +0530 Subject: [PATCH] added updates to intel_cpu/CMakeLists.txt for SVE --- src/plugins/intel_cpu/CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index 3f349bebb4db82..7ad77d0869c1ed 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -277,6 +277,30 @@ target_include_directories(${TARGET_NAME} SYSTEM PRIVATE $) +# Check if SVE is available for AARCH64; compile with that if yes. +if (ARM OR AARCH64) + execute_process( + COMMAND lscpu + OUTPUT_VARIABLE CPUINFO + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(FIND "${CPUINFO}" "Flags:" FLAGS_INDEX) + string(SUBSTRING "${CPUINFO}" ${FLAGS_INDEX} -1 CPU_FLAGS) + string(FIND "${CPU_FLAGS}" "sve" ISA_FOUND) + + if (NOT ISA_FOUND EQUAL -1) + set(HAVE_SVE ON) + else() + set(HAVE_SVE OFF) + endif() + + if (HAVE_SVE) + message(STATUS "[AARCH64] ISA SVE detected") + target_compile_options(${TARGET_NAME} PRIVATE "-march=armv8.4-a+sve") + add_definitions(-DHAVE_SVE) + endif() +endif() + # Cross compiled function # TODO: The same for proposal, proposalONNX, topk cross_compiled_file(${TARGET_NAME}