Skip to content

Commit 1234011

Browse files
committed
[OpenMP][libomp] Introduce oneAPI compiler support
Introduce KMP_COMPILER_ICX macro to represent compilation with oneAPI compiler. Fixup flag detection and compiler ID detection in CMake. Older CMake's detect IntelLLVM as Clang. Fix compiler warnings. Fixup many of the tests to have non-empty parallel regions as they are elided by oneAPI compiler.
1 parent aabf6e6 commit 1234011

35 files changed

+210
-135
lines changed

openmp/cmake/DetectTestCompiler/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function(write_compiler_information lang)
1010
set(information "${information}\\;${CMAKE_${lang}_COMPILER_VERSION}")
1111
set(information "${information}\\;${${lang}_FLAGS}")
1212
set(information "${information}\\;${${lang}_HAS_TSAN_FLAG}")
13+
set(information "${information}\\;${${lang}_HAS_OMIT_FRAME_POINTER}")
1314
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${lang}CompilerInformation.txt ${information})
1415
endfunction(write_compiler_information)
1516

@@ -40,6 +41,9 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
4041
add_experimental_isel_flag(CXX)
4142
endif()
4243

44+
check_c_compiler_flag("-fno-omit-frame-pointer" C_HAS_OMIT_FRAME_POINTER)
45+
check_cxx_compiler_flag("-fno-omit-frame-pointer" CXX_HAS_OMIT_FRAME_POINTER)
46+
4347
SET(CMAKE_REQUIRED_FLAGS "-fsanitize=thread")
4448
check_c_compiler_flag("" C_HAS_TSAN_FLAG)
4549
check_cxx_compiler_flag("" CXX_HAS_TSAN_FLAG)

openmp/cmake/OpenMPTesting.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ macro(extract_test_compiler_information lang file)
7676
list(GET information 2 version)
7777
list(GET information 3 openmp_flags)
7878
list(GET information 4 has_tsan_flags)
79+
list(GET information 5 has_omit_frame_pointer_flags)
7980

8081
set(OPENMP_TEST_${lang}_COMPILER_PATH ${path})
8182
set(OPENMP_TEST_${lang}_COMPILER_ID ${id})
8283
set(OPENMP_TEST_${lang}_COMPILER_VERSION ${version})
8384
set(OPENMP_TEST_${lang}_COMPILER_OPENMP_FLAGS ${openmp_flags})
8485
set(OPENMP_TEST_${lang}_COMPILER_HAS_TSAN_FLAGS ${has_tsan_flags})
86+
set(OPENMP_TEST_${lang}_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS ${has_omit_frame_pointer_flags})
8587
endmacro()
8688

8789
# Function to set variables with information about the test compiler.
@@ -98,6 +100,7 @@ function(set_test_compiler_information dir)
98100
set(OPENMP_TEST_COMPILER_VERSION "${OPENMP_TEST_C_COMPILER_VERSION}" PARENT_SCOPE)
99101
set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "${OPENMP_TEST_C_COMPILER_OPENMP_FLAGS}" PARENT_SCOPE)
100102
set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS "${OPENMP_TEST_C_COMPILER_HAS_TSAN_FLAGS}" PARENT_SCOPE)
103+
set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS "${OPENMP_TEST_C_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS}" PARENT_SCOPE)
101104

102105
# Determine major version.
103106
string(REGEX MATCH "[0-9]+" major "${OPENMP_TEST_C_COMPILER_VERSION}")
@@ -149,6 +152,7 @@ else()
149152
endif()
150153
# TODO: Implement blockaddress in GlobalISel and remove this flag!
151154
set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp ${OPENMP_TEST_COMPILER_THREAD_FLAGS} -fno-experimental-isel")
155+
set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1)
152156
endif()
153157

154158
# Function to set compiler features for use in lit.

openmp/cmake/config-ix.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
include(CheckCXXCompilerFlag)
2+
include(CheckCXXSourceCompiles)
3+
4+
# Check for oneAPI compiler (some older CMake versions detect as Clang)
5+
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
6+
check_cxx_source_compiles("#if (defined(__INTEL_CLANG_COMPILER) || defined(__INTEL_LLVM_COMPILER))
7+
int main() { return 0; }
8+
#else
9+
not oneAPI
10+
#endif" OPENMP_HAVE_ONEAPI_COMPILER)
11+
if (OPENMP_HAVE_ONEAPI_COMPILER)
12+
# According to CMake documentation, the compiler id should
13+
# be IntelLLVM when detected oneAPI
14+
set(CMAKE_C_COMPILER_ID "IntelLLVM")
15+
set(CMAKE_CXX_COMPILER_ID "IntelLLVM")
16+
endif()
17+
endif()
218

319
check_cxx_compiler_flag(-Wall OPENMP_HAVE_WALL_FLAG)
420
check_cxx_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)

openmp/runtime/cmake/LibompCheckLinkerFlag.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function(libomp_check_linker_flag flag boolean)
2525
add_library(foo SHARED src_to_link.c)")
2626
# Compiling as a part of runtimes introduces ARCH-unknown-linux-gnu as a part
2727
# of a working directory. So adding a guard for unknown.
28-
set(failed_regexes "[Ee]rror;[Uu]nknown[^-];[Ss]kipping;LINK : warning")
28+
set(failed_regexes "[Ee]rror;[Uu]nknown[^-];[Ss]kipping;LINK : warning;Unsupported command line")
2929
set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/link_flag_check_${boolean})
3030
file(MAKE_DIRECTORY ${base_dir})
3131
file(MAKE_DIRECTORY ${base_dir}/build)

openmp/runtime/cmake/config-ix.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ elseif(NOT APPLE)
139139
endif()
140140

141141
# Check Intel(R) C Compiler specific flags
142-
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
142+
if(CMAKE_C_COMPILER_ID STREQUAL "Intel" OR CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
143143
check_cxx_compiler_flag(/Qlong_double LIBOMP_HAVE_LONG_DOUBLE_FLAG)
144144
check_cxx_compiler_flag(/Qdiag-disable:177 LIBOMP_HAVE_DIAG_DISABLE_177_FLAG)
145145
check_cxx_compiler_flag(/Qinline-min-size=1 LIBOMP_HAVE_INLINE_MIN_SIZE_FLAG)
@@ -247,7 +247,7 @@ libomp_check_version_symbols(LIBOMP_HAVE_VERSION_SYMBOLS)
247247
# Check if quad precision types are available
248248
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
249249
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
250-
elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel")
250+
elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel" OR CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
251251
if(LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
252252
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
253253
else()

openmp/runtime/src/kmp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ extern void __kmp_init_target_mem();
11241124
#if KMP_OS_UNIX && (KMP_ARCH_X86 || KMP_ARCH_X86_64)
11251125
// HW TSC is used to reduce overhead (clock tick instead of nanosecond).
11261126
extern kmp_uint64 __kmp_ticks_per_msec;
1127-
#if KMP_COMPILER_ICC
1127+
#if KMP_COMPILER_ICC || KMP_COMPILER_ICX
11281128
#define KMP_NOW() ((kmp_uint64)_rdtsc())
11291129
#else
11301130
#define KMP_NOW() __kmp_hardware_timestamp()

openmp/runtime/src/kmp_affinity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ static bool __kmp_affinity_create_hwloc_map(kmp_i18n_id_t *const msg_id) {
17651765

17661766
hw_thread_index = 0;
17671767
pu = NULL;
1768-
while (pu = hwloc_get_next_obj_by_type(tp, HWLOC_OBJ_PU, pu)) {
1768+
while ((pu = hwloc_get_next_obj_by_type(tp, HWLOC_OBJ_PU, pu))) {
17691769
int index = depth - 1;
17701770
bool included = KMP_CPU_ISSET(pu->os_index, __kmp_affin_fullMask);
17711771
kmp_hw_thread_t &hw_thread = __kmp_topology->at(hw_thread_index);

openmp/runtime/src/kmp_atomic.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,6 +2452,7 @@ ATOMIC_CMPXCHG_CPT(float8, mul_cpt, kmp_real64, 64, *,
24522452
RTYPE, LCK_ID, MASK, GOMP_FLAG) \
24532453
ATOMIC_BEGIN_CPT_MIX(TYPE_ID, OP_ID, TYPE, RTYPE_ID, RTYPE) \
24542454
TYPE new_value; \
2455+
(void)new_value; \
24552456
OP_GOMP_CRITICAL_CPT(TYPE, OP, GOMP_FLAG) \
24562457
OP_CMPXCHG_CPT(TYPE, BITS, OP) \
24572458
}
@@ -2461,6 +2462,7 @@ ATOMIC_CMPXCHG_CPT(float8, mul_cpt, kmp_real64, 64, *,
24612462
LCK_ID, GOMP_FLAG) \
24622463
ATOMIC_BEGIN_CPT_MIX(TYPE_ID, OP_ID, TYPE, RTYPE_ID, RTYPE) \
24632464
TYPE new_value; \
2465+
(void)new_value; \
24642466
OP_GOMP_CRITICAL_CPT(TYPE, OP, GOMP_FLAG) /* send assignment */ \
24652467
OP_UPDATE_CRITICAL_CPT(TYPE, OP, LCK_ID) /* send assignment */ \
24662468
}
@@ -3162,6 +3164,7 @@ ATOMIC_CRITICAL_CPT_REV(cmplx16, div_a16_cpt_rev, kmp_cmplx128_a16_t, /, 32c,
31623164
RTYPE, LCK_ID, MASK, GOMP_FLAG) \
31633165
ATOMIC_BEGIN_CPT_MIX(TYPE_ID, OP_ID, TYPE, RTYPE_ID, RTYPE) \
31643166
TYPE new_value; \
3167+
(void)new_value; \
31653168
OP_GOMP_CRITICAL_CPT_REV(TYPE, OP, GOMP_FLAG) \
31663169
OP_CMPXCHG_CPT_REV(TYPE, BITS, OP) \
31673170
}
@@ -3171,6 +3174,7 @@ ATOMIC_CRITICAL_CPT_REV(cmplx16, div_a16_cpt_rev, kmp_cmplx128_a16_t, /, 32c,
31713174
LCK_ID, GOMP_FLAG) \
31723175
ATOMIC_BEGIN_CPT_MIX(TYPE_ID, OP_ID, TYPE, RTYPE_ID, RTYPE) \
31733176
TYPE new_value; \
3177+
(void)new_value; \
31743178
OP_GOMP_CRITICAL_CPT_REV(TYPE, OP, GOMP_FLAG) /* send assignment */ \
31753179
OP_CRITICAL_CPT_REV(TYPE, OP, LCK_ID) /* send assignment */ \
31763180
}

openmp/runtime/src/kmp_atomic.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ struct KMP_DO_ALIGN(4) kmp_cmplx128_a4_t {
251251

252252
kmp_cmplx128_a4_t() : q() {}
253253

254+
#if defined(__cplusplus) && (KMP_OS_WINDOWS)
255+
kmp_cmplx128_a4_t(const std::complex<_Quad> &c128) : q(c128) {}
256+
#endif
254257
kmp_cmplx128_a4_t(const kmp_cmplx128 &c128) : q(c128) {}
255258

256259
kmp_cmplx128_a4_t operator+(const kmp_cmplx128_a4_t &b) {
@@ -314,6 +317,9 @@ struct KMP_DO_ALIGN(16) kmp_cmplx128_a16_t {
314317

315318
kmp_cmplx128_a16_t() : q() {}
316319

320+
#if defined(__cplusplus) && (KMP_OS_WINDOWS)
321+
kmp_cmplx128_a16_t(const std::complex<_Quad> &c128) : q(c128) {}
322+
#endif
317323
kmp_cmplx128_a16_t(const kmp_cmplx128 &c128) : q(c128) {}
318324

319325
kmp_cmplx128_a16_t operator+(const kmp_cmplx128_a16_t &b) {

openmp/runtime/src/kmp_barrier.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,7 +2163,6 @@ void __kmp_join_barrier(int gtid) {
21632163

21642164
kmp_info_t *this_thr = __kmp_threads[gtid];
21652165
kmp_team_t *team;
2166-
kmp_uint nproc;
21672166
int tid;
21682167
#ifdef KMP_DEBUG
21692168
int team_id;
@@ -2176,12 +2175,14 @@ void __kmp_join_barrier(int gtid) {
21762175
itt_sync_obj = __kmp_itt_barrier_object(gtid, bs_forkjoin_barrier);
21772176
#endif
21782177
#endif /* USE_ITT_BUILD */
2178+
#if ((USE_ITT_BUILD && USE_ITT_NOTIFY) || defined KMP_DEBUG)
2179+
int nproc = this_thr->th.th_team_nproc;
2180+
#endif
21792181
KMP_MB();
21802182

21812183
// Get current info
21822184
team = this_thr->th.th_team;
2183-
nproc = this_thr->th.th_team_nproc;
2184-
KMP_DEBUG_ASSERT((int)nproc == team->t.t_nproc);
2185+
KMP_DEBUG_ASSERT(nproc == team->t.t_nproc);
21852186
tid = __kmp_tid_from_gtid(gtid);
21862187
#ifdef KMP_DEBUG
21872188
team_id = team->t.t_id;
@@ -2354,7 +2355,7 @@ void __kmp_join_barrier(int gtid) {
23542355
// Set arrive time to zero to be able to check it in
23552356
// __kmp_invoke_task(); the same is done inside the loop below
23562357
this_thr->th.th_bar_arrive_time = 0;
2357-
for (kmp_uint i = 1; i < nproc; ++i) {
2358+
for (int i = 1; i < nproc; ++i) {
23582359
delta += (cur_time - other_threads[i]->th.th_bar_arrive_time);
23592360
other_threads[i]->th.th_bar_arrive_time = 0;
23602361
}

openmp/runtime/src/kmp_csupport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,13 +685,13 @@ void __kmpc_flush(ident_t *loc) {
685685
if (!__kmp_cpuinfo.flags.sse2) {
686686
// CPU cannot execute SSE2 instructions.
687687
} else {
688-
#if KMP_COMPILER_ICC
688+
#if KMP_COMPILER_ICC || KMP_COMPILER_ICX
689689
_mm_mfence();
690690
#elif KMP_COMPILER_MSVC
691691
MemoryBarrier();
692692
#else
693693
__sync_synchronize();
694-
#endif // KMP_COMPILER_ICC
694+
#endif // KMP_COMPILER_ICC || KMP_COMPILER_ICX
695695
}
696696
#endif // KMP_MIC
697697
#elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64 || \

openmp/runtime/src/kmp_debugger.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,16 @@ kmp_omp_struct_info_t __kmp_omp_debug_struct_info = {
226226
when 64-bit value is assigned to 32-bit pointer. Use this function
227227
to suppress the warning. */
228228
static inline void *__kmp_convert_to_ptr(kmp_uint64 addr) {
229-
#if KMP_COMPILER_ICC
229+
#if KMP_COMPILER_ICC || KMP_COMPILER_ICX
230230
#pragma warning(push)
231231
#pragma warning(disable : 810) // conversion from "unsigned long long" to "char
232232
// *" may lose significant bits
233233
#pragma warning(disable : 1195) // conversion from integer to smaller pointer
234-
#endif // KMP_COMPILER_ICC
234+
#endif // KMP_COMPILER_ICC || KMP_COMPILER_ICX
235235
return (void *)addr;
236-
#if KMP_COMPILER_ICC
236+
#if KMP_COMPILER_ICC || KMP_COMPILER_ICX
237237
#pragma warning(pop)
238-
#endif // KMP_COMPILER_ICC
238+
#endif // KMP_COMPILER_ICC || KMP_COMPILER_ICX
239239
} // __kmp_convert_to_ptr
240240

241241
static int kmp_location_match(kmp_str_loc_t *loc, kmp_omp_nthr_item_t *item) {

openmp/runtime/src/kmp_lock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,7 @@ static inline bool __kmp_is_unlocked_queuing_lock(kmp_queuing_lock_t *lck) {
19541954

19551955
// We need a fence here, since we must ensure that no memory operations
19561956
// from later in this thread float above that read.
1957-
#if KMP_COMPILER_ICC
1957+
#if KMP_COMPILER_ICC || KMP_COMPILER_ICX
19581958
_mm_mfence();
19591959
#else
19601960
__sync_synchronize();

openmp/runtime/src/kmp_os.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@
5353
#define KMP_COMPILER_GCC 0
5454
#define KMP_COMPILER_CLANG 0
5555
#define KMP_COMPILER_MSVC 0
56+
#define KMP_COMPILER_ICX 0
5657

57-
#if defined(__INTEL_COMPILER)
58+
#if __INTEL_CLANG_COMPILER
59+
#undef KMP_COMPILER_ICX
60+
#define KMP_COMPILER_ICX 1
61+
#elif defined(__INTEL_COMPILER)
5862
#undef KMP_COMPILER_ICC
5963
#define KMP_COMPILER_ICC 1
6064
#elif defined(__clang__)
@@ -85,7 +89,7 @@
8589
/* Check for quad-precision extension. */
8690
#define KMP_HAVE_QUAD 0
8791
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
88-
#if KMP_COMPILER_ICC
92+
#if KMP_COMPILER_ICC || KMP_COMPILER_ICX
8993
/* _Quad is already defined for icc */
9094
#undef KMP_HAVE_QUAD
9195
#define KMP_HAVE_QUAD 1
@@ -448,8 +452,10 @@ enum kmp_mem_fence_type {
448452
#pragma intrinsic(InterlockedExchangeAdd)
449453
#pragma intrinsic(InterlockedCompareExchange)
450454
#pragma intrinsic(InterlockedExchange)
455+
#if !(KMP_COMPILER_ICX && KMP_32_BIT_ARCH)
451456
#pragma intrinsic(InterlockedExchange64)
452457
#endif
458+
#endif
453459

454460
// Using InterlockedIncrement / InterlockedDecrement causes a library loading
455461
// ordering problem, so we use InterlockedExchangeAdd instead.
@@ -842,8 +848,14 @@ static inline bool mips_sync_val_compare_and_swap(volatile kmp_uint64 *p,
842848
(kmp_uint64)(sv))
843849
#endif
844850

851+
#if KMP_OS_DARWIN && defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1800
852+
#define KMP_XCHG_FIXED8(p, v) \
853+
__atomic_exchange_1((volatile kmp_uint8 *)(p), (kmp_uint8)(v), \
854+
__ATOMIC_SEQ_CST)
855+
#else
845856
#define KMP_XCHG_FIXED8(p, v) \
846857
__sync_lock_test_and_set((volatile kmp_uint8 *)(p), (kmp_uint8)(v))
858+
#endif
847859
#define KMP_XCHG_FIXED16(p, v) \
848860
__sync_lock_test_and_set((volatile kmp_uint16 *)(p), (kmp_uint16)(v))
849861
#define KMP_XCHG_FIXED32(p, v) \
@@ -1026,7 +1038,7 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v);
10261038
#endif
10271039

10281040
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1029-
#if KMP_COMPILER_ICC
1041+
#if KMP_COMPILER_ICC || KMP_COMPILER_ICX
10301042
#define KMP_MFENCE_() _mm_mfence()
10311043
#define KMP_SFENCE_() _mm_sfence()
10321044
#elif KMP_COMPILER_MSVC

openmp/runtime/src/kmp_runtime.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8953,19 +8953,16 @@ void __kmp_resize_dist_barrier(kmp_team_t *team, int old_nthreads,
89538953
KMP_DEBUG_ASSERT(team->t.t_threads[f]->th.th_used_in_team.load() == 2);
89548954
}
89558955
// Release all the workers
8956-
kmp_uint64 new_value; // new value for go
8957-
new_value = team->t.b->go_release();
8956+
team->t.b->go_release();
89588957

89598958
KMP_MFENCE();
89608959

89618960
// Workers should see transition status 2 and move to 0; but may need to be
89628961
// woken up first
8963-
size_t my_go_index;
89648962
int count = old_nthreads - 1;
89658963
while (count > 0) {
89668964
count = old_nthreads - 1;
89678965
for (int f = 1; f < old_nthreads; ++f) {
8968-
my_go_index = f / team->t.b->threads_per_go;
89698966
if (other_threads[f]->th.th_used_in_team.load() != 0) {
89708967
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME) { // Wake up the workers
89718968
kmp_atomic_flag_64<> *flag = (kmp_atomic_flag_64<> *)CCAST(

openmp/runtime/src/kmp_stub.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ void *kmp_malloc(size_t size) {
159159
}
160160
void *kmp_aligned_malloc(size_t sz, size_t a) {
161161
i;
162-
int err;
163162
void *res;
164163
#if KMP_OS_WINDOWS
165164
res = _aligned_malloc(sz, a);
166165
#else
166+
int err;
167167
if ((err = posix_memalign(&res, a, sz))) {
168168
errno = err; // can be EINVAL or ENOMEM
169169
res = NULL;
@@ -393,12 +393,12 @@ void *omp_alloc(size_t size, omp_allocator_handle_t allocator) {
393393

394394
void *omp_aligned_alloc(size_t a, size_t size, omp_allocator_handle_t al) {
395395
i;
396-
int err;
397396
void *res;
398397
#if KMP_OS_WINDOWS
399398
res = _aligned_malloc(size, a);
400399
#else
401-
if (err = posix_memalign(&res, a, size)) {
400+
int err;
401+
if ((err = posix_memalign(&res, a, size))) {
402402
errno = err; // can be EINVAL or ENOMEM
403403
res = NULL;
404404
}
@@ -420,12 +420,12 @@ void *omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t al) {
420420
void *omp_aligned_calloc(size_t a, size_t nmemb, size_t size,
421421
omp_allocator_handle_t al) {
422422
i;
423-
int err;
424423
void *res;
425424
#if KMP_OS_WINDOWS
426425
res = _aligned_recalloc(NULL, nmemb, size, a);
427426
#else
428-
if (err = posix_memalign(&res, a, nmemb * size)) {
427+
int err;
428+
if ((err = posix_memalign(&res, a, nmemb * size))) {
429429
errno = err; // can be EINVAL or ENOMEM
430430
res = NULL;
431431
}

openmp/runtime/src/kmp_version.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#define stringer(x) _stringer(x)
2323

2424
// Detect compiler.
25-
#if KMP_COMPILER_ICC
25+
#if KMP_COMPILER_ICX
26+
#define KMP_COMPILER __VERSION__
27+
#elif KMP_COMPILER_ICC
2628
#if __INTEL_COMPILER == 1010
2729
#define KMP_COMPILER "Intel(R) C++ Compiler 10.1"
2830
#elif __INTEL_COMPILER == 1100
@@ -53,8 +55,10 @@
5355
#define KMP_COMPILER "Intel(R) C++ Compiler 19.0"
5456
#elif __INTEL_COMPILER == 1910
5557
#define KMP_COMPILER "Intel(R) C++ Compiler 19.1"
56-
#elif __INTEL_COMPILER >= 9900
57-
#define KMP_COMPILER "Intel(R) C++ Compiler mainline"
58+
#elif __INTEL_COMPILER > 1910
59+
#define KMP_COMPILER \
60+
"Intel(R) C++ Compiler Classic " stringer(__INTEL_COMPILER) "." stringer( \
61+
__INTEL_COMPILER_UPDATE)
5862
#endif
5963
#elif KMP_COMPILER_CLANG
6064
#define KMP_COMPILER \

0 commit comments

Comments
 (0)