Skip to content

Commit 2edce42

Browse files
authored
[openmp][AIX]Initial changes for porting to AIX (#76841)
This PR contains initial changes for building and testing libomp on AIX. More changes will follow. - `KMP_OS_AIX` is defined for the AIX platform - `KMP_ARCH_PPC` is defined for 32-bit PPC - `KMP_ARCH_PPC_XCOFF` and `KMP_ARCH_PPC64_XCOFF` are for 32- and 64-bit XCOFF object formats respectively - Assembly file `z_AIX_asm.S` is used for AIX specific assembly code and will be added in a separate PR - The target library is disabled because AIX does not have the device support - OMPT is temporarily disabled
1 parent 0e4a380 commit 2edce42

18 files changed

+112
-33
lines changed

openmp/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ set(ENABLE_LIBOMPTARGET ON)
9494
# Since the device plugins are only supported on Linux anyway,
9595
# there is no point in trying to compile libomptarget on other OSes.
9696
# 32-bit systems are not supported either.
97-
if (APPLE OR WIN32 OR WASM OR NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
97+
if (APPLE OR WIN32 OR WASM OR NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES
98+
OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
9899
set(ENABLE_LIBOMPTARGET OFF)
99100
endif()
100101

openmp/cmake/OpenMPTesting.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ if (${OPENMP_STANDALONE_BUILD})
5555
if (MSVC OR XCODE)
5656
set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar")
5757
endif()
58+
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
59+
set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=1800")
60+
endif()
5861
set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.")
5962
separate_arguments(OPENMP_LIT_ARGS)
6063
else()

openmp/runtime/CMakeLists.txt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if(${OPENMP_STANDALONE_BUILD})
3030
# If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake
3131
libomp_get_architecture(LIBOMP_DETECTED_ARCH)
3232
set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING
33-
"The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic/mips/mips64/riscv64/loongarch64/ve/s390x/wasm32).")
33+
"The architecture to build for (x86_64/i386/arm/ppc/ppc64/ppc64le/aarch64/mic/mips/mips64/riscv64/loongarch64/ve/s390x/wasm32).")
3434
# Should assertions be enabled? They are on by default.
3535
set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
3636
"enable assertions?")
@@ -51,8 +51,10 @@ else() # Part of LLVM build
5151
set(LIBOMP_ARCH x86_64)
5252
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc64le")
5353
set(LIBOMP_ARCH ppc64le)
54-
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
54+
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc64")
5555
set(LIBOMP_ARCH ppc64)
56+
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
57+
set(LIBOMP_ARCH ppc)
5658
elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64")
5759
set(LIBOMP_ARCH aarch64)
5860
elseif(LIBOMP_NATIVE_ARCH MATCHES "arm64")
@@ -89,7 +91,7 @@ if(LIBOMP_ARCH STREQUAL "aarch64")
8991
endif()
9092
endif()
9193

92-
libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 aarch64_a64fx mic mips mips64 riscv64 loongarch64 ve s390x wasm32)
94+
libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc ppc64 ppc64le aarch64 aarch64_a64fx mic mips mips64 riscv64 loongarch64 ve s390x wasm32)
9395

9496
set(LIBOMP_LIB_TYPE normal CACHE STRING
9597
"Performance,Profiling,Stubs library (normal/profile/stubs)")
@@ -128,8 +130,14 @@ set(LIBOMP_ASMFLAGS "" CACHE STRING
128130
"Appended user specified assembler flags.")
129131
set(LIBOMP_LDFLAGS "" CACHE STRING
130132
"Appended user specified linker flags.")
131-
set(LIBOMP_LIBFLAGS "" CACHE STRING
132-
"Appended user specified linked libs flags. (e.g., -lm)")
133+
if("${LIBOMP_ARCH}" STREQUAL "ppc" AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
134+
# PPC (32-bit) on AIX needs libatomic for __atomic_load_8, etc.
135+
set(LIBOMP_LIBFLAGS "-latomic" CACHE STRING
136+
"Appended user specified linked libs flags. (e.g., -lm)")
137+
else()
138+
set(LIBOMP_LIBFLAGS "" CACHE STRING
139+
"Appended user specified linked libs flags. (e.g., -lm)")
140+
endif()
133141
set(LIBOMP_FFLAGS "" CACHE STRING
134142
"Appended user specified Fortran compiler flags. These are only used if LIBOMP_FORTRAN_MODULES==TRUE.")
135143

@@ -171,12 +179,15 @@ set(LOONGARCH64 FALSE)
171179
set(VE FALSE)
172180
set(S390X FALSE)
173181
set(WASM FALSE)
182+
set(PPC FALSE)
174183
if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture
175184
set(IA32 TRUE)
176185
elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture
177186
set(INTEL64 TRUE)
178187
elseif("${LIBOMP_ARCH}" STREQUAL "arm") # ARM architecture
179188
set(ARM TRUE)
189+
elseif("${LIBOMP_ARCH}" STREQUAL "ppc") # PPC32 architecture
190+
set(PPC TRUE)
180191
elseif("${LIBOMP_ARCH}" STREQUAL "ppc64") # PPC64BE architecture
181192
set(PPC64BE TRUE)
182193
set(PPC64 TRUE)

openmp/runtime/cmake/LibompGetArchitecture.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ function(libomp_get_architecture return_arch)
4141
#error ARCHITECTURE=ppc64le
4242
#elif defined(__powerpc64__)
4343
#error ARCHITECTURE=ppc64
44+
#elif defined(__powerpc__) && !defined(__powerpc64__)
45+
#error ARCHITECTURE=ppc
4446
#elif defined(__mips__) && defined(__mips64)
4547
#error ARCHITECTURE=mips64
4648
#elif defined(__mips__) && !defined(__mips64)

openmp/runtime/cmake/config-ix.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ else()
333333
(LIBOMP_ARCH STREQUAL loongarch64) OR
334334
(LIBOMP_ARCH STREQUAL s390x))
335335
AND # OS supported?
336-
((WIN32 AND LIBOMP_HAVE_PSAPI) OR APPLE OR (NOT WIN32 AND LIBOMP_HAVE_WEAK_ATTRIBUTE)))
336+
((WIN32 AND LIBOMP_HAVE_PSAPI) OR APPLE OR
337+
(NOT (WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND LIBOMP_HAVE_WEAK_ATTRIBUTE)))
337338
set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
338339
else()
339340
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)

openmp/runtime/src/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ else()
108108
# Unix specific files
109109
libomp_append(LIBOMP_CXXFILES z_Linux_util.cpp)
110110
libomp_append(LIBOMP_CXXFILES kmp_gsupport.cpp)
111-
libomp_append(LIBOMP_GNUASMFILES z_Linux_asm.S) # Unix assembly file
111+
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
112+
libomp_append(LIBOMP_GNUASMFILES z_AIX_asm.S) # AIX assembly file
113+
else()
114+
libomp_append(LIBOMP_GNUASMFILES z_Linux_asm.S) # Unix assembly file
115+
endif()
112116
endif()
113117
libomp_append(LIBOMP_CXXFILES thirdparty/ittnotify/ittnotify_static.cpp LIBOMP_USE_ITT_NOTIFY)
114118
libomp_append(LIBOMP_CXXFILES kmp_debugger.cpp LIBOMP_USE_DEBUGGER)

openmp/runtime/src/kmp.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,9 @@ extern void __kmp_init_target_task();
11921192
// Minimum stack size for pthread for VE is 4MB.
11931193
// https://www.hpc.nec/documents/veos/en/glibc/Difference_Points_glibc.htm
11941194
#define KMP_DEFAULT_STKSIZE ((size_t)(4 * 1024 * 1024))
1195+
#elif KMP_OS_AIX
1196+
// The default stack size for worker threads on AIX is 4MB.
1197+
#define KMP_DEFAULT_STKSIZE ((size_t)(4 * 1024 * 1024))
11951198
#else
11961199
#define KMP_DEFAULT_STKSIZE ((size_t)(1024 * 1024))
11971200
#endif
@@ -1354,6 +1357,10 @@ extern kmp_uint64 __kmp_now_nsec();
13541357
/* TODO: tune for KMP_OS_WASI */
13551358
#define KMP_INIT_WAIT 1024U /* initial number of spin-tests */
13561359
#define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */
1360+
#elif KMP_OS_AIX
1361+
/* TODO: tune for KMP_OS_AIX */
1362+
#define KMP_INIT_WAIT 1024U /* initial number of spin-tests */
1363+
#define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */
13571364
#endif
13581365

13591366
#if KMP_ARCH_X86 || KMP_ARCH_X86_64

openmp/runtime/src/kmp_config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
#define ENABLE_LIBOMPTARGET OPENMP_ENABLE_LIBOMPTARGET
101101

102102
// Configured cache line based on architecture
103-
#if KMP_ARCH_PPC64
103+
#if KMP_ARCH_PPC64 || KMP_ARCH_PPC
104104
# define CACHE_LINE 128
105105
#elif KMP_ARCH_AARCH64_A64FX
106106
# define CACHE_LINE 256

openmp/runtime/src/kmp_ftn_entry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_THREAD_NUM)(void) {
582582
int gtid;
583583

584584
#if KMP_OS_DARWIN || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
585-
KMP_OS_OPENBSD || KMP_OS_HURD || KMP_OS_SOLARIS
585+
KMP_OS_OPENBSD || KMP_OS_HURD || KMP_OS_SOLARIS || KMP_OS_AIX
586586
gtid = __kmp_entry_gtid();
587587
#elif KMP_OS_WINDOWS
588588
if (!__kmp_init_parallel ||

openmp/runtime/src/kmp_global.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int __kmp_ncores = 0;
172172
int __kmp_chunk = 0;
173173
int __kmp_force_monotonic = 0;
174174
int __kmp_abort_delay = 0;
175-
#if KMP_OS_LINUX && defined(KMP_TDATA_GTID)
175+
#if (KMP_OS_LINUX || KMP_OS_AIX) && defined(KMP_TDATA_GTID)
176176
int __kmp_gtid_mode = 3; /* use __declspec(thread) TLS to store gtid */
177177
int __kmp_adjust_gtid_mode = FALSE;
178178
#elif KMP_OS_WINDOWS

openmp/runtime/src/kmp_gsupport.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_ORDERED_END)(void) {
357357
// They come in two flavors: 64-bit unsigned, and either 32-bit signed
358358
// (IA-32 architecture) or 64-bit signed (Intel(R) 64).
359359

360-
#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_WASM
360+
#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_WASM || \
361+
KMP_ARCH_PPC
361362
#define KMP_DISPATCH_INIT __kmp_aux_dispatch_init_4
362363
#define KMP_DISPATCH_FINI_CHUNK __kmp_aux_dispatch_fini_chunk_4
363364
#define KMP_DISPATCH_NEXT __kmpc_dispatch_next_4

openmp/runtime/src/kmp_os.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ typedef unsigned long long kmp_uint64;
176176
#define KMP_UINT64_SPEC "llu"
177177
#endif /* KMP_OS_UNIX */
178178

179-
#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_WASM
179+
#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_WASM || \
180+
KMP_ARCH_PPC
180181
#define KMP_SIZE_T_SPEC KMP_UINT32_SPEC
181182
#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \
182183
KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || \
@@ -186,7 +187,7 @@ typedef unsigned long long kmp_uint64;
186187
#error "Can't determine size_t printf format specifier."
187188
#endif
188189

189-
#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_WASM
190+
#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_WASM || KMP_ARCH_PPC
190191
#define KMP_SIZE_T_MAX (0xFFFFFFFF)
191192
#else
192193
#define KMP_SIZE_T_MAX (0xFFFFFFFFFFFFFFFF)
@@ -1046,7 +1047,7 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v);
10461047

10471048
#if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || \
10481049
KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || \
1049-
KMP_ARCH_VE || KMP_ARCH_S390X
1050+
KMP_ARCH_VE || KMP_ARCH_S390X || KMP_ARCH_PPC
10501051
#if KMP_OS_WINDOWS
10511052
#undef KMP_MB
10521053
#define KMP_MB() std::atomic_thread_fence(std::memory_order_seq_cst)
@@ -1146,7 +1147,7 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v);
11461147
KMP_COMPARE_AND_STORE_REL64((volatile kmp_int64 *)(volatile void *)&(a), \
11471148
(kmp_int64)(b), (kmp_int64)(c))
11481149

1149-
#if KMP_ARCH_X86 || KMP_ARCH_MIPS || KMP_ARCH_WASM
1150+
#if KMP_ARCH_X86 || KMP_ARCH_MIPS || KMP_ARCH_WASM || KMP_ARCH_PPC
11501151
// What about ARM?
11511152
#define TCR_PTR(a) ((void *)TCR_4(a))
11521153
#define TCW_PTR(a, b) TCW_4((a), (b))

openmp/runtime/src/kmp_platform.h

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,20 @@
8282
#define KMP_OS_WASI 1
8383
#endif
8484

85+
#if (defined _AIX)
86+
#undef KMP_OS_AIX
87+
#define KMP_OS_AIX 1
88+
#endif
89+
8590
#if (1 != KMP_OS_LINUX + KMP_OS_DRAGONFLY + KMP_OS_FREEBSD + KMP_OS_NETBSD + \
8691
KMP_OS_OPENBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS + KMP_OS_HURD + \
87-
KMP_OS_SOLARIS + KMP_OS_WASI)
92+
KMP_OS_SOLARIS + KMP_OS_WASI + KMP_OS_AIX)
8893
#error Unknown OS
8994
#endif
9095

9196
#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
9297
KMP_OS_OPENBSD || KMP_OS_DARWIN || KMP_OS_HURD || KMP_OS_SOLARIS || \
93-
KMP_OS_WASI
98+
KMP_OS_WASI || KMP_OS_AIX
9499
#undef KMP_OS_UNIX
95100
#define KMP_OS_UNIX 1
96101
#endif
@@ -102,7 +107,8 @@
102107
#define KMP_ARCH_AARCH64 0
103108
#define KMP_ARCH_PPC64_ELFv1 0
104109
#define KMP_ARCH_PPC64_ELFv2 0
105-
#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_ELFv2 || KMP_ARCH_PPC64_ELFv1)
110+
#define KMP_ARCH_PPC64_XCOFF 0
111+
#define KMP_ARCH_PPC_XCOFF 0
106112
#define KMP_ARCH_MIPS 0
107113
#define KMP_ARCH_MIPS64 0
108114
#define KMP_ARCH_RISCV64 0
@@ -134,13 +140,23 @@
134140
#undef KMP_ARCH_X86
135141
#define KMP_ARCH_X86 1
136142
#elif defined __powerpc64__
137-
#if defined(_CALL_ELF) && _CALL_ELF == 2
143+
#if defined(_CALL_ELF)
144+
#if _CALL_ELF == 2
138145
#undef KMP_ARCH_PPC64_ELFv2
139146
#define KMP_ARCH_PPC64_ELFv2 1
140147
#else
141148
#undef KMP_ARCH_PPC64_ELFv1
142149
#define KMP_ARCH_PPC64_ELFv1 1
143150
#endif
151+
#elif defined KMP_OS_AIX
152+
#undef KMP_ARCH_PPC64_XCOFF
153+
#define KMP_ARCH_PPC64_XCOFF 1
154+
#endif
155+
#elif defined(__powerpc__) && defined(KMP_OS_AIX)
156+
#undef KMP_ARCH_PPC_XCOFF
157+
#define KMP_ARCH_PPC_XCOFF 1
158+
#undef KMP_ARCH_PPC
159+
#define KMP_ARCH_PPC 1
144160
#elif defined __aarch64__
145161
#undef KMP_ARCH_AARCH64
146162
#define KMP_ARCH_AARCH64 1
@@ -207,6 +223,9 @@
207223
#define KMP_ARCH_WASM 1
208224
#endif
209225

226+
#define KMP_ARCH_PPC64 \
227+
(KMP_ARCH_PPC64_ELFv2 || KMP_ARCH_PPC64_ELFv1 || KMP_ARCH_PPC64_XCOFF)
228+
210229
#if defined(__MIC__) || defined(__MIC2__)
211230
#define KMP_MIC 1
212231
#if __MIC2__ || __KNC__
@@ -224,7 +243,8 @@
224243

225244
/* Specify 32 bit architectures here */
226245
#define KMP_32_BIT_ARCH \
227-
(KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_WASM)
246+
(KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_WASM || \
247+
KMP_ARCH_PPC)
228248

229249
// Platforms which support Intel(R) Many Integrated Core Architecture
230250
#define KMP_MIC_SUPPORTED \
@@ -234,7 +254,7 @@
234254
#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + \
235255
KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64 + \
236256
KMP_ARCH_RISCV64 + KMP_ARCH_LOONGARCH64 + KMP_ARCH_VE + \
237-
KMP_ARCH_S390X + KMP_ARCH_WASM)
257+
KMP_ARCH_S390X + KMP_ARCH_WASM + KMP_ARCH_PPC)
238258
#error Unknown or unsupported architecture
239259
#endif
240260

openmp/runtime/src/kmp_runtime.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8901,7 +8901,7 @@ __kmp_determine_reduction_method(
89018901

89028902
#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
89038903
KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD || \
8904-
KMP_OS_SOLARIS || KMP_OS_WASI
8904+
KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
89058905

89068906
int teamsize_cutoff = 4;
89078907

@@ -8926,14 +8926,14 @@ __kmp_determine_reduction_method(
89268926
#error "Unknown or unsupported OS"
89278927
#endif // KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD ||
89288928
// KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD ||
8929-
// KMP_OS_SOLARIS || KMP_OS_WASI
8929+
// KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
89308930

89318931
#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS || \
8932-
KMP_ARCH_WASM
8932+
KMP_ARCH_WASM || KMP_ARCH_PPC
89338933

89348934
#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
89358935
KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_HURD || KMP_OS_SOLARIS || \
8936-
KMP_OS_WASI
8936+
KMP_OS_WASI || KMP_OS_AIX
89378937

89388938
// basic tuning
89398939

openmp/runtime/src/kmp_settings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6171,9 +6171,9 @@ void __kmp_env_initialize(char const *string) {
61716171
// specifier, even as substrings.
61726172
//
61736173
// I can't find a case-insensitive version of strstr on Windows* OS.
6174-
// Use the case-sensitive version for now.
6174+
// Use the case-sensitive version for now. AIX does the same.
61756175

6176-
#if KMP_OS_WINDOWS
6176+
#if KMP_OS_WINDOWS || KMP_OS_AIX
61776177
#define FIND strstr
61786178
#else
61796179
#define FIND strcasestr

openmp/runtime/src/kmp_wrapper_getpid.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
// On Unix-like systems (Linux* OS and OS X*) getpid() is declared in standard
1919
// headers.
20+
#if !defined(KMP_OS_AIX)
2021
#include <sys/syscall.h>
22+
#endif
2123
#include <sys/types.h>
2224
#include <unistd.h>
2325
#if KMP_OS_DARWIN
@@ -31,6 +33,9 @@
3133
#define __kmp_gettid() _lwp_self()
3234
#elif KMP_OS_OPENBSD
3335
#define __kmp_gettid() getthrid()
36+
#elif KMP_OS_AIX
37+
#include <pthread.h>
38+
#define __kmp_gettid() pthread_self()
3439
#elif defined(SYS_gettid)
3540
// Hopefully other Unix systems define SYS_gettid syscall for getting os thread
3641
// id

0 commit comments

Comments
 (0)