[Openmp-commits] [openmp] r226479 - added support for PPC architectures (version 3): initial patch provided by Carlo Bertolli, latest version from Johnny Peyton
Andrey Churbanov
Andrey.Churbanov at intel.com
Mon Jan 19 10:29:35 PST 2015
Author: achurbanov
Date: Mon Jan 19 12:29:35 2015
New Revision: 226479
URL: http://llvm.org/viewvc/llvm-project?rev=226479&view=rev
Log:
added support for PPC architectures (version 3): initial patch provided by Carlo Bertolli, latest version from Johnny Peyton
Modified:
openmp/trunk/runtime/CMakeLists.txt
openmp/trunk/runtime/README.txt
openmp/trunk/runtime/cmake/HelperFunctions.cmake
openmp/trunk/runtime/src/kmp_os.h
openmp/trunk/runtime/src/kmp_tasking.c
openmp/trunk/runtime/src/makefile.mk
openmp/trunk/runtime/tools/lib/Platform.pm
openmp/trunk/runtime/tools/lib/Uname.pm
openmp/trunk/runtime/tools/src/common-defs.mk
Modified: openmp/trunk/runtime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/CMakeLists.txt?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/CMakeLists.txt (original)
+++ openmp/trunk/runtime/CMakeLists.txt Mon Jan 19 12:29:35 2015
@@ -50,7 +50,7 @@ include(GetArchitecture) # get_architect
# Build Configuration
set(os_possible_values lin mac win)
-set(arch_possible_values 32e 32 arm ppc64 aarch64 mic)
+set(arch_possible_values 32e 32 arm ppc64 ppc64le aarch64 mic)
set(build_type_possible_values release debug relwithdebinfo)
set(omp_version_possible_values 40 30)
set(lib_type_possible_values normal profile stubs)
@@ -75,7 +75,7 @@ endif()
get_architecture(detected_arch)
set(os ${temp_os} CACHE STRING "The operating system to build for (lin/mac/win)")
-set(arch ${detected_arch} CACHE STRING "The architecture to build for (32e/32/arm/ppc64/aarch64/mic). 32e is Intel(R) 64 architecture, 32 is IA-32 architecture")
+set(arch ${detected_arch} CACHE STRING "The architecture to build for (32e/32/arm/ppc64/ppc64le/aarch64/mic). 32e is Intel(R) 64 architecture, 32 is IA-32 architecture")
set(lib_type normal CACHE STRING "Performance,Profiling,Stubs library (normal/profile/stubs)")
set(version 5 CACHE STRING "Produce libguide (version 4) or libiomp5 (version 5)")
set(omp_version 40 CACHE STRING "The OpenMP version (40/30)")
@@ -165,6 +165,8 @@ set(IA32 FALSE)
set(INTEL64 FALSE)
set(ARM FALSE)
set(AARCH64 FALSE)
+set(PPC64BE FALSE)
+set(PPC64LE FALSE)
set(PPC64 FALSE)
if("${arch}" STREQUAL "32") # IA-32 architecture
set(IA32 TRUE)
@@ -172,10 +174,14 @@ elseif("${arch}" STREQUAL "32e") # Intel
set(INTEL64 TRUE)
elseif("${arch}" STREQUAL "arm") # ARM architecture
set(ARM TRUE)
+elseif("${arch}" STREQUAL "ppc64") # PPC64BE architecture
+ set(PPC64BE TRUE)
+ set(PPC64 TRUE)
+elseif("${arch}" STREQUAL "ppc64le") # PPC64LE architecture
+ set(PPC64LE TRUE)
+ set(PPC64 TRUE)
elseif("${arch}" STREQUAL "aarch64") # AARCH64 architecture
set(AARCH64 TRUE)
-elseif("${arch}" STREQUAL "ppc64") # PPC64 architecture
- set(PPC64 TRUE)
elseif("${arch}" STREQUAL "mic") # Intel(R) Many Integrated Core Architecture
set(MIC TRUE)
endif()
Modified: openmp/trunk/runtime/README.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/README.txt?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/README.txt (original)
+++ openmp/trunk/runtime/README.txt Mon Jan 19 12:29:35 2015
@@ -46,6 +46,8 @@ arch: Architecture. By default, t
"32" for IA-32 architecture
"32e" for Intel(R) 64 architecture
"mic" for Intel(R) Many Integrated Core Architecture
+ "ppc64" for IBM(R) Power architecture (big endian)
+ "ppc64le" for IBM(R) Power architecture (little endian)
If "mic" is specified then "icc" will be used as the
compiler, and appropriate k1om binutils will be used. The
Modified: openmp/trunk/runtime/cmake/HelperFunctions.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/HelperFunctions.cmake?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/cmake/HelperFunctions.cmake (original)
+++ openmp/trunk/runtime/cmake/HelperFunctions.cmake Mon Jan 19 12:29:35 2015
@@ -67,8 +67,10 @@ function(set_legal_arch return_arch_stri
set(${return_arch_string} "L1OM" PARENT_SCOPE)
elseif(${ARM})
set(${return_arch_string} "ARM" PARENT_SCOPE)
- elseif(${PPC64})
- set(${return_arch_string} "PPC64" PARENT_SCOPE)
+ elseif(${PPC64BE})
+ set(${return_arch_string} "PPC64BE" PARENT_SCOPE)
+ elseif(${PPC64LE})
+ set(${return_arch_string} "PPC64LE" PARENT_SCOPE)
elseif(${AARCH64})
set(${return_arch_string} "AARCH64" PARENT_SCOPE)
else()
Modified: openmp/trunk/runtime/src/kmp_os.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_os.h?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_os.h (original)
+++ openmp/trunk/runtime/src/kmp_os.h Mon Jan 19 12:29:35 2015
@@ -75,8 +75,12 @@
#define KMP_ARCH_X86 0
#define KMP_ARCH_X86_64 0
-#define KMP_ARCH_PPC64 0
#define KMP_ARCH_AARCH64 0
+#define KMP_ARCH_PPC64_BE 0
+#define KMP_ARCH_PPC64_LE 0
+
+#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE)
+
#ifdef _WIN32
# undef KMP_OS_WINDOWS
@@ -141,8 +145,13 @@
# undef KMP_ARCH_X86
# define KMP_ARCH_X86 1
# elif defined __powerpc64__
-# undef KMP_ARCH_PPC64
-# define KMP_ARCH_PPC64 1
+# if defined __LITTLE_ENDIAN__
+# undef KMP_ARCH_PPC64_LE
+# define KMP_ARCH_PPC64_LE 1
+# else
+# undef KMP_ARCH_PPC64_BE
+# define KMP_ARCH_PPC64_BE 1
+# endif
# elif defined __aarch64__
# undef KMP_ARCH_AARCH64
# define KMP_ARCH_AARCH64 1
Modified: openmp/trunk/runtime/src/kmp_tasking.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.c?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.c (original)
+++ openmp/trunk/runtime/src/kmp_tasking.c Mon Jan 19 12:29:35 2015
@@ -835,7 +835,7 @@ __kmp_task_alloc( ident_t *loc_ref, kmp_
task = KMP_TASKDATA_TO_TASK(taskdata);
// Make sure task & taskdata are aligned appropriately
-#if KMP_ARCH_X86 || !KMP_HAVE_QUAD
+#if KMP_ARCH_X86 || KMP_ARCH_PPC64 || !KMP_HAVE_QUAD
KMP_DEBUG_ASSERT( ( ((kmp_uintptr_t)taskdata) & (sizeof(double)-1) ) == 0 );
KMP_DEBUG_ASSERT( ( ((kmp_uintptr_t)task) & (sizeof(double)-1) ) == 0 );
#else
Modified: openmp/trunk/runtime/src/makefile.mk
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/makefile.mk?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/src/makefile.mk (original)
+++ openmp/trunk/runtime/src/makefile.mk Mon Jan 19 12:29:35 2015
@@ -379,7 +379,7 @@ ifeq "$(os)" "lin"
ld-flags-extra += -lirc_pic
endif
endif
- ifeq "$(filter 32 32e 64 ppc64,$(arch))" ""
+ ifeq "$(filter 32 32e 64 ppc64 ppc64le,$(arch))" ""
ld-flags-extra += $(shell pkg-config --libs libffi)
endif
else
@@ -478,16 +478,13 @@ endif
cpp-flags += -D KMP_LIBRARY_FILE=\"$(lib_file)\"
cpp-flags += -D KMP_VERSION_MAJOR=$(VERSION)
-# customize ppc64 cache line size to 128, 64 otherwise
-ifeq "$(arch)" "ppc64"
- cpp-flags += -D CACHE_LINE=128
-else
- cpp-flags += -D CACHE_LINE=64
-endif
-
-# customize aarch64 cache line size to 128, 64 otherwise magic won't happen
-# Just kidding.. can we have some documentation on this, please
-ifeq "$(arch)" "aarch64"
+# Customize ppc64 and aarch64 cache line size to 128, use 64 otherwise
+# Almost all data structures (kmp.h) are aligned to a cache line to reduce false sharing, thus
+# increasing performance. For heavily accessed data structures (e.g., kmp_base_info), there are
+# members of the data structure that are grouped together according to their memory access
+# pattern. For example, readonly data is put on cache lines together. Then, on separate cachelines,
+# private data used by the working thread is put on its own cache lines. etc.
+ifneq "$(filter aarch64 ppc64 ppc64le,$(arch))" ""
cpp-flags += -D CACHE_LINE=128
else
cpp-flags += -D CACHE_LINE=64
@@ -498,8 +495,9 @@ cpp-flags += -D BUILD_PARALLEL_ORDERED
cpp-flags += -D KMP_ASM_INTRINS
cpp-flags += -D KMP_USE_INTERNODE_ALIGNMENT=0
# Linux and MIC compile with version symbols
+# ppc64 and ppc64le architectures don't compile with version symbols
ifneq "$(filter lin,$(os))" ""
-ifeq "$(filter ppc64,$(arch))" ""
+ifeq "$(filter ppc64 ppc64le,$(arch))" ""
cpp-flags += -D KMP_USE_VERSION_SYMBOLS
endif
endif
@@ -623,9 +621,9 @@ ifneq "$(os)" "win"
ifeq "$(arch)" "arm"
z_Linux_asm$(obj) : \
cpp-flags += -D KMP_ARCH_ARM
- else ifeq "$(arch)" "ppc64"
+ else ifneq "$(filter ppc64 ppc64le,$(arch))" ""
z_Linux_asm$(obj) : \
- cpp-flags += -D KMP_ARCH_PPC64
+ cpp-flags += -D KMP_ARCH_PPC64
else ifeq "$(arch)" "aarch64"
z_Linux_asm$(obj) : \
cpp-flags += -D KMP_ARCH_AARCH64
@@ -1471,9 +1469,12 @@ ifneq "$(filter %-dyna win-%,$(os)-$(LIN
td_exp += ld-linux-armhf.so.3
td_exp += libgcc_s.so.1
endif
- ifeq "$(arch)" "ppc64"
+ ifneq "$(filter ppc64 ppc64le,$(arch))" ""
td_exp += libc.so.6
td_exp += ld64.so.1
+ # warning: this is for ppc64le, but as we do not currently
+ # distinguish it from ppc64, we need to add this dep here
+ td_exp += ld64.so.2
td_exp += libgcc_s.so.1
endif
ifeq "$(arch)" "aarch"
@@ -1494,7 +1495,7 @@ ifneq "$(filter %-dyna win-%,$(os)-$(LIN
endif
td_exp += libdl.so.2
- ifeq "$(filter 32 32e 64 ppc64 mic,$(arch))" ""
+ ifeq "$(filter 32 32e 64 ppc64 ppc64le mic,$(arch))" ""
td_exp += libffi.so.6
td_exp += libffi.so.5
endif
Modified: openmp/trunk/runtime/tools/lib/Platform.pm
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/tools/lib/Platform.pm?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/tools/lib/Platform.pm (original)
+++ openmp/trunk/runtime/tools/lib/Platform.pm Mon Jan 19 12:29:35 2015
@@ -50,6 +50,8 @@ sub canon_arch($) {
$arch = "32e";
} elsif ( $arch =~ m{\Aarm(?:v7\D*)?\z} ) {
$arch = "arm";
+ } elsif ( $arch =~ m{\Appc64le} ) {
+ $arch = "ppc64le";
} elsif ( $arch =~ m{\Appc64} ) {
$arch = "ppc64";
} elsif ( $arch =~ m{\Aaarch64} ) {
@@ -201,6 +203,8 @@ sub target_options() {
$_host_arch = "32e";
} elsif ( $hardware_platform eq "arm" ) {
$_host_arch = "arm";
+ } elsif ( $hardware_platform eq "ppc64le" ) {
+ $_host_arch = "ppc64le";
} elsif ( $hardware_platform eq "ppc64" ) {
$_host_arch = "ppc64";
} elsif ( $hardware_platform eq "aarch64" ) {
@@ -391,7 +395,7 @@ the script assumes host architecture is
Input string is an architecture name to canonize. The function recognizes many variants, for example:
C<32e>, C<Intel64>, C<Intel(R) 64>, etc. Returned string is a canononized architecture name,
-one of: C<32>, C<32e>, C<64>, C<arm>, C<ppc64>, C<mic>, or C<undef> is input string is not recognized.
+one of: C<32>, C<32e>, C<64>, C<arm>, C<ppc64le>, C<ppc64>, C<mic>, or C<undef> is input string is not recognized.
=item B<legal_arch( $arch )>
Modified: openmp/trunk/runtime/tools/lib/Uname.pm
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/tools/lib/Uname.pm?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/tools/lib/Uname.pm (original)
+++ openmp/trunk/runtime/tools/lib/Uname.pm Mon Jan 19 12:29:35 2015
@@ -147,6 +147,8 @@ if ( 0 ) {
$values{ hardware_platform } = "x86_64";
} elsif ( $values{ machine } =~ m{\Aarmv7\D*\z} ) {
$values{ hardware_platform } = "arm";
+ } elsif ( $values{ machine } =~ m{\Appc64le\z} ) {
+ $values{ hardware_platform } = "ppc64le";
} elsif ( $values{ machine } =~ m{\Appc64\z} ) {
$values{ hardware_platform } = "ppc64";
} elsif ( $values{ machine } =~ m{\Aaarch64\z} ) {
Modified: openmp/trunk/runtime/tools/src/common-defs.mk
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/tools/src/common-defs.mk?rev=226479&r1=226478&r2=226479&view=diff
==============================================================================
--- openmp/trunk/runtime/tools/src/common-defs.mk (original)
+++ openmp/trunk/runtime/tools/src/common-defs.mk Mon Jan 19 12:29:35 2015
@@ -45,7 +45,7 @@ endif
# Description:
# The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64.
#
-legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(if $(filter aarch64,$(1)),AArch64,$(if $(filter mic,$(1)),Intel(R) Many Integrated Core Architecture,$(error Bad architecture specified: $(1)))))))))
+legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(if $(filter ppc64le,$(1)),PPC64LE,$(if $(filter aarch64,$(1)),AArch64,$(if $(filter mic,$(1)),Intel(R) Many Integrated Core Architecture,$(error Bad architecture specified: $(1))))))))))
# Synopsis:
# var_name = $(call check_variable,var,list)
@@ -128,13 +128,13 @@ endif
# --------------------------------------------------------------------------------------------------
os := $(call check_variable,os,lin mac win)
-arch := $(call check_variable,arch,32 32e 64 arm ppc64 aarch64 mic)
+arch := $(call check_variable,arch,32 32e 64 arm ppc64 ppc64le aarch64 mic)
ifeq "$(arch)" "mic" # We want the flavor of mic (knf, knc, knl, etc.)
platform := $(os)_$(MIC_ARCH)
else
platform := $(os)_$(arch)
endif
-platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lin_knc lin_knf mac_32 mac_32e win_32 win_32e win_64 lin_ppc64 lin_aarch64)
+platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lin_knc lin_knf mac_32 mac_32e win_32 win_32e win_64 lin_ppc64 lin_ppc64le lin_aarch64)
# oa-opts means "os and arch options". They are passed to almost all perl scripts.
oa-opts := --os=$(os) --arch=$(arch)
More information about the Openmp-commits
mailing list