build: add basic support for IBM POWER, tested on POWER9.
Use auto-vectorization same as for ARM.
This commit is contained in:
committed by
Evarist
parent
aab2868073
commit
c530962ec0
@@ -91,6 +91,8 @@ endif()
|
||||
if(NOT DNNL_TARGET_ARCH)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)")
|
||||
set(DNNL_TARGET_ARCH "AARCH64")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64.*|PPC64.*)")
|
||||
set(DNNL_TARGET_ARCH "PPC64")
|
||||
else()
|
||||
set(DNNL_TARGET_ARCH "X64")
|
||||
endif()
|
||||
|
||||
@@ -19,7 +19,8 @@ oneAPI Deep Neural Network Library (oneDNN) is an open-source cross-platform
|
||||
performance library of basic building blocks for deep learning applications.
|
||||
The library is optimized for Intel Architecture Processors, Intel Processor
|
||||
Graphics and Xe architecture-based Graphics. Support for other architectures
|
||||
such as Arm\* 64-bit Architecture (AArch64) is experimental.
|
||||
such as Arm\* 64-bit Architecture (AArch64) and OpenPOWER\* Power ISA (PPC64)
|
||||
is experimental.
|
||||
See the [System Requirements](#system-requirements) section below.
|
||||
|
||||
oneDNN is intended for deep learning applications and framework
|
||||
@@ -88,11 +89,12 @@ If the configuration you need is not available, you can
|
||||
oneDNN supports platforms based on the following architectures:
|
||||
- [Intel 64 or AMD64](https://en.wikipedia.org/wiki/X86-64),
|
||||
- [Arm 64-bit Architecture (AArch64)](https://developer.arm.com/architectures/cpu-architecture/a-profile).
|
||||
- [OpenPOWER](https://openpowerfoundation.org/) / [IBM Power ISA](https://en.wikipedia.org/wiki/Power_ISA).
|
||||
|
||||
> **WARNING**
|
||||
>
|
||||
> Arm 64-bit Architecture (AArch64) support is **experimental** with limited
|
||||
> testing validation.
|
||||
> Arm 64-bit Architecture (AArch64) and Power ISA (PPC64) support
|
||||
> is **experimental** with limited testing validation.
|
||||
|
||||
The library is optimized for the following CPUs:
|
||||
* Intel Atom processor with Intel SSE4.1 support
|
||||
@@ -123,7 +125,7 @@ The library is optimized for the following GPUs:
|
||||
## Requirements for Building from Source
|
||||
|
||||
oneDNN supports systems meeting the following requirements:
|
||||
* Operating system with Intel 64 architecture support
|
||||
* Operating system with Intel 64 / Arm 64 / Power architecture support
|
||||
* C++ compiler with C++11 standard support
|
||||
* [CMake](https://cmake.org/download/) 2.8.11 or later
|
||||
* [Doxygen](http://www.doxygen.nl/download.html#srcbin) 1.8.5 or later
|
||||
@@ -135,8 +137,8 @@ dependencies.
|
||||
### CPU Engine
|
||||
|
||||
oneDNN CPU engine is used to execute primitives on Intel Architecture
|
||||
Processors, 64-bit Arm Architecture (AArch64) processors, and compatible
|
||||
devices.
|
||||
Processors, 64-bit Arm Architecture (AArch64) processors,
|
||||
64-bit Power ISA (PPC64) processors, and compatible devices.
|
||||
|
||||
The CPU engine is built by default and cannot be disabled at build time. The
|
||||
engine can be configured to use the OpenMP or TBB threading runtime. The
|
||||
|
||||
@@ -107,6 +107,12 @@ elseif(UNIX OR MINGW)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
|
||||
append(DEF_ARCH_OPT_FLAGS "-mcpu=native")
|
||||
endif()
|
||||
elseif(DNNL_TARGET_ARCH STREQUAL "PPC64")
|
||||
set(DEF_ARCH_OPT_FLAGS "-O3")
|
||||
# For native compilation tune for the host processor
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
|
||||
append(DEF_ARCH_OPT_FLAGS "-mcpu=native")
|
||||
endif()
|
||||
elseif(DNNL_TARGET_ARCH STREQUAL "X64")
|
||||
set(DEF_ARCH_OPT_FLAGS "-msse4.1")
|
||||
endif()
|
||||
@@ -159,6 +165,13 @@ elseif(UNIX OR MINGW)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
|
||||
append(DEF_ARCH_OPT_FLAGS "-mcpu=native")
|
||||
endif()
|
||||
elseif(DNNL_TARGET_ARCH STREQUAL "PPC64")
|
||||
set(DEF_ARCH_OPT_FLAGS "-O3")
|
||||
# In GCC, -ftree-vectorize is turned on under -O3 since 2007.
|
||||
# For native compilation tune for the host processor
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
|
||||
append(DEF_ARCH_OPT_FLAGS "-mcpu=native")
|
||||
endif()
|
||||
elseif(DNNL_TARGET_ARCH STREQUAL "X64")
|
||||
set(DEF_ARCH_OPT_FLAGS "-msse4.1")
|
||||
endif()
|
||||
|
||||
@@ -43,6 +43,7 @@ header file provides a set of helpers macros that could help conditionally
|
||||
enable or disable parts of code. There the following macros defined:
|
||||
- `DNNL_X64` is 1 on x64 architecture;
|
||||
- `DNNL_AARCH64` is 1 on Arm AArch64 architecture;
|
||||
- `DNNL_PPC64` is 1 on OpenPOWER / IBM Power architecture;
|
||||
- `DNNL_ARCH_GENERIC` is 1 on other platforms.
|
||||
Only one of the macros above is defined to 1. All others are defined to 0.
|
||||
|
||||
|
||||
+13
-2
@@ -25,20 +25,27 @@
|
||||
// Possible architectures:
|
||||
// - DNNL_X64
|
||||
// - DNNL_AARCH64
|
||||
// - DNNL_PPC64
|
||||
// - DNNL_ARCH_GENERIC
|
||||
// Target architecture macro is set to 1, others to 0. All macros are defined.
|
||||
|
||||
#if defined(DNNL_X64) + defined(DNNL_AARCH64) + defined(DNNL_ARCH_GENERIC) == 0
|
||||
#if defined(DNNL_X64) + defined(DNNL_AARCH64) + defined(DNNL_PPC64) \
|
||||
+ defined(DNNL_ARCH_GENERIC) \
|
||||
== 0
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
#define DNNL_X64 1
|
||||
#elif defined(__aarch64__)
|
||||
#define DNNL_AARCH64 1
|
||||
#elif defined(__powerpc64__) || defined(__PPC64__) || defined(_ARCH_PPC64)
|
||||
#define DNNL_PPC64 1
|
||||
#else
|
||||
#define DNNL_ARCH_GENERIC 1
|
||||
#endif
|
||||
#endif // defined(DNNL_X64) + ... == 0
|
||||
|
||||
#if defined(DNNL_X64) + defined(DNNL_AARCH64) + defined(DNNL_ARCH_GENERIC) != 1
|
||||
#if defined(DNNL_X64) + defined(DNNL_AARCH64) + defined(DNNL_PPC64) \
|
||||
+ defined(DNNL_ARCH_GENERIC) \
|
||||
!= 1
|
||||
#error One and only one architecture should be defined at a time
|
||||
#endif
|
||||
|
||||
@@ -48,6 +55,9 @@
|
||||
#if !defined(DNNL_AARCH64)
|
||||
#define DNNL_AARCH64 0
|
||||
#endif
|
||||
#if !defined(DNNL_PPC64)
|
||||
#define DNNL_PPC64 0
|
||||
#endif
|
||||
#if !defined(DNNL_ARCH_GENERIC)
|
||||
#define DNNL_ARCH_GENERIC 0
|
||||
#endif
|
||||
@@ -56,6 +66,7 @@
|
||||
// Equivalent to: #if DNNL_$ARCH ... #endif
|
||||
#define DNNL_X64_ONLY(...) Z_CONDITIONAL_DO(DNNL_X64, __VA_ARGS__)
|
||||
#define DNNL_AARCH64_ONLY(...) Z_CONDITIONAL_DO(DNNL_AARCH64_ONLY, __VA_ARGS__)
|
||||
#define DNNL_PPC64_ONLY(...) Z_CONDITIONAL_DO(DNNL_PPC64_ONLY, __VA_ARGS__)
|
||||
|
||||
namespace dnnl {
|
||||
namespace impl {
|
||||
|
||||
Reference in New Issue
Block a user