diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index 0fc0e281f5ce30..b90ef03631d2c6 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -38,6 +38,8 @@ if(X86_64) elseif(AARCH64) add_definitions(-DOV_CPU_AARCH64) set(OV_CPU_AARCH64 ON) +elseif(X86 OR RISCV64) + # nothing for now else() message(FATAL_ERROR "Unsupported system processor ${CMAKE_SYSTEM_PROCESSOR}") endif() diff --git a/src/plugins/intel_cpu/src/cpu_shape.h b/src/plugins/intel_cpu/src/cpu_shape.h index 15f03ca3abd7d0..7d25a3eb5ce928 100644 --- a/src/plugins/intel_cpu/src/cpu_shape.h +++ b/src/plugins/intel_cpu/src/cpu_shape.h @@ -194,7 +194,7 @@ class Shape { } enum : Dim { - UNDEFINED_DIM = 0xffffffffffffffff + UNDEFINED_DIM = std::numeric_limits::max() }; private: diff --git a/src/plugins/intel_cpu/src/cpu_types.cpp b/src/plugins/intel_cpu/src/cpu_types.cpp index 524950076456db..a5fb0b99f096cd 100644 --- a/src/plugins/intel_cpu/src/cpu_types.cpp +++ b/src/plugins/intel_cpu/src/cpu_types.cpp @@ -9,9 +9,6 @@ namespace ov { namespace intel_cpu { -using Dim = std::size_t; -using VectorDims = std::vector; - const InferenceEngine::details::caseless_unordered_map type_to_name_tbl = { { "Constant", Type::Input }, { "Parameter", Type::Input }, diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cpp index 33e76c413bac2c..a8c9cecdb7c1f3 100644 --- a/src/plugins/intel_cpu/src/plugin.cpp +++ b/src/plugins/intel_cpu/src/plugin.cpp @@ -25,13 +25,30 @@ #include "weights_cache.hpp" #include "utils/denormals.hpp" -#if !defined(__arm__) && !defined(_M_ARM) && !defined(__aarch64__) && !defined(_M_ARM64) -#ifndef __GNUC_PREREQ -#define __GNUC_PREREQ(major, minor) ((((__GNUC__) << 16) + (__GNUC_MINOR__)) >= (((major) << 16) + (minor))) +#if defined(__arm__) || defined(_M_ARM) +# define OV_CPU_ARM +#elif defined(__aarch64__) || defined(_M_ARM64) +# define OV_CPU_ARM64 +#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(__IA32__) || \ + defined(_M_I86) || defined(_M_IX86) || defined(__X86__) || defined(_X86_) +# define OV_CPU_X86 +#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || \ + defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64) +# define OV_CPU_X86_64 +#elif defined(__riscv) +# define OV_CPU_RISCV64 #endif + +#if !(defined(OV_CPU_ARM) || defined(OV_CPU_ARM64)) +# ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(major, minor) ((((__GNUC__) << 16) + (__GNUC_MINOR__)) >= (((major) << 16) + (minor))) +#endif + # ifdef _WIN32 # include # include +#elif defined(__EMSCRIPTEN__) +// nothing # elif !(__GNUC_PREREQ(4, 3) && !defined(__APPLE__)) # include # endif @@ -55,7 +72,15 @@ namespace intel_cpu { static std::string getDeviceFullName() { std::string brand_string; -#if !defined(__arm__) && !defined(_M_ARM) && !defined(__aarch64__) && !defined(_M_ARM64) +#ifdef __EMSCRIPTEN__ + brand_string = "WebAssembly CPU"; +#elif defined(OV_CPU_RISCV64) + // TODO: extract actual device name + brand_string = "RISCV-64 CPU"; +#elif defined(OV_CPU_ARM64) || defined(OV_CPU_ARM) + // TODO: extract actual device name + brand_string = "ARM CPU"; +#elif defined(OV_CPU_X86_64) || defined(OV_CPU_X86) const unsigned int addr_list[3] = { 0x80000002, 0x80000003, 0x80000004 }; unsigned int regs[4]; for (auto addr : addr_list) { @@ -70,7 +95,7 @@ static std::string getDeviceFullName() { brand_string += ch[j]; } #else - brand_string = "Non Intel Architecture"; +# error "Unknown device architecture" #endif return brand_string; } diff --git a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt index 01b23cd8a90cd1..f37c6fcd8008b0 100644 --- a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt @@ -52,6 +52,10 @@ function(ie_add_onednn) endif() if(X86_64) set(DNNL_TARGET_ARCH "X64" CACHE STRING "" FORCE) + elseif(X86) + set(DNNL_TARGET_ARCH "X86" CACHE STRING "" FORCE) + elseif(RISCV64) + set(DNNL_TARGET_ARCH "RV64" CACHE STRING "" FORCE) elseif(AARCH64) set(DNNL_TARGET_ARCH "AARCH64" CACHE STRING "" FORCE) set(DNNL_AARCH64_USE_ACL ON CACHE BOOL "" FORCE) @@ -68,8 +72,8 @@ function(ie_add_onednn) set(ARM_COMPUTE_TARGET_ARCH_DEFAULT arm64-v8a) endif() set(ARM_COMPUTE_TARGET_ARCHS arm64-v8a arm64-v8.2-a arm64-v8.2-a-sve arm64-v8.2-a-sve2 - armv8a armv8.2-a armv8.2-a-sve armv8.6-a armv8.6-a-sve armv8.6-a-sve2 - armv8r64) + armv8a armv8.2-a armv8.2-a-sve armv8.6-a armv8.6-a-sve armv8.6-a-sve2 + armv8r64) set(ARM_COMPUTE_TARGET_ARCH "${ARM_COMPUTE_TARGET_ARCH_DEFAULT}" CACHE STRING "Architecture for ARM ComputeLibrary") set_property(CACHE ARM_COMPUTE_TARGET_ARCH PROPERTY STRINGS ${ARM_COMPUTE_TARGET_ARCHS}) diff --git a/src/plugins/intel_cpu/thirdparty/FindACL.cmake b/src/plugins/intel_cpu/thirdparty/FindACL.cmake index deee92e669a084..540311067bf9af 100644 --- a/src/plugins/intel_cpu/thirdparty/FindACL.cmake +++ b/src/plugins/intel_cpu/thirdparty/FindACL.cmake @@ -89,7 +89,7 @@ else() logging=1) endif() - if(EMSCRIPTEN) + if(EMSCRIPTEN OR LINUX) list(APPEND ARM_COMPUTE_OPTIONS os=linux) elseif(ANDROID) list(APPEND ARM_COMPUTE_OPTIONS os=android) @@ -135,6 +135,14 @@ else() set(extra_link_flags "${extra_link_flags} ${extra_flags}") set(extra_cxx_flags "${extra_cxx_flags} ${extra_flags}") + elseif(CMAKE_CROSSCOMPILING AND LINUX) + get_filename_component(cxx_compiler "${CMAKE_CXX_COMPILER}" NAME) + get_filename_component(c_compiler "${CMAKE_C_COMPILER}" NAME) + get_filename_component(compiler_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY) + set(cmake_build_env + CC=${c_compiler} + CXX=${cxx_compiler}) + list(APPEND ARM_COMPUTE_OPTIONS compiler_prefix="${compiler_prefix}/") elseif(EMSCRIPTEN) set(cmake_build_env CC=emcc @@ -179,9 +187,7 @@ else() endif() if(ENABLE_LTO) - if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR - CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$") - AND (NOT CMAKE_CROSSCOMPILING)) + if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND (NOT CMAKE_CROSSCOMPILING)) set(extra_cxx_flags "${extra_cxx_flags} -flto=thin") set(extra_link_flags "${extra_link_flags} -flto=thin") endif() diff --git a/src/plugins/intel_cpu/thirdparty/onednn b/src/plugins/intel_cpu/thirdparty/onednn index 4504d6c5adbe2b..751e3bbe3dbd43 160000 --- a/src/plugins/intel_cpu/thirdparty/onednn +++ b/src/plugins/intel_cpu/thirdparty/onednn @@ -1 +1 @@ -Subproject commit 4504d6c5adbe2bb97c42e9c8073ff62c73505450 +Subproject commit 751e3bbe3dbd4327dcc1d0ee479edc69c52d8236