Enabled Windows ARM64 build using MSVC cl compiler (#15132)

* Fixed Windows Arm64 build

* Fixed linker warnings in docs

* Fixed Windowd ARM build

* Reverted changes in docs

* Added OpenVINO level macro to define CPU architecture

* Properly remove xbyak from reference kernels optimizations

* Added documentation for cmake functions

* Fixed samples build

* Added installation dir for host protoc

* Fixed installation stage for host_protoc

* Added build dir

* Fixed compilation on Apple

* cççç

* Fixed clang code-style

* Tely on CPU id from xbyak

* Fixed build

* Fixed compilation on mac

* Fixed compilation
This commit is contained in:
Ilya Lavrenov authored and GitHub committed 2023-01-17 17:29:00 +04:00
1 parent 5043797b1c
commit c29f111717
19 files changed
+227 -95

No files matched your search

+6 -5
View File
@@ -41,14 +41,15 @@ struct Config {
size_t rtCacheCapacity = 5000ul;
InferenceEngine::IStreamsExecutor::Config streamExecutorConfig;
InferenceEngine::PerfHintsConfig perfHintsConfig;
#if defined(__arm__) || defined(__aarch64__)
// Currently INT8 mode is not optimized on ARM, fallback to FP32 mode.
LPTransformsMode lpTransformsMode = LPTransformsMode::Off;
bool enforceBF16 = false;
#else
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
LPTransformsMode lpTransformsMode = LPTransformsMode::On;
bool enforceBF16 = true;
bool manualEnforceBF16 = false;
#else
// Currently INT8 mode is not optimized on ARM / RISCV or other non-x86 platforms, fallback to FP32 mode.
LPTransformsMode lpTransformsMode = LPTransformsMode::Off;
bool enforceBF16 = false;
bool manualEnforceBF16 = false;
#endif
std::string cache_dir{};
+17 -21
View File
@@ -25,22 +25,10 @@
#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)))
#endif
# ifdef _WIN32
# include <intrin.h>
# include <windows.h>
# elif !(__GNUC_PREREQ(4, 3) && !defined(__APPLE__))
# include <cpuid.h>
# endif
#endif
#if defined(__linux__)
#include <sys/auxv.h>
#include <signal.h>
#include <sys/mman.h>
# include <sys/auxv.h>
# include <signal.h>
# include <sys/mman.h>
#endif
#include <cpu/x64/cpu_isa_traits.hpp>
@@ -55,7 +43,15 @@ namespace intel_cpu {
static std::string getDeviceFullName() {
std::string brand_string;
#if !defined(__arm__) && !defined(_M_ARM) && !defined(__aarch64__) && !defined(_M_ARM64)
#if defined(__EMSCRIPTEN___)
brand_string = "WebAssembly CPU";
#elif defined(OPENVINO_ARCH_RISCV64)
// TODO: extract actual device name
brand_string = "RISCV-64 CPU";
#elif defined(OPENVINO_ARCH_ARM) || defined(OPENVINO_ARCH_ARM64)
// TODO: extract actual device name
brand_string = "ARM CPU";
#elif defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
const unsigned int addr_list[3] = { 0x80000002, 0x80000003, 0x80000004 };
unsigned int regs[4];
for (auto addr : addr_list) {
@@ -63,14 +59,14 @@ static std::string getDeviceFullName() {
#ifdef _WIN32
__cpuid(reinterpret_cast<int*>(regs), regs[0]);
#else
__get_cpuid(regs[0], &regs[0], &regs[1], &regs[2], &regs[3]);
__cpuid(regs[0], regs[0], regs[1], regs[2], regs[3]);
#endif
char *ch = reinterpret_cast<char*>(&regs[0]);
for (size_t j = 0; j < sizeof(regs); j++)
brand_string += ch[j];
}
#else
brand_string = "Non Intel Architecture";
# error "Unkown CPU architecture. Please, add support to openvino/core/visibility.hpp"
#endif
return brand_string;
}
@@ -78,7 +74,7 @@ static std::string getDeviceFullName() {
#if defined(__linux__)
#ifndef AT_MINSIGSTKSZ
#define AT_MINSIGSTKSZ 51
# define AT_MINSIGSTKSZ 51
#endif
class SigAltStackSetup {
@@ -130,12 +126,12 @@ class CPUSpecialSetup {
public:
CPUSpecialSetup() = default;
};
#else
#else // __linux__
class CPUSpecialSetup {
public:
CPUSpecialSetup() = default;
};
#endif
#endif // __linux__
Engine::Engine() :
deviceFullName(getDeviceFullName()),
@@ -6,6 +6,8 @@
#include <immintrin.h>
#include "openvino/core/visibility.hpp"
namespace ov {
namespace intel_cpu {
static constexpr unsigned int FTZ_FLAG = 0x8000;
@@ -14,9 +16,7 @@ static constexpr unsigned int DAZ_FLAG = 0x0040;
bool flush_to_zero(bool on);
bool denormals_as_zero(bool on);
#if defined(__x86_64__) || defined(_M_X64)
// MSVC _M_X64
// GCC __x86_64__
#ifdef OPENVINO_ARCH_X86_64
bool flush_to_zero(bool on) {
unsigned int mxcsr = _mm_getcsr();
@@ -39,7 +39,7 @@ bool denormals_as_zero(bool on) {
_mm_setcsr(mxcsr);
return true;
}
#else
#else // OPENVINO_ARCH_X86_64
#if defined(__SSE__) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)
bool flush_to_zero(bool on) {
unsigned int mxcsr = _mm_getcsr();
@@ -109,7 +109,7 @@ bool denormals_as_zero(bool on) {
bool flush_to_zero(bool on) { return false; }
bool denormals_as_zero(bool on) { return false; }
#endif
#endif
#endif // OPENVINO_ARCH_X86_64
} // namespace intel_cpu
} // namespace ov