From 55093f2bb167c5a0963262e63ade33eb6d28440f Mon Sep 17 00:00:00 2001 From: Renbo Date: Tue, 20 Feb 2024 11:38:19 +0800 Subject: [PATCH 1/2] update to libomp-16.0.6-3.src.rpm Signed-off-by: Renbo --- 0001-Support-LoongArch.patch | 502 ----------------------------------- download | 6 +- libomp.spec | 76 +++--- release-keys.asc | 104 -------- 4 files changed, 49 insertions(+), 639 deletions(-) delete mode 100644 0001-Support-LoongArch.patch delete mode 100644 release-keys.asc diff --git a/0001-Support-LoongArch.patch b/0001-Support-LoongArch.patch deleted file mode 100644 index 081e689..0000000 --- a/0001-Support-LoongArch.patch +++ /dev/null @@ -1,502 +0,0 @@ -diff --git a/openmp/README.rst b/openmp/README.rst -index ffa49e4d2..a12c62897 100644 ---- a/openmp/README.rst -+++ b/openmp/README.rst -@@ -137,7 +137,7 @@ Options for all Libraries - Options for ``libomp`` - ---------------------- - --**LIBOMP_ARCH** = ``aarch64|arm|i386|mic|mips|mips64|ppc64|ppc64le|x86_64|riscv64`` -+**LIBOMP_ARCH** = ``aarch64|arm|i386|mic|mips|mips64|ppc64|ppc64le|x86_64|riscv64|loongarch64`` - The default value for this option is chosen based on probing the compiler for - architecture macros (e.g., is ``__x86_64__`` predefined by compiler?). - -@@ -194,7 +194,7 @@ Optional Features - **LIBOMP_OMPT_SUPPORT** = ``ON|OFF`` - Include support for the OpenMP Tools Interface (OMPT). - This option is supported and ``ON`` by default for x86, x86_64, AArch64, -- PPC64 and RISCV64 on Linux* and macOS*. -+ PPC64, RISCV64 and loongarch64 on Linux* and macOS*. - This option is ``OFF`` if this feature is not supported for the platform. - - **LIBOMP_OMPT_OPTIONAL** = ``ON|OFF`` -diff --git a/openmp/runtime/CMakeLists.txt b/openmp/runtime/CMakeLists.txt -index c9dbcb2ab..31995363a 100644 ---- a/openmp/runtime/CMakeLists.txt -+++ b/openmp/runtime/CMakeLists.txt -@@ -30,7 +30,7 @@ if(${OPENMP_STANDALONE_BUILD}) - # If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake - libomp_get_architecture(LIBOMP_DETECTED_ARCH) - set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING -- "The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic/mips/mips64/riscv64).") -+ "The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic/mips/mips64/riscv64/loongarch64).") - # Should assertions be enabled? They are on by default. - set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL - "enable assertions?") -@@ -61,6 +61,8 @@ else() # Part of LLVM build - set(LIBOMP_ARCH arm) - elseif(LIBOMP_NATIVE_ARCH MATCHES "riscv64") - set(LIBOMP_ARCH riscv64) -+ elseif(LIBOMP_NATIVE_ARCH MATCHES "loongarch64") -+ set(LIBOMP_ARCH loongarch64) - else() - # last ditch effort - libomp_get_architecture(LIBOMP_ARCH) -@@ -81,7 +83,7 @@ if(LIBOMP_ARCH STREQUAL "aarch64") - endif() - endif() - --libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 aarch64_a64fx mic mips mips64 riscv64) -+libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 aarch64_a64fx mic mips mips64 riscv64 loongarch64) - - set(LIBOMP_LIB_TYPE normal CACHE STRING - "Performance,Profiling,Stubs library (normal/profile/stubs)") -@@ -159,6 +161,7 @@ set(MIC FALSE) - set(MIPS64 FALSE) - set(MIPS FALSE) - set(RISCV64 FALSE) -+set(LoongArch64 FALSE) - if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture - set(IA32 TRUE) - elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture -@@ -183,6 +186,8 @@ elseif("${LIBOMP_ARCH}" STREQUAL "mips64") # MIPS64 architecture - set(MIPS64 TRUE) - elseif("${LIBOMP_ARCH}" STREQUAL "riscv64") # RISCV64 architecture - set(RISCV64 TRUE) -+elseif("${LIBOMP_ARCH}" STREQUAL "loongarch64") # LoongArch64 architecture -+ set(LoongArch64 TRUE) - endif() - - # Set some flags based on build_type -diff --git a/openmp/runtime/README.txt b/openmp/runtime/README.txt -index 874a5634e..ddd8b0e42 100644 ---- a/openmp/runtime/README.txt -+++ b/openmp/runtime/README.txt -@@ -54,6 +54,7 @@ Architectures Supported - * IBM(R) Power architecture (little endian) - * MIPS and MIPS64 architecture - * RISCV64 architecture -+* LoongArch64 architecture - - Supported RTL Build Configurations - ================================== -diff --git a/openmp/runtime/cmake/LibompGetArchitecture.cmake b/openmp/runtime/cmake/LibompGetArchitecture.cmake -index dd60a2d34..72cbf64d4 100644 ---- a/openmp/runtime/cmake/LibompGetArchitecture.cmake -+++ b/openmp/runtime/cmake/LibompGetArchitecture.cmake -@@ -47,6 +47,8 @@ function(libomp_get_architecture return_arch) - #error ARCHITECTURE=mips - #elif defined(__riscv) && __riscv_xlen == 64 - #error ARCHITECTURE=riscv64 -+ #elif defined(__loongarch__) && defined(__loongarch64) -+ #error ARCHITECTURE=loongarch64 - #else - #error ARCHITECTURE=UnknownArchitecture - #endif -diff --git a/openmp/runtime/cmake/LibompMicroTests.cmake b/openmp/runtime/cmake/LibompMicroTests.cmake -index 1ca3412ed..d34405673 100644 ---- a/openmp/runtime/cmake/LibompMicroTests.cmake -+++ b/openmp/runtime/cmake/LibompMicroTests.cmake -@@ -214,6 +214,9 @@ else() - elseif(${RISCV64}) - libomp_append(libomp_expected_library_deps libc.so.6) - libomp_append(libomp_expected_library_deps ld.so.1) -+ elseif(${LoongArch64}) -+ libomp_append(libomp_expected_library_deps libc.so.6) -+ libomp_append(libomp_expected_library_deps ld.so.1) - endif() - libomp_append(libomp_expected_library_deps libpthread.so.0 IF_FALSE STUBS_LIBRARY) - libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC) -diff --git a/openmp/runtime/cmake/LibompUtils.cmake b/openmp/runtime/cmake/LibompUtils.cmake -index b1de24237..8d6b6efea 100644 ---- a/openmp/runtime/cmake/LibompUtils.cmake -+++ b/openmp/runtime/cmake/LibompUtils.cmake -@@ -109,6 +109,8 @@ function(libomp_get_legal_arch return_arch_string) - set(${return_arch_string} "MIPS64" PARENT_SCOPE) - elseif(${RISCV64}) - set(${return_arch_string} "RISCV64" PARENT_SCOPE) -+ elseif(${LoongArch64}) -+ set(${return_arch_string} "LoongArch64" PARENT_SCOPE) - else() - set(${return_arch_string} "${LIBOMP_ARCH}" PARENT_SCOPE) - libomp_warning_say("libomp_get_legal_arch(): Warning: Unknown architecture: Using ${LIBOMP_ARCH}") -diff --git a/openmp/runtime/src/kmp_affinity.h b/openmp/runtime/src/kmp_affinity.h -index ce00362f0..06fd323a5 100644 ---- a/openmp/runtime/src/kmp_affinity.h -+++ b/openmp/runtime/src/kmp_affinity.h -@@ -254,6 +254,18 @@ public: - #elif __NR_sched_getaffinity != 5196 - #error Wrong code for getaffinity system call. - #endif /* __NR_sched_getaffinity */ -+#elif KMP_ARCH_LOONGARCH64 -+#ifndef __NR_sched_setaffinity -+#define __NR_sched_setaffinity 122 -+#elif __NR_sched_setaffinity != 122 -+#error Wrong code for setaffinity system call. -+#endif /* __NR_sched_setaffinity */ -+#ifndef __NR_sched_getaffinity -+#define __NR_sched_getaffinity 123 -+#elif __NR_sched_getaffinity != 123 -+#error Wrong code for getaffinity system call. -+#endif /* __NR_sched_getaffinity */ -+#else - #error Unknown or unsupported architecture - #endif /* KMP_ARCH_* */ - #elif KMP_OS_FREEBSD -diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp -index c932d450c..ba25d2e16 100644 ---- a/openmp/runtime/src/kmp_csupport.cpp -+++ b/openmp/runtime/src/kmp_csupport.cpp -@@ -700,7 +700,7 @@ void __kmpc_flush(ident_t *loc) { - } - #endif // KMP_MIC - #elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64 || \ -- KMP_ARCH_RISCV64) -+ KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64) - // Nothing to see here move along - #elif KMP_ARCH_PPC64 - // Nothing needed here (we have a real MB above). -diff --git a/openmp/runtime/src/kmp_os.h b/openmp/runtime/src/kmp_os.h -index 02efaa1b2..f1d24962a 100644 ---- a/openmp/runtime/src/kmp_os.h -+++ b/openmp/runtime/src/kmp_os.h -@@ -178,7 +178,7 @@ typedef unsigned long long kmp_uint64; - #if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS - #define KMP_SIZE_T_SPEC KMP_UINT32_SPEC - #elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ -- KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 -+ KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 - #define KMP_SIZE_T_SPEC KMP_UINT64_SPEC - #else - #error "Can't determine size_t printf format specifier." -@@ -1044,7 +1044,7 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v); - #endif /* KMP_OS_WINDOWS */ - - #if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || \ -- KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 -+ KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 - #if KMP_OS_WINDOWS - #undef KMP_MB - #define KMP_MB() std::atomic_thread_fence(std::memory_order_seq_cst) -diff --git a/openmp/runtime/src/kmp_platform.h b/openmp/runtime/src/kmp_platform.h -index bbbd72dd6..6392d17b1 100644 ---- a/openmp/runtime/src/kmp_platform.h -+++ b/openmp/runtime/src/kmp_platform.h -@@ -92,6 +92,7 @@ - #define KMP_ARCH_MIPS 0 - #define KMP_ARCH_MIPS64 0 - #define KMP_ARCH_RISCV64 0 -+#define KMP_ARCH_LOONGARCH64 0 - - #if KMP_OS_WINDOWS - #if defined(_M_AMD64) || defined(__x86_64) -@@ -135,6 +136,9 @@ - #elif defined __riscv && __riscv_xlen == 64 - #undef KMP_ARCH_RISCV64 - #define KMP_ARCH_RISCV64 1 -+#elif defined __loongarch__ && defined __loongarch64 -+#undef KMP_ARCH_LOONGARCH64 -+#define KMP_ARCH_LOONGARCH64 1 - #endif - #endif - -@@ -199,7 +203,7 @@ - // TODO: Fixme - This is clever, but really fugly - #if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + \ - KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64 + \ -- KMP_ARCH_RISCV64) -+ KMP_ARCH_RISCV64 + KMP_ARCH_LOONGARCH64) - #error Unknown or unsupported architecture - #endif - -diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp -index b8d470528..3895ece65 100644 ---- a/openmp/runtime/src/kmp_runtime.cpp -+++ b/openmp/runtime/src/kmp_runtime.cpp -@@ -8751,7 +8751,7 @@ __kmp_determine_reduction_method( - int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED; - - #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ -- KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 -+ KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 - - #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ - KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD -diff --git a/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h b/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h -index a452b7643..d6d2cb085 100644 ---- a/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h -+++ b/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h -@@ -162,6 +162,10 @@ - #define ITT_ARCH_ARM64 6 - #endif /* ITT_ARCH_ARM64 */ - -+#ifndef ITT_ARCH_LOONGARCH64 -+#define ITT_ARCH_LOONGARCH64 7 -+#endif /* ITT_ARCH_LOONGARCH64 */ -+ - #ifndef ITT_ARCH - #if defined _M_IX86 || defined __i386__ - #define ITT_ARCH ITT_ARCH_IA32 -@@ -175,6 +179,8 @@ - #define ITT_ARCH ITT_ARCH_ARM64 - #elif defined __powerpc64__ - #define ITT_ARCH ITT_ARCH_PPC64 -+#elif defined __loongarch__ && defined __loongarch64 -+#define ITT_ARCH ITT_ARCH_LOONGARCH64 - #endif - #endif - -diff --git a/openmp/runtime/src/z_Linux_asm.S b/openmp/runtime/src/z_Linux_asm.S -index b4a45c1ac..4f80a810c 100644 ---- a/openmp/runtime/src/z_Linux_asm.S -+++ b/openmp/runtime/src/z_Linux_asm.S -@@ -1725,6 +1725,157 @@ __kmp_invoke_microtask: - - #endif /* KMP_ARCH_RISCV64 */ - -+#if KMP_ARCH_LOONGARCH64 -+ -+//------------------------------------------------------------------------ -+// -+// typedef void (*microtask_t)( int *gtid, int *tid, ... ); -+// -+// int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int tid, int argc, -+// void *p_argv[] -+// #if OMPT_SUPPORT -+// , -+// void **exit_frame_ptr -+// #endif -+// ) { -+// #if OMPT_SUPPORT -+// *exit_frame_ptr = OMPT_GET_FRAME_ADDRESS(0); -+// #endif -+// (*pkfn)( & gtid, & tid, argv[0], ... ); -+// -+// return 1; -+// } -+// -+// parameters: -+// a0: pkfn -+// a1: gtid -+// a2: tid -+// a3: argc -+// a4: p_argv -+// a5: exit_frame_ptr -+// -+// Temp. registers: -+// -+// t0: used to calculate the dynamic stack size / used to hold pkfn address -+// t1: used as temporary for stack placement calculation -+// t2: used as temporary for stack arguments -+// t3: used as temporary for number of remaining pkfn parms -+// t4: used to traverse p_argv array -+// -+// return: a0 (always 1/TRUE) -+// -+ -+// -- Begin __kmp_invoke_microtask -+// mark_begin; -+ .text -+ .globl __kmp_invoke_microtask -+ .p2align 3 -+ .type __kmp_invoke_microtask,@function -+__kmp_invoke_microtask: -+ -+ // First, save ra and fp -+ addi.d $sp, $sp, -16 -+ st.d $ra, $sp, 8 -+ st.d $fp, $sp, 0 -+ addi.d $fp, $sp, 16 -+ -+ // Compute the dynamic stack size: -+ // -+ // - We need 8 bytes for storing 'gtid' and 'tid', so we can pass them by -+ // reference -+ // - We need 8 bytes for each argument that cannot be passed to the 'pkfn' -+ // function by register. Given that we have 8 of such registers (a[0-7]) -+ // and two + 'argc' arguments (consider >id and &tid), we need to -+ // reserve max(0, argc - 6)*8 ext$ra bytes -+ // -+ // The total number of bytes is then max(0, argc - 6)*8 + 8 -+ -+ // Compute max(0, argc - 6) using the following bithack: -+ // max(0, x) = x - (x & (x >> 31?63)), where x := argc - 6 -+ // Source: http://g$raphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax -+ addi.d $t0, $a3, -6 -+ srai.d $t1, $t0, 63 -+ and $t1, $t0, $t1 -+ sub.d $t0, $t0, $t1 -+ -+ addi.d $t0, $t0, 1 -+ -+ slli.d $t0, $t0, 3 // t0: total number of bytes for stack storing arguments. -+ sub.d $sp, $sp, $t0 -+ -+ move $t0, $a0 -+ move $t3, $a3 -+ move $t4, $a4 -+ -+#if OMPT_SUPPORT -+ // Save frame pointer into exit_frame -+ st.d $fp, $a5, 0 -+#endif -+ -+ // Prepare arguments for the pkfn function (first 8 using $a0-$a7 registers) -+ -+ st.w $a1, $fp, -20 // gtid -+ st.w $a2, $fp, -24 // tid -+ -+ addi.d $a0, $fp, -20 // >id -+ addi.d $a1, $fp, -24 // &tid -+ -+ beqz $t3, .L_kmp_3 -+ ld.d $a2, $t4, 0 // argv[0] -+ -+ addi.d $t3, $t3, -1 -+ beqz $t3, .L_kmp_3 -+ ld.d $a3, $t4, 8 // argv[1] -+ -+ addi.d $t3, $t3, -1 -+ beqz $t3, .L_kmp_3 -+ ld.d $a4, $t4, 16 // argv[2] -+ -+ addi.d $t3, $t3, -1 -+ beqz $t3, .L_kmp_3 -+ ld.d $a5, $t4, 24 // argv[3] -+ -+ addi.d $t3, $t3, -1 -+ beqz $t3, .L_kmp_3 -+ ld.d $a6, $t4, 32 // argv[4] -+ -+ addi.d $t3, $t3, -1 -+ beqz $t3, .L_kmp_3 -+ ld.d $a7, $t4, 40 // argv[5] -+ -+ // Prepare any additional argument passed through the stack -+ addi.d $t4, $t4, 48 -+ move $t1, $sp -+ b .L_kmp_2 -+.L_kmp_1: -+ ld.d $t2, $t4, 0 -+ st.d $t2, $t1, 0 -+ addi.d $t4, $t4, 8 -+ addi.d $t1, $t1, 8 -+.L_kmp_2: -+ addi.d $t3, $t3, -1 -+ bnez $t3, .L_kmp_1 -+ -+.L_kmp_3: -+ // Call pkfn function -+ jirl $ra, $t0, 0 -+ -+ // Restore stack and return -+ -+ addi.d $a0, $zero, 1 -+ -+ addi.d $sp, $fp, -16 -+ ld.d $fp, $sp, 0 -+ ld.d $ra, $sp, 8 -+ addi.d $sp, $sp, 16 -+ jr $ra -+.Lfunc_end0: -+ .size __kmp_invoke_microtask, .Lfunc_end0-__kmp_invoke_microtask -+ -+// -- End __kmp_invoke_microtask -+ -+#endif /* KMP_ARCH_LOONGARCH64 */ -+ - #if KMP_ARCH_ARM || KMP_ARCH_MIPS - .data - .comm .gomp_critical_user_,32,8 -@@ -1736,7 +1887,8 @@ __kmp_unnamed_critical_addr: - .size __kmp_unnamed_critical_addr,4 - #endif /* KMP_ARCH_ARM */ - --#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 -+#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || \ -+ KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 - #ifndef KMP_PREFIX_UNDERSCORE - # define KMP_PREFIX_UNDERSCORE(x) x - #endif -@@ -1751,7 +1903,7 @@ KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr): - .size KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr),8 - #endif - #endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || -- KMP_ARCH_RISCV64 */ -+ KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 */ - - #if KMP_OS_LINUX - # if KMP_ARCH_ARM -diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp -index 91edf0254..2a0154ee8 100644 ---- a/openmp/runtime/src/z_Linux_util.cpp -+++ b/openmp/runtime/src/z_Linux_util.cpp -@@ -2447,7 +2447,7 @@ finish: // Clean up and exit. - - #if !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_MIC || \ - ((KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64) || \ -- KMP_ARCH_PPC64 || KMP_ARCH_RISCV64) -+ KMP_ARCH_PPC64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64) - - // we really only need the case with 1 argument, because CLANG always build - // a struct of pointers to shared variables referenced in the outlined function -diff --git a/openmp/runtime/tools/lib/Platform.pm b/openmp/runtime/tools/lib/Platform.pm -index 38593a154..2d262ae69 100644 ---- a/openmp/runtime/tools/lib/Platform.pm -+++ b/openmp/runtime/tools/lib/Platform.pm -@@ -63,6 +63,8 @@ sub canon_arch($) { - $arch = "mips"; - } elsif ( $arch =~ m{\Ariscv64} ) { - $arch = "riscv64"; -+ } elsif ( $arch =~ m{\Aloongarch64} ) { -+ $arch = "loongarch64"; - } else { - $arch = undef; - }; # if -@@ -97,6 +99,7 @@ sub canon_mic_arch($) { - "mips" => "MIPS", - "mips64" => "MIPS64", - "riscv64" => "RISC-V (64-bit)", -+ "loongarch64" => "LoongArch64", - ); - - sub legal_arch($) { -@@ -119,6 +122,7 @@ sub canon_mic_arch($) { - "mic" => "intel64", - "mips" => "mips", - "mips64" => "MIPS64", -+ "loongarch64" => "loongarch64", - ); - - sub arch_opt($) { -@@ -225,6 +229,8 @@ sub target_options() { - $_host_arch = "mips"; - } elsif ( $hardware_platform eq "riscv64" ) { - $_host_arch = "riscv64"; -+ } elsif ( $hardware_platform eq "loongarch64" ) { -+ $_host_arch = "loongarch64"; - } else { - die "Unsupported host hardware platform: \"$hardware_platform\"; stopped"; - }; # if -@@ -414,7 +420,7 @@ the script assumes host architecture is target one. - - Input string is an architecture name to canonize. The function recognizes many variants, for example: - C<32e>, C, C, etc. Returned string is a canonized architecture name, --one of: C<32>, C<32e>, C<64>, C, C, C, C, C, C, C or C is input string is not recognized. -+one of: C<32>, C<32e>, C<64>, C, C, C, C, C, C, C, C or C is input string is not recognized. - - =item B - -diff --git a/openmp/runtime/tools/lib/Uname.pm b/openmp/runtime/tools/lib/Uname.pm -index 99fe1cdbf..8a976addc 100644 ---- a/openmp/runtime/tools/lib/Uname.pm -+++ b/openmp/runtime/tools/lib/Uname.pm -@@ -158,6 +158,8 @@ if ( 0 ) { - $values{ hardware_platform } = "mips"; - } elsif ( $values{ machine } =~ m{\Ariscv64\z} ) { - $values{ hardware_platform } = "riscv64"; -+ } elsif ( $values{ machine } =~ m{\Aloongarch64\z} ) { -+ $values{ hardware_platform } = "loongarch64"; - } else { - die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped"; - }; # if diff --git a/download b/download index f101f94..d0789ff 100644 --- a/download +++ b/download @@ -1,2 +1,4 @@ -21fe5b6a48bb089ccac8514cc5bb269f openmp-15.0.7.src.tar.xz -963d280ef15d7dcb2d13478bc84eac4b openmp-15.0.7.src.tar.xz.sig +b7830bb90e376c90a43c2c190a0a5ffa cmake-16.0.6.src.tar.xz +5f748e5dff6c50d57b20b32a27ac8ed0 cmake-16.0.6.src.tar.xz.sig +b49fd38f38eeacbe275d2c176c7b6545 openmp-16.0.6.src.tar.xz +cd0553dea75e849721944734ccd522be openmp-16.0.6.src.tar.xz.sig diff --git a/libomp.spec b/libomp.spec index 35baf99..b43dac9 100644 --- a/libomp.spec +++ b/libomp.spec @@ -1,8 +1,8 @@ -%define anolis_release .0.3 -%global maj_ver 15 -%global libomp_version %{maj_ver}.0.7 -#global rc_ver 1 +%global maj_ver 16 +%global libomp_version %{maj_ver}.0.6 +#global rc_ver 4 %global libomp_srcdir openmp-%{libomp_version}%{?rc_ver:rc%{rc_ver}}.src +%global cmake_srcdir cmake-%{libomp_version}%{?rc_ver:rc%{rc_ver}}.src %ifarch ppc64le @@ -19,18 +19,18 @@ Name: libomp Version: %{libomp_version}%{?rc_ver:~rc%{rc_ver}} -Release: 1%{anolis_release}%{?dist} +Release: 3%{?dist} Summary: OpenMP runtime for clang License: NCSA URL: http://openmp.llvm.org Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libomp_version}%{?rc_ver:-rc%{rc_ver}}/%{libomp_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libomp_version}%{?rc_ver:-rc%{rc_ver}}/%{libomp_srcdir}.tar.xz.sig -Source2: release-keys.asc +#Source2: release-keys.asc Source3: run-lit-tests Source4: lit.fedora.cfg.py - -Patch0: 0001-Support-LoongArch.patch +Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libomp_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz +Source6: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libomp_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz.sig BuildRequires: clang # For clang-offload-packager @@ -62,6 +62,7 @@ OpenMP runtime for clang. %package devel Summary: OpenMP header files +Requires: %{name}%{?isa} = %{version}-%{release} Requires: clang-resource-filesystem%{?isa} = %{version} %description devel @@ -85,7 +86,13 @@ OpenMP regression tests %endif %prep -%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +#%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +#%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE6}' --data='%{SOURCE5}' +%setup -T -q -b 5 -n %{cmake_srcdir} +# TODO: It would be more elegant to set -DLLVM_COMMON_CMAKE_UTILS=%{_builddir}/%{cmake_srcdir}, +# but this is not a CACHED variable, so we can't actually set it externally :( +cd .. +mv %{cmake_srcdir} cmake %autosetup -n %{libomp_srcdir} -p2 %build @@ -98,13 +105,9 @@ cd %{_vpath_builddir} %cmake .. -GNinja \ -DLIBOMP_INSTALL_ALIASES=OFF \ -%ifarch loongarch64 - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER=clang++ \ -%endif -DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \ -DLLVM_DIR=%{_libdir}/cmake/llvm \ - -DCMAKE_INSTALL_INCLUDEDIR=%{_libdir}/clang/%{libomp_version}/include \ + -DCMAKE_INSTALL_INCLUDEDIR=%{_libdir}/clang/%{maj_ver}/include \ %if 0%{?__isa_bits} == 64 -DOPENMP_LIBDIR_SUFFIX=64 \ %else @@ -126,10 +129,13 @@ cd %{_vpath_builddir} %global lit_cfg %{libomp_testdir}/%{_arch}.site.cfg.py %global lit_fedora_cfg %{_datadir}/libomp/lit.fedora.cfg.py +# Install test files +cd .. install -d %{buildroot}%{libomp_srcdir}/runtime cp -R runtime/test %{buildroot}%{libomp_srcdir}/runtime cp -R runtime/src %{buildroot}%{libomp_srcdir}/runtime +cd %{_vpath_builddir} # Generate lit config files. Strip off the last line that initiates the # test run, so we can customize the configuration. head -n -1 runtime/test/lit.site.cfg >> %{buildroot}%{lit_cfg} @@ -144,6 +150,7 @@ echo "lit_config.load_config(config, '%{lit_fedora_cfg}')" >> %{buildroot}%{lit_ install -d %{buildroot}%{_libexecdir}/tests/libomp install -m 0755 %{SOURCE3} %{buildroot}%{_libexecdir}/tests/libomp + %endif # Remove static libraries with equivalent shared libraries @@ -156,38 +163,42 @@ cd %{_vpath_builddir} %files %license LICENSE.TXT %{_libdir}/libomp.so -%ifnarch loongarch64 %{_libdir}/libompd.so %ifnarch %{arm} %{_libdir}/libarcher.so %endif %ifnarch %{ix86} %{arm} +# libomptarget is not supported on 32-bit systems. %{_libdir}/libomptarget.rtl.amdgpu.so.%{maj_ver} +%{_libdir}/libomptarget.rtl.amdgpu.nextgen.so.%{maj_ver} %{_libdir}/libomptarget.rtl.cuda.so.%{maj_ver} +%{_libdir}/libomptarget.rtl.cuda.nextgen.so.%{maj_ver} %{_libdir}/libomptarget.rtl.%{libomp_arch}.so.%{maj_ver} -%endif -%endif +%{_libdir}/libomptarget.rtl.%{libomp_arch}.nextgen.so.%{maj_ver} %{_libdir}/libomptarget.so.%{maj_ver} +%endif %files devel -%{_libdir}/clang/%{libomp_version}/include/omp.h +%{_libdir}/clang/%{maj_ver}/include/omp.h %{_libdir}/cmake/openmp/FindOpenMPTarget.cmake -%ifnarch %{arm} loongarch64 -%{_libdir}/clang/%{libomp_version}/include/omp-tools.h -%{_libdir}/clang/%{libomp_version}/include/ompt.h -%{_libdir}/clang/%{libomp_version}/include/ompt-multiplex.h +%ifnarch %{arm} +%{_libdir}/clang/%{maj_ver}/include/omp-tools.h +%{_libdir}/clang/%{maj_ver}/include/ompt.h +%{_libdir}/clang/%{maj_ver}/include/ompt-multiplex.h %endif %ifnarch %{ix86} %{arm} -%ifnarch loongarch64 +# libomptarget is not supported on 32-bit systems. %{_libdir}/libomptarget.rtl.amdgpu.so +%{_libdir}/libomptarget.rtl.amdgpu.nextgen.so %{_libdir}/libomptarget.rtl.cuda.so +%{_libdir}/libomptarget.rtl.cuda.nextgen.so %{_libdir}/libomptarget.rtl.%{libomp_arch}.so -%endif +%{_libdir}/libomptarget.rtl.%{libomp_arch}.nextgen.so %{_libdir}/libomptarget.devicertl.a %{_libdir}/libomptarget-amdgpu-*.bc %{_libdir}/libomptarget-nvptx-*.bc -%endif %{_libdir}/libomptarget.so +%endif %if %{with testpkg} %files test @@ -196,14 +207,17 @@ cd %{_vpath_builddir} %endif %changelog -* Fri Aug 11 2023 Chen Li - 15.0.7-1.0.3 -- Support LoongArch +* Sat Jul 15 2023 Tom Stellard - 16.0.6-3 +- Remove duplicated installed binaries + +* Wed Jul 05 2023 Tom Stellard - 16.0.6-2 +- Add explict libomp requres to libomp-devel -* Wed Jul 19 2023 Zhao Hang - 15.0.7-1.0.2 -- Add loongarch64 arch +* Fri Jun 23 2023 Tom Stellard - 16.0.6-1 +- 16.0.6 Release -* Sat Jul 01 2023 Zhao Hang - 15.0.7-1.0.1 -- Remove loongarch64 arch +* Fri Apr 28 2023 Tom Stellard - 16.0.0-1 +- Release 16.0.0 * Thu Jan 19 2023 Tom Stellard - 15.0.7-1 - Update to LLVM 15.0.7 diff --git a/release-keys.asc b/release-keys.asc deleted file mode 100644 index 0d3789a..0000000 --- a/release-keys.asc +++ /dev/null @@ -1,104 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQGNBGLtemUBDADClvDIromq0Y4TX+wyRyYCq5WusPQheQuY8dVCXd9KhMpYAv8U -X15E5boH/quGpJ0ZlVkWcf+1WUHIrQWlbzQdIx514CDM7DBgO92CXsnn86kIMDW+ -9S+Hkn8upbizT1fWritlHwzD9osz7ZQRq7ac03PPgw27tqeIizHGuG4VNLyhbbjA -w+0VLFSu3r219eevS+lzBIvR5U9W720jFxWxts4UvaGuD6XW1ErcsTvuhgyCKrrs -gxO5Ma/V7r0+lqRL688ZPr4HxthwsON1YCfpNiMZ6sgxT8rOE0qL/d07ItbnXxz6 -KdcNWIXamTJKJgag6Tl0gYX4KIuUCcivXaRdJtUcFFsveCorkdHkdGNos403XR89 -5u9gq7Ef10Zahsv5GjE2DV5oFCEhXvfIWxvyeJa65iBkJafElb2stgUjkIut2a2u -+XmpKpwpGSFklce1ABLrmazlLjhsYiJVrz5l5ktoT9moE4GaF7Q5LD6JgsxzLE0U -Tzo9/AQPd8qG2REAEQEAAbQeVG9iaWFzIEhpZXRhIDx0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pFt7UgDquTL -M1beQUCZRt81yJTNdrggbhQ2POxOdIO0CPiQv7U1IzndZp6baedeBw4a7FCbj6GY -cQeHxQCrWpQrwigiseG5uhhS9aiaVFEHja9baSLfXlZu/vsR4MdDG5/iEpier/Xw -h1qnpTSY+r31Uw3lTUlPHzlg47PMgPslaIhCzfVggxh9bTqxcDbuYJ7NuoMho3tN -yWfeofTJ7PhKzoXM2Y/rRFoM5gNh1RVA19ngLT5Jwiof8fPZvHJ/9ZkHn+O7eMNm -m5++gYza3pnn2/PoGpGGAKok+sfJiq5Tb7RUefyJTeZiyTZ/XJrA -=tMzl ------END PGP PUBLIC KEY BLOCK----- -- Gitee From 58e92e58356f118aaf87ab95cea84f70c2720bd9 Mon Sep 17 00:00:00 2001 From: llvm-ci Date: Wed, 9 Aug 2023 10:31:12 +0800 Subject: [PATCH 2/2] Support LoongArch --- 0001-Support-LoongArch.patch | 502 +++++++++++++++++++++++++++++++++++ libomp.spec | 18 +- 2 files changed, 518 insertions(+), 2 deletions(-) create mode 100644 0001-Support-LoongArch.patch diff --git a/0001-Support-LoongArch.patch b/0001-Support-LoongArch.patch new file mode 100644 index 0000000..081e689 --- /dev/null +++ b/0001-Support-LoongArch.patch @@ -0,0 +1,502 @@ +diff --git a/openmp/README.rst b/openmp/README.rst +index ffa49e4d2..a12c62897 100644 +--- a/openmp/README.rst ++++ b/openmp/README.rst +@@ -137,7 +137,7 @@ Options for all Libraries + Options for ``libomp`` + ---------------------- + +-**LIBOMP_ARCH** = ``aarch64|arm|i386|mic|mips|mips64|ppc64|ppc64le|x86_64|riscv64`` ++**LIBOMP_ARCH** = ``aarch64|arm|i386|mic|mips|mips64|ppc64|ppc64le|x86_64|riscv64|loongarch64`` + The default value for this option is chosen based on probing the compiler for + architecture macros (e.g., is ``__x86_64__`` predefined by compiler?). + +@@ -194,7 +194,7 @@ Optional Features + **LIBOMP_OMPT_SUPPORT** = ``ON|OFF`` + Include support for the OpenMP Tools Interface (OMPT). + This option is supported and ``ON`` by default for x86, x86_64, AArch64, +- PPC64 and RISCV64 on Linux* and macOS*. ++ PPC64, RISCV64 and loongarch64 on Linux* and macOS*. + This option is ``OFF`` if this feature is not supported for the platform. + + **LIBOMP_OMPT_OPTIONAL** = ``ON|OFF`` +diff --git a/openmp/runtime/CMakeLists.txt b/openmp/runtime/CMakeLists.txt +index c9dbcb2ab..31995363a 100644 +--- a/openmp/runtime/CMakeLists.txt ++++ b/openmp/runtime/CMakeLists.txt +@@ -30,7 +30,7 @@ if(${OPENMP_STANDALONE_BUILD}) + # If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake + libomp_get_architecture(LIBOMP_DETECTED_ARCH) + set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING +- "The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic/mips/mips64/riscv64).") ++ "The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic/mips/mips64/riscv64/loongarch64).") + # Should assertions be enabled? They are on by default. + set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL + "enable assertions?") +@@ -61,6 +61,8 @@ else() # Part of LLVM build + set(LIBOMP_ARCH arm) + elseif(LIBOMP_NATIVE_ARCH MATCHES "riscv64") + set(LIBOMP_ARCH riscv64) ++ elseif(LIBOMP_NATIVE_ARCH MATCHES "loongarch64") ++ set(LIBOMP_ARCH loongarch64) + else() + # last ditch effort + libomp_get_architecture(LIBOMP_ARCH) +@@ -81,7 +83,7 @@ if(LIBOMP_ARCH STREQUAL "aarch64") + endif() + endif() + +-libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 aarch64_a64fx mic mips mips64 riscv64) ++libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 aarch64_a64fx mic mips mips64 riscv64 loongarch64) + + set(LIBOMP_LIB_TYPE normal CACHE STRING + "Performance,Profiling,Stubs library (normal/profile/stubs)") +@@ -159,6 +161,7 @@ set(MIC FALSE) + set(MIPS64 FALSE) + set(MIPS FALSE) + set(RISCV64 FALSE) ++set(LoongArch64 FALSE) + if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture + set(IA32 TRUE) + elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture +@@ -183,6 +186,8 @@ elseif("${LIBOMP_ARCH}" STREQUAL "mips64") # MIPS64 architecture + set(MIPS64 TRUE) + elseif("${LIBOMP_ARCH}" STREQUAL "riscv64") # RISCV64 architecture + set(RISCV64 TRUE) ++elseif("${LIBOMP_ARCH}" STREQUAL "loongarch64") # LoongArch64 architecture ++ set(LoongArch64 TRUE) + endif() + + # Set some flags based on build_type +diff --git a/openmp/runtime/README.txt b/openmp/runtime/README.txt +index 874a5634e..ddd8b0e42 100644 +--- a/openmp/runtime/README.txt ++++ b/openmp/runtime/README.txt +@@ -54,6 +54,7 @@ Architectures Supported + * IBM(R) Power architecture (little endian) + * MIPS and MIPS64 architecture + * RISCV64 architecture ++* LoongArch64 architecture + + Supported RTL Build Configurations + ================================== +diff --git a/openmp/runtime/cmake/LibompGetArchitecture.cmake b/openmp/runtime/cmake/LibompGetArchitecture.cmake +index dd60a2d34..72cbf64d4 100644 +--- a/openmp/runtime/cmake/LibompGetArchitecture.cmake ++++ b/openmp/runtime/cmake/LibompGetArchitecture.cmake +@@ -47,6 +47,8 @@ function(libomp_get_architecture return_arch) + #error ARCHITECTURE=mips + #elif defined(__riscv) && __riscv_xlen == 64 + #error ARCHITECTURE=riscv64 ++ #elif defined(__loongarch__) && defined(__loongarch64) ++ #error ARCHITECTURE=loongarch64 + #else + #error ARCHITECTURE=UnknownArchitecture + #endif +diff --git a/openmp/runtime/cmake/LibompMicroTests.cmake b/openmp/runtime/cmake/LibompMicroTests.cmake +index 1ca3412ed..d34405673 100644 +--- a/openmp/runtime/cmake/LibompMicroTests.cmake ++++ b/openmp/runtime/cmake/LibompMicroTests.cmake +@@ -214,6 +214,9 @@ else() + elseif(${RISCV64}) + libomp_append(libomp_expected_library_deps libc.so.6) + libomp_append(libomp_expected_library_deps ld.so.1) ++ elseif(${LoongArch64}) ++ libomp_append(libomp_expected_library_deps libc.so.6) ++ libomp_append(libomp_expected_library_deps ld.so.1) + endif() + libomp_append(libomp_expected_library_deps libpthread.so.0 IF_FALSE STUBS_LIBRARY) + libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC) +diff --git a/openmp/runtime/cmake/LibompUtils.cmake b/openmp/runtime/cmake/LibompUtils.cmake +index b1de24237..8d6b6efea 100644 +--- a/openmp/runtime/cmake/LibompUtils.cmake ++++ b/openmp/runtime/cmake/LibompUtils.cmake +@@ -109,6 +109,8 @@ function(libomp_get_legal_arch return_arch_string) + set(${return_arch_string} "MIPS64" PARENT_SCOPE) + elseif(${RISCV64}) + set(${return_arch_string} "RISCV64" PARENT_SCOPE) ++ elseif(${LoongArch64}) ++ set(${return_arch_string} "LoongArch64" PARENT_SCOPE) + else() + set(${return_arch_string} "${LIBOMP_ARCH}" PARENT_SCOPE) + libomp_warning_say("libomp_get_legal_arch(): Warning: Unknown architecture: Using ${LIBOMP_ARCH}") +diff --git a/openmp/runtime/src/kmp_affinity.h b/openmp/runtime/src/kmp_affinity.h +index ce00362f0..06fd323a5 100644 +--- a/openmp/runtime/src/kmp_affinity.h ++++ b/openmp/runtime/src/kmp_affinity.h +@@ -254,6 +254,18 @@ public: + #elif __NR_sched_getaffinity != 5196 + #error Wrong code for getaffinity system call. + #endif /* __NR_sched_getaffinity */ ++#elif KMP_ARCH_LOONGARCH64 ++#ifndef __NR_sched_setaffinity ++#define __NR_sched_setaffinity 122 ++#elif __NR_sched_setaffinity != 122 ++#error Wrong code for setaffinity system call. ++#endif /* __NR_sched_setaffinity */ ++#ifndef __NR_sched_getaffinity ++#define __NR_sched_getaffinity 123 ++#elif __NR_sched_getaffinity != 123 ++#error Wrong code for getaffinity system call. ++#endif /* __NR_sched_getaffinity */ ++#else + #error Unknown or unsupported architecture + #endif /* KMP_ARCH_* */ + #elif KMP_OS_FREEBSD +diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp +index c932d450c..ba25d2e16 100644 +--- a/openmp/runtime/src/kmp_csupport.cpp ++++ b/openmp/runtime/src/kmp_csupport.cpp +@@ -700,7 +700,7 @@ void __kmpc_flush(ident_t *loc) { + } + #endif // KMP_MIC + #elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64 || \ +- KMP_ARCH_RISCV64) ++ KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64) + // Nothing to see here move along + #elif KMP_ARCH_PPC64 + // Nothing needed here (we have a real MB above). +diff --git a/openmp/runtime/src/kmp_os.h b/openmp/runtime/src/kmp_os.h +index 02efaa1b2..f1d24962a 100644 +--- a/openmp/runtime/src/kmp_os.h ++++ b/openmp/runtime/src/kmp_os.h +@@ -178,7 +178,7 @@ typedef unsigned long long kmp_uint64; + #if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS + #define KMP_SIZE_T_SPEC KMP_UINT32_SPEC + #elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ +- KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 ++ KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 + #define KMP_SIZE_T_SPEC KMP_UINT64_SPEC + #else + #error "Can't determine size_t printf format specifier." +@@ -1044,7 +1044,7 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v); + #endif /* KMP_OS_WINDOWS */ + + #if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || \ +- KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 ++ KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 + #if KMP_OS_WINDOWS + #undef KMP_MB + #define KMP_MB() std::atomic_thread_fence(std::memory_order_seq_cst) +diff --git a/openmp/runtime/src/kmp_platform.h b/openmp/runtime/src/kmp_platform.h +index bbbd72dd6..6392d17b1 100644 +--- a/openmp/runtime/src/kmp_platform.h ++++ b/openmp/runtime/src/kmp_platform.h +@@ -92,6 +92,7 @@ + #define KMP_ARCH_MIPS 0 + #define KMP_ARCH_MIPS64 0 + #define KMP_ARCH_RISCV64 0 ++#define KMP_ARCH_LOONGARCH64 0 + + #if KMP_OS_WINDOWS + #if defined(_M_AMD64) || defined(__x86_64) +@@ -135,6 +136,9 @@ + #elif defined __riscv && __riscv_xlen == 64 + #undef KMP_ARCH_RISCV64 + #define KMP_ARCH_RISCV64 1 ++#elif defined __loongarch__ && defined __loongarch64 ++#undef KMP_ARCH_LOONGARCH64 ++#define KMP_ARCH_LOONGARCH64 1 + #endif + #endif + +@@ -199,7 +203,7 @@ + // TODO: Fixme - This is clever, but really fugly + #if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + \ + KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64 + \ +- KMP_ARCH_RISCV64) ++ KMP_ARCH_RISCV64 + KMP_ARCH_LOONGARCH64) + #error Unknown or unsupported architecture + #endif + +diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp +index b8d470528..3895ece65 100644 +--- a/openmp/runtime/src/kmp_runtime.cpp ++++ b/openmp/runtime/src/kmp_runtime.cpp +@@ -8751,7 +8751,7 @@ __kmp_determine_reduction_method( + int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED; + + #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ +- KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 ++ KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 + + #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ + KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD +diff --git a/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h b/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h +index a452b7643..d6d2cb085 100644 +--- a/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h ++++ b/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h +@@ -162,6 +162,10 @@ + #define ITT_ARCH_ARM64 6 + #endif /* ITT_ARCH_ARM64 */ + ++#ifndef ITT_ARCH_LOONGARCH64 ++#define ITT_ARCH_LOONGARCH64 7 ++#endif /* ITT_ARCH_LOONGARCH64 */ ++ + #ifndef ITT_ARCH + #if defined _M_IX86 || defined __i386__ + #define ITT_ARCH ITT_ARCH_IA32 +@@ -175,6 +179,8 @@ + #define ITT_ARCH ITT_ARCH_ARM64 + #elif defined __powerpc64__ + #define ITT_ARCH ITT_ARCH_PPC64 ++#elif defined __loongarch__ && defined __loongarch64 ++#define ITT_ARCH ITT_ARCH_LOONGARCH64 + #endif + #endif + +diff --git a/openmp/runtime/src/z_Linux_asm.S b/openmp/runtime/src/z_Linux_asm.S +index b4a45c1ac..4f80a810c 100644 +--- a/openmp/runtime/src/z_Linux_asm.S ++++ b/openmp/runtime/src/z_Linux_asm.S +@@ -1725,6 +1725,157 @@ __kmp_invoke_microtask: + + #endif /* KMP_ARCH_RISCV64 */ + ++#if KMP_ARCH_LOONGARCH64 ++ ++//------------------------------------------------------------------------ ++// ++// typedef void (*microtask_t)( int *gtid, int *tid, ... ); ++// ++// int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int tid, int argc, ++// void *p_argv[] ++// #if OMPT_SUPPORT ++// , ++// void **exit_frame_ptr ++// #endif ++// ) { ++// #if OMPT_SUPPORT ++// *exit_frame_ptr = OMPT_GET_FRAME_ADDRESS(0); ++// #endif ++// (*pkfn)( & gtid, & tid, argv[0], ... ); ++// ++// return 1; ++// } ++// ++// parameters: ++// a0: pkfn ++// a1: gtid ++// a2: tid ++// a3: argc ++// a4: p_argv ++// a5: exit_frame_ptr ++// ++// Temp. registers: ++// ++// t0: used to calculate the dynamic stack size / used to hold pkfn address ++// t1: used as temporary for stack placement calculation ++// t2: used as temporary for stack arguments ++// t3: used as temporary for number of remaining pkfn parms ++// t4: used to traverse p_argv array ++// ++// return: a0 (always 1/TRUE) ++// ++ ++// -- Begin __kmp_invoke_microtask ++// mark_begin; ++ .text ++ .globl __kmp_invoke_microtask ++ .p2align 3 ++ .type __kmp_invoke_microtask,@function ++__kmp_invoke_microtask: ++ ++ // First, save ra and fp ++ addi.d $sp, $sp, -16 ++ st.d $ra, $sp, 8 ++ st.d $fp, $sp, 0 ++ addi.d $fp, $sp, 16 ++ ++ // Compute the dynamic stack size: ++ // ++ // - We need 8 bytes for storing 'gtid' and 'tid', so we can pass them by ++ // reference ++ // - We need 8 bytes for each argument that cannot be passed to the 'pkfn' ++ // function by register. Given that we have 8 of such registers (a[0-7]) ++ // and two + 'argc' arguments (consider >id and &tid), we need to ++ // reserve max(0, argc - 6)*8 ext$ra bytes ++ // ++ // The total number of bytes is then max(0, argc - 6)*8 + 8 ++ ++ // Compute max(0, argc - 6) using the following bithack: ++ // max(0, x) = x - (x & (x >> 31?63)), where x := argc - 6 ++ // Source: http://g$raphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax ++ addi.d $t0, $a3, -6 ++ srai.d $t1, $t0, 63 ++ and $t1, $t0, $t1 ++ sub.d $t0, $t0, $t1 ++ ++ addi.d $t0, $t0, 1 ++ ++ slli.d $t0, $t0, 3 // t0: total number of bytes for stack storing arguments. ++ sub.d $sp, $sp, $t0 ++ ++ move $t0, $a0 ++ move $t3, $a3 ++ move $t4, $a4 ++ ++#if OMPT_SUPPORT ++ // Save frame pointer into exit_frame ++ st.d $fp, $a5, 0 ++#endif ++ ++ // Prepare arguments for the pkfn function (first 8 using $a0-$a7 registers) ++ ++ st.w $a1, $fp, -20 // gtid ++ st.w $a2, $fp, -24 // tid ++ ++ addi.d $a0, $fp, -20 // >id ++ addi.d $a1, $fp, -24 // &tid ++ ++ beqz $t3, .L_kmp_3 ++ ld.d $a2, $t4, 0 // argv[0] ++ ++ addi.d $t3, $t3, -1 ++ beqz $t3, .L_kmp_3 ++ ld.d $a3, $t4, 8 // argv[1] ++ ++ addi.d $t3, $t3, -1 ++ beqz $t3, .L_kmp_3 ++ ld.d $a4, $t4, 16 // argv[2] ++ ++ addi.d $t3, $t3, -1 ++ beqz $t3, .L_kmp_3 ++ ld.d $a5, $t4, 24 // argv[3] ++ ++ addi.d $t3, $t3, -1 ++ beqz $t3, .L_kmp_3 ++ ld.d $a6, $t4, 32 // argv[4] ++ ++ addi.d $t3, $t3, -1 ++ beqz $t3, .L_kmp_3 ++ ld.d $a7, $t4, 40 // argv[5] ++ ++ // Prepare any additional argument passed through the stack ++ addi.d $t4, $t4, 48 ++ move $t1, $sp ++ b .L_kmp_2 ++.L_kmp_1: ++ ld.d $t2, $t4, 0 ++ st.d $t2, $t1, 0 ++ addi.d $t4, $t4, 8 ++ addi.d $t1, $t1, 8 ++.L_kmp_2: ++ addi.d $t3, $t3, -1 ++ bnez $t3, .L_kmp_1 ++ ++.L_kmp_3: ++ // Call pkfn function ++ jirl $ra, $t0, 0 ++ ++ // Restore stack and return ++ ++ addi.d $a0, $zero, 1 ++ ++ addi.d $sp, $fp, -16 ++ ld.d $fp, $sp, 0 ++ ld.d $ra, $sp, 8 ++ addi.d $sp, $sp, 16 ++ jr $ra ++.Lfunc_end0: ++ .size __kmp_invoke_microtask, .Lfunc_end0-__kmp_invoke_microtask ++ ++// -- End __kmp_invoke_microtask ++ ++#endif /* KMP_ARCH_LOONGARCH64 */ ++ + #if KMP_ARCH_ARM || KMP_ARCH_MIPS + .data + .comm .gomp_critical_user_,32,8 +@@ -1736,7 +1887,8 @@ __kmp_unnamed_critical_addr: + .size __kmp_unnamed_critical_addr,4 + #endif /* KMP_ARCH_ARM */ + +-#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 ++#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || \ ++ KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 + #ifndef KMP_PREFIX_UNDERSCORE + # define KMP_PREFIX_UNDERSCORE(x) x + #endif +@@ -1751,7 +1903,7 @@ KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr): + .size KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr),8 + #endif + #endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || +- KMP_ARCH_RISCV64 */ ++ KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 */ + + #if KMP_OS_LINUX + # if KMP_ARCH_ARM +diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp +index 91edf0254..2a0154ee8 100644 +--- a/openmp/runtime/src/z_Linux_util.cpp ++++ b/openmp/runtime/src/z_Linux_util.cpp +@@ -2447,7 +2447,7 @@ finish: // Clean up and exit. + + #if !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_MIC || \ + ((KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64) || \ +- KMP_ARCH_PPC64 || KMP_ARCH_RISCV64) ++ KMP_ARCH_PPC64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64) + + // we really only need the case with 1 argument, because CLANG always build + // a struct of pointers to shared variables referenced in the outlined function +diff --git a/openmp/runtime/tools/lib/Platform.pm b/openmp/runtime/tools/lib/Platform.pm +index 38593a154..2d262ae69 100644 +--- a/openmp/runtime/tools/lib/Platform.pm ++++ b/openmp/runtime/tools/lib/Platform.pm +@@ -63,6 +63,8 @@ sub canon_arch($) { + $arch = "mips"; + } elsif ( $arch =~ m{\Ariscv64} ) { + $arch = "riscv64"; ++ } elsif ( $arch =~ m{\Aloongarch64} ) { ++ $arch = "loongarch64"; + } else { + $arch = undef; + }; # if +@@ -97,6 +99,7 @@ sub canon_mic_arch($) { + "mips" => "MIPS", + "mips64" => "MIPS64", + "riscv64" => "RISC-V (64-bit)", ++ "loongarch64" => "LoongArch64", + ); + + sub legal_arch($) { +@@ -119,6 +122,7 @@ sub canon_mic_arch($) { + "mic" => "intel64", + "mips" => "mips", + "mips64" => "MIPS64", ++ "loongarch64" => "loongarch64", + ); + + sub arch_opt($) { +@@ -225,6 +229,8 @@ sub target_options() { + $_host_arch = "mips"; + } elsif ( $hardware_platform eq "riscv64" ) { + $_host_arch = "riscv64"; ++ } elsif ( $hardware_platform eq "loongarch64" ) { ++ $_host_arch = "loongarch64"; + } else { + die "Unsupported host hardware platform: \"$hardware_platform\"; stopped"; + }; # if +@@ -414,7 +420,7 @@ the script assumes host architecture is target one. + + Input string is an architecture name to canonize. The function recognizes many variants, for example: + C<32e>, C, C, etc. Returned string is a canonized architecture name, +-one of: C<32>, C<32e>, C<64>, C, C, C, C, C, C, C or C is input string is not recognized. ++one of: C<32>, C<32e>, C<64>, C, C, C, C, C, C, C, C or C is input string is not recognized. + + =item B + +diff --git a/openmp/runtime/tools/lib/Uname.pm b/openmp/runtime/tools/lib/Uname.pm +index 99fe1cdbf..8a976addc 100644 +--- a/openmp/runtime/tools/lib/Uname.pm ++++ b/openmp/runtime/tools/lib/Uname.pm +@@ -158,6 +158,8 @@ if ( 0 ) { + $values{ hardware_platform } = "mips"; + } elsif ( $values{ machine } =~ m{\Ariscv64\z} ) { + $values{ hardware_platform } = "riscv64"; ++ } elsif ( $values{ machine } =~ m{\Aloongarch64\z} ) { ++ $values{ hardware_platform } = "loongarch64"; + } else { + die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped"; + }; # if diff --git a/libomp.spec b/libomp.spec index b43dac9..49bc60c 100644 --- a/libomp.spec +++ b/libomp.spec @@ -1,3 +1,4 @@ +%define anolis_release .0.1 %global maj_ver 16 %global libomp_version %{maj_ver}.0.6 #global rc_ver 4 @@ -19,7 +20,7 @@ Name: libomp Version: %{libomp_version}%{?rc_ver:~rc%{rc_ver}} -Release: 3%{?dist} +Release: 3%{anolis_release}%{?dist} Summary: OpenMP runtime for clang License: NCSA @@ -32,6 +33,8 @@ Source4: lit.fedora.cfg.py Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libomp_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz Source6: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libomp_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz.sig +Patch0: 0001-Support-LoongArch.patch + BuildRequires: clang # For clang-offload-packager BuildRequires: clang-tools-extra @@ -105,6 +108,10 @@ cd %{_vpath_builddir} %cmake .. -GNinja \ -DLIBOMP_INSTALL_ALIASES=OFF \ +%ifarch loongarch64 + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ +%endif -DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \ -DLLVM_DIR=%{_libdir}/cmake/llvm \ -DCMAKE_INSTALL_INCLUDEDIR=%{_libdir}/clang/%{maj_ver}/include \ @@ -163,6 +170,7 @@ cd %{_vpath_builddir} %files %license LICENSE.TXT %{_libdir}/libomp.so +%ifnarch loongarch64 %{_libdir}/libompd.so %ifnarch %{arm} %{_libdir}/libarcher.so @@ -175,18 +183,20 @@ cd %{_vpath_builddir} %{_libdir}/libomptarget.rtl.cuda.nextgen.so.%{maj_ver} %{_libdir}/libomptarget.rtl.%{libomp_arch}.so.%{maj_ver} %{_libdir}/libomptarget.rtl.%{libomp_arch}.nextgen.so.%{maj_ver} +%endif %{_libdir}/libomptarget.so.%{maj_ver} %endif %files devel %{_libdir}/clang/%{maj_ver}/include/omp.h %{_libdir}/cmake/openmp/FindOpenMPTarget.cmake -%ifnarch %{arm} +%ifnarch %{arm} loongarch64 %{_libdir}/clang/%{maj_ver}/include/omp-tools.h %{_libdir}/clang/%{maj_ver}/include/ompt.h %{_libdir}/clang/%{maj_ver}/include/ompt-multiplex.h %endif %ifnarch %{ix86} %{arm} +%ifnarch loongarch64 # libomptarget is not supported on 32-bit systems. %{_libdir}/libomptarget.rtl.amdgpu.so %{_libdir}/libomptarget.rtl.amdgpu.nextgen.so @@ -194,6 +204,7 @@ cd %{_vpath_builddir} %{_libdir}/libomptarget.rtl.cuda.nextgen.so %{_libdir}/libomptarget.rtl.%{libomp_arch}.so %{_libdir}/libomptarget.rtl.%{libomp_arch}.nextgen.so +%endif %{_libdir}/libomptarget.devicertl.a %{_libdir}/libomptarget-amdgpu-*.bc %{_libdir}/libomptarget-nvptx-*.bc @@ -207,6 +218,9 @@ cd %{_vpath_builddir} %endif %changelog +* Tue Feb 20 2024 Chen Li - 16.0.6-3.0.1 +- Support LoongArch + * Sat Jul 15 2023 Tom Stellard - 16.0.6-3 - Remove duplicated installed binaries -- Gitee