Skip to content

Commit c5e54ea

Browse files
authored
Update OpenMP from LLVM 1823581ecb to 22.1.8 (emscripten-core#27437)
This updates (?) OpenMP from 1823581ecb to LLVM 22.1.8: https://github.com/llvm/llvm-project/releases/tag/llvmorg-22.1.8 Because emscripten-core#27073 added OpenMP from then-LLVM-tot 1823581ecb, this is effectively not updating but downgrading to make this in sync with our other LLVM libraries. All `./test/runner *.test_openmp_max_threads` pass, except for `strict.test_openmp_max_threads`, which also fails in the main branch. Additional changes: - Apply the fix from emscripten-core#27289: emscripten-core@8f254a0 - Remove `kmp_invoke_microtask.cpp` from build: emscripten-core@b104d06 This file was added in llvm/llvm-project#176151 and didn't exist in LLVM 22.1.8 release.
1 parent 1ab2950 commit c5e54ea

41 files changed

Lines changed: 375 additions & 981 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ See docs/process.md for more on how version tagging works.
2626
- Revert #27397, which changed the way config keys such as NODE_JS were parsed
2727
when reading the config file. This change broke emsdk installations that
2828
contained spaces. (#27421)
29+
- OpenMP was updated to LLVM 22.1.8 (#27437)
2930

3031
6.0.4 - 07/24/26
3132
----------------

system/lib/openmp/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
llvm's OpenMP
22
-------------
33

4-
Note: This version of openmp is actually based on 1823581ecb but
5-
we are in the process of updating it.
6-
7-
These files are from the llvm-project based on release 21.1.8.
4+
These files are from the llvm-project based on release 22.1.8.
85

96
We maintain a local fork of llvm-project that contains any Emscripten
107
specific patches:
118

129
https://github.com/emscripten-core/llvm-project
1310

14-
The current patch is based on the emscripten-libs-21 branch.
11+
The current patch is based on the emscripten-libs-22 branch.
1512

1613
Update Instructions
1714
-------------------
@@ -23,4 +20,4 @@ Modifications
2320

2421
For a list of changes from upstream see the OpenMP files that are part of:
2522

26-
https://github.com/llvm/llvm-project/compare/llvmorg-21.1.8...emscripten-core:emscripten-libs-21
23+
https://github.com/llvm/llvm-project/compare/llvmorg-22.1.8...emscripten-core:emscripten-libs-22

system/lib/openmp/include/omp.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,6 @@
380380
omp_uintptr_t value;
381381
} omp_alloctrait_t;
382382

383-
typedef enum {
384-
omp_access_cgroup = 0,
385-
omp_access_pteam = 1
386-
} omp_access_t;
387-
388383
# if defined(_WIN32)
389384
// On Windows cl and icl do not support 64-bit enum, let's use integer then.
390385
typedef omp_uintptr_t omp_allocator_handle_t;
@@ -408,7 +403,6 @@
408403
extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space;
409404
extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space;
410405
extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space;
411-
extern __KMP_IMP omp_memspace_handle_t const omp_cgroup_mem_space;
412406
extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_host_mem_space;
413407
extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_shared_mem_space;
414408
extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_device_mem_space;
@@ -445,7 +439,6 @@
445439
omp_const_mem_space = 2,
446440
omp_high_bw_mem_space = 3,
447441
omp_low_lat_mem_space = 4,
448-
omp_cgroup_mem_space = 5,
449442
llvm_omp_target_host_mem_space = 100,
450443
llvm_omp_target_shared_mem_space = 101,
451444
llvm_omp_target_device_mem_space = 102,
@@ -470,11 +463,6 @@
470463
omp_allocator_handle_t allocator = omp_null_allocator,
471464
omp_allocator_handle_t free_allocator = omp_null_allocator);
472465
extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator);
473-
extern void *__KAI_KMPC_CONVENTION omp_get_dyn_gprivate_ptr(size_t offset = 0, omp_access_t access_group = omp_access_cgroup);
474-
extern void *__KAI_KMPC_CONVENTION omp_get_dyn_gprivate_nofb_ptr(size_t offset = 0, omp_access_t access_group = omp_access_cgroup);
475-
extern size_t __KAI_KMPC_CONVENTION omp_get_dyn_gprivate_size(omp_access_t access_group = omp_access_cgroup);
476-
extern omp_memspace_handle_t __KAI_KMPC_CONVENTION omp_get_dyn_gprivate_memspace(omp_access_t access_group = omp_access_cgroup);
477-
extern size_t __KAI_KMPC_CONVENTION omp_get_gprivate_limit(int device_num, omp_access_t access_group = omp_access_cgroup);
478466
# else
479467
extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a);
480468
extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size,
@@ -485,11 +473,6 @@
485473
extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, omp_allocator_handle_t allocator,
486474
omp_allocator_handle_t free_allocator);
487475
extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a);
488-
extern void *__KAI_KMPC_CONVENTION omp_get_dyn_gprivate_ptr(size_t offset, omp_access_t access_group);
489-
extern void *__KAI_KMPC_CONVENTION omp_get_dyn_gprivate_nofb_ptr(size_t offset, omp_access_t access_group);
490-
extern size_t __KAI_KMPC_CONVENTION omp_get_dyn_gprivate_size(omp_access_t access_group);
491-
extern omp_memspace_handle_t __KAI_KMPC_CONVENTION omp_get_dyn_gprivate_memspace(omp_access_t access_group);
492-
extern size_t __KAI_KMPC_CONVENTION omp_get_gprivate_limit(int device_num, omp_access_t access_group);
493476
# endif
494477

495478
/* OpenMP TR11 routines to get memory spaces and allocators */
@@ -553,7 +536,6 @@
553536

554537
/* OpenMP 5.2 */
555538
extern int __KAI_KMPC_CONVENTION omp_in_explicit_task(void);
556-
#define omp_initial_device -1
557539
#define omp_invalid_device -2
558540

559541
/* OpenMP 6.0 */

system/lib/openmp/include/ompx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef __OMPX_H
1010
#define __OMPX_H
1111

12-
#if (defined(__NVPTX__) || defined(__AMDGPU__) || defined(__SPIRV__))
12+
#if (defined(__NVPTX__) || defined(__AMDGPU__))
1313
#include <gpuintrin.h>
1414
#define __OMPX_TARGET_IS_GPU
1515
#endif

system/lib/openmp/prebuilt/kmp_config.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#define OMPT_SUPPORT LIBOMP_OMPT_SUPPORT
4747
#define LIBOMP_OMPD_SUPPORT 0
4848
#define OMPD_SUPPORT LIBOMP_OMPD_SUPPORT
49-
#define LIBOMP_TASKGRAPH_EXPERIMENTAL 0
50-
#define OMP_TASKGRAPH_EXPERIMENTAL LIBOMP_TASKGRAPH_EXPERIMENTAL
49+
#define LIBOMP_OMPX_TASKGRAPH 0
50+
#define OMPX_TASKGRAPH LIBOMP_OMPX_TASKGRAPH
5151
#define LIBOMP_PROFILING_SUPPORT 0
5252
#define OMP_PROFILING_SUPPORT LIBOMP_PROFILING_SUPPORT
5353
#define LIBOMP_OMPT_OPTIONAL 1
@@ -96,8 +96,6 @@
9696
#define KMP_HAVE_POSIX_MEMALIGN LIBOMP_HAVE_POSIX_MEMALIGN
9797
#define LIBOMP_HAVE__ALIGNED_MALLOC 0
9898
#define KMP_HAVE__ALIGNED_MALLOC LIBOMP_HAVE__ALIGNED_MALLOC
99-
#define LIBOMP_USE_CANCEL_THREADS 1
100-
#define KMP_CANCEL_THREADS LIBOMP_USE_CANCEL_THREADS
10199
#define OPENMP_ENABLE_LIBOMPTARGET 0
102100
#define ENABLE_LIBOMPTARGET OPENMP_ENABLE_LIBOMPTARGET
103101

system/lib/openmp/prebuilt/kmp_i18n_default.inc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ __kmp_i18n_default_messages[] =
417417
"Target memory not available, will use default allocator.",
418418
"%1$s ignored: This machine is not a hybrid architecutre. Using \"%2$s\" instead.",
419419
"%1$s ignored: %2$s is not available. Using \"%3$s\" instead.",
420-
"%1$s() called inside a parallel or teams region; call ignored.",
421-
"%1$s() called inside a parallel or teams region; call ignored.",
422420
NULL
423421
};
424422

@@ -471,7 +469,7 @@ __kmp_i18n_sections[] =
471469
{ 5, __kmp_i18n_default_meta },
472470
{ 79, __kmp_i18n_default_strings },
473471
{ 6, __kmp_i18n_default_formats },
474-
{ 303, __kmp_i18n_default_messages },
472+
{ 301, __kmp_i18n_default_messages },
475473
{ 29, __kmp_i18n_default_hints },
476474
{ 0, NULL }
477475
};

system/lib/openmp/prebuilt/kmp_i18n_id.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@ enum kmp_i18n_id {
411411
kmp_i18n_msg_TargetMemNotAvailable,
412412
kmp_i18n_msg_AffIgnoringNonHybrid,
413413
kmp_i18n_msg_AffIgnoringNotAvailable,
414-
kmp_i18n_msg_SetNumTeamsInParOrTeamsRegion,
415-
kmp_i18n_msg_SetTeamsThreadLimitInParOrTeamsRegion,
416414
kmp_i18n_msg_last,
417415

418416
// Set #5, hints.

system/lib/openmp/src/CMakeLists.txt

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ endif()
2222
configure_file(${LIBOMP_INC_DIR}/omp.h.var ${LIBOMP_HEADERS_INTDIR}/omp.h @ONLY)
2323
configure_file(${LIBOMP_INC_DIR}/ompx.h.var ${LIBOMP_HEADERS_INTDIR}/ompx.h @ONLY)
2424
configure_file(kmp_config.h.cmake kmp_config.h @ONLY)
25-
if(LIBOMP_OMPT_SUPPORT)
25+
if(${LIBOMP_OMPT_SUPPORT})
2626
configure_file(${LIBOMP_INC_DIR}/omp-tools.h.var ${LIBOMP_HEADERS_INTDIR}/omp-tools.h @ONLY)
2727
endif()
2828

@@ -81,13 +81,11 @@ if(STUBS_LIBRARY)
8181
else()
8282
# Get C++ files
8383
set(LIBOMP_CXXFILES
84-
kmp_adt.cpp
8584
kmp_alloc.cpp
8685
kmp_atomic.cpp
8786
kmp_csupport.cpp
8887
kmp_debug.cpp
8988
kmp_itt.cpp
90-
kmp_invoke_microtask.cpp
9189
kmp_environment.cpp
9290
kmp_error.cpp
9391
kmp_global.cpp
@@ -111,9 +109,9 @@ else()
111109
# Windows specific files
112110
libomp_append(LIBOMP_CXXFILES z_Windows_NT_util.cpp)
113111
libomp_append(LIBOMP_CXXFILES z_Windows_NT-586_util.cpp)
114-
if(LIBOMP_ARCH STREQUAL "i386" OR LIBOMP_ARCH STREQUAL "x86_64")
112+
if(${LIBOMP_ARCH} STREQUAL "i386" OR ${LIBOMP_ARCH} STREQUAL "x86_64")
115113
libomp_append(LIBOMP_ASMFILES z_Windows_NT-586_asm.asm) # Windows assembly file
116-
elseif((LIBOMP_ARCH STREQUAL "aarch64" OR LIBOMP_ARCH STREQUAL "arm") AND (NOT MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
114+
elseif((${LIBOMP_ARCH} STREQUAL "aarch64" OR ${LIBOMP_ARCH} STREQUAL "arm") AND (NOT MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
117115
# z_Linux_asm.S works for AArch64 and ARM Windows too.
118116
libomp_append(LIBOMP_GNUASMFILES z_Linux_asm.S)
119117
else()
@@ -176,7 +174,7 @@ libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
176174

177175
# Build libomp library. Add LLVMSupport dependency if building in-tree with
178176
# libomptarget profiling enabled.
179-
if(NOT OPENMP_ENABLE_LIBOMP_PROFILING)
177+
if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMP_PROFILING))
180178
add_library(omp ${LIBOMP_LIBRARY_KIND} $<TARGET_OBJECTS:obj.omp>)
181179
set_property(TARGET omp PROPERTY FOLDER "OpenMP/Libraries")
182180
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
@@ -190,10 +188,7 @@ else()
190188
# libomp must be a C++ library such that it can link libLLVMSupport
191189
set(LIBOMP_LINKER_LANGUAGE CXX)
192190
endif()
193-
194-
openmp_register_meta_dep(omp)
195-
196-
if(LIBOMP_USE_HWLOC)
191+
if(${LIBOMP_USE_HWLOC})
197192
# Since we are using an OBJECT library, the PRIVATE and INTERFACE options are split
198193
# (instead of using PUBLIC): obj.omp for compiling itself, omp for propagating
199194
# the options to other libraries that depend on it, e.g. libompd.
@@ -385,15 +380,15 @@ if(WIN32)
385380
endif()
386381

387382
# Move files to exports/ directory if requested
388-
if(LIBOMP_COPY_EXPORTS)
383+
if(${LIBOMP_COPY_EXPORTS})
389384
include(LibompExports)
390385
endif()
391386

392387
# Micro test rules for after library has been built (cmake/LibompMicroTests.cmake)
393388
include(LibompMicroTests)
394389
add_custom_target(libomp-micro-tests)
395390
set_target_properties(libomp-micro-tests PROPERTIES FOLDER "OpenMP/Tests")
396-
if(NOT MIC AND NOT CMAKE_CROSSCOMPILING)
391+
if(NOT ${MIC} AND NOT CMAKE_CROSSCOMPILING)
397392
add_dependencies(libomp-micro-tests libomp-test-touch)
398393
endif()
399394
if(NOT WIN32 AND NOT APPLE)
@@ -406,29 +401,31 @@ add_dependencies(libomp-micro-tests libomp-test-deps)
406401

407402
# `omp` needs to be exported if in-tree build.
408403
set(export_to_llvmexports)
409-
get_target_export_arg(omp LLVM export_to_llvmexports)
410-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS omp)
404+
if (NOT OPENMP_STANDALONE_BUILD)
405+
get_target_export_arg(omp LLVM export_to_llvmexports)
406+
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS omp)
407+
endif()
411408

412409
# Install rules
413410
# We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}
414411
# We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR}
415412
if(WIN32)
416-
install(TARGETS omp ${export_to_llvmexports} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT openmp)
417-
install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}" COMPONENT openmp)
413+
install(TARGETS omp ${export_to_llvmexports} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
414+
install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
418415
# Create aliases (regular copies) of the library for backwards compatibility
419416
set(LIBOMP_ALIASES "libiomp5md")
420417
foreach(alias IN LISTS LIBOMP_ALIASES)
421418
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\"
422-
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"${CMAKE_INSTALL_FULL_BINDIR}\")" COMPONENT openmp)
419+
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"${CMAKE_INSTALL_FULL_BINDIR}\")")
423420
extend_path(outdir "${CMAKE_INSTALL_PREFIX}" "${OPENMP_INSTALL_LIBDIR}")
424421
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
425-
\"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"${outdir}\")" COMPONENT openmp)
422+
\"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"${outdir}\")")
426423
endforeach()
427424
else()
428425

429-
install(TARGETS omp ${export_to_llvmexports} ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}" COMPONENT openmp)
426+
install(TARGETS omp ${export_to_llvmexports} ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}")
430427

431-
if(LIBOMP_INSTALL_ALIASES)
428+
if(${LIBOMP_INSTALL_ALIASES})
432429
# Create aliases (symlinks) of the library for backwards compatibility
433430
extend_path(outdir "${CMAKE_INSTALL_PREFIX}" "${OPENMP_INSTALL_LIBDIR}")
434431
if(AIX)
@@ -441,12 +438,12 @@ else()
441438
foreach(alias IN LISTS LIBOMP_ALIASES)
442439
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_NAME}${LIBRARY_SUFFIX}\"
443440
\"${alias}${LIBRARY_SUFFIX}\" WORKING_DIRECTORY
444-
\"\$ENV{DESTDIR}${outdir}\")" COMPONENT openmp)
441+
\"\$ENV{DESTDIR}${outdir}\")")
445442
endforeach()
446443
if(LIBOMP_ENABLE_SHARED AND NOT AIX)
447444
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\"
448445
\"${VERSIONED_LIBGOMP_NAME}\" WORKING_DIRECTORY
449-
\"\$ENV{DESTDIR}${outdir}\")" COMPONENT openmp)
446+
\"\$ENV{DESTDIR}${outdir}\")")
450447
endif()
451448
endif()
452449
endif()
@@ -455,11 +452,10 @@ install(
455452
${LIBOMP_HEADERS_INTDIR}/omp.h
456453
${LIBOMP_HEADERS_INTDIR}/ompx.h
457454
DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH}
458-
COMPONENT openmp
459455
)
460-
if(LIBOMP_OMPT_SUPPORT)
461-
install(FILES ${LIBOMP_HEADERS_INTDIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} COMPONENT openmp)
456+
if(${LIBOMP_OMPT_SUPPORT})
457+
install(FILES ${LIBOMP_HEADERS_INTDIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH})
462458
# install under legacy name ompt.h
463-
install(FILES ${LIBOMP_HEADERS_INTDIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} RENAME ompt.h COMPONENT openmp)
459+
install(FILES ${LIBOMP_HEADERS_INTDIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} RENAME ompt.h)
464460
set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
465461
endif()

system/lib/openmp/src/dllexports

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ kmp_set_disp_num_buffers 890
607607
llvm_omp_target_shared_mem_space DATA
608608
llvm_omp_target_device_mem_space DATA
609609
omp_null_mem_space DATA
610-
omp_cgroup_mem_space DATA
611610

612611
%ifndef stub
613612
# Ordinals between 900 and 999 are reserved

system/lib/openmp/src/i18n/en_US.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,6 @@ AffHWSubsetIgnoringAttr "KMP_HW_SUBSET: ignoring %1$s attribute. This machi
482482
TargetMemNotAvailable "Target memory not available, will use default allocator."
483483
AffIgnoringNonHybrid "%1$s ignored: This machine is not a hybrid architecutre. Using \"%2$s\" instead."
484484
AffIgnoringNotAvailable "%1$s ignored: %2$s is not available. Using \"%3$s\" instead."
485-
SetNumTeamsInParOrTeamsRegion "%1$s() called inside a parallel or teams region; call ignored."
486-
SetTeamsThreadLimitInParOrTeamsRegion "%1$s() called inside a parallel or teams region; call ignored."
487485

488486
# --------------------------------------------------------------------------------------------------
489487
-*- HINTS -*-

0 commit comments

Comments
 (0)