Date: Wed, 23 Oct 2019 17:53:15 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353954 - in vendor/llvm-openmp/dist/runtime/src: . thirdparty/ittnotify Message-ID: <201910231753.x9NHrFQR078722@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Wed Oct 23 17:53:14 2019 New Revision: 353954 URL: https://svnweb.freebsd.org/changeset/base/353954 Log: Vendor import of stripped LLVM openmp trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/openmp/trunk@375505 Added: vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_static.cpp Deleted: vendor/llvm-openmp/dist/runtime/src/kmp_taskq.cpp vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_static.c Modified: vendor/llvm-openmp/dist/runtime/src/kmp.h vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp vendor/llvm-openmp/dist/runtime/src/kmp_lock.h vendor/llvm-openmp/dist/runtime/src/kmp_os.h vendor/llvm-openmp/dist/runtime/src/kmp_platform.h vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp vendor/llvm-openmp/dist/runtime/src/kmp_wait_release.h vendor/llvm-openmp/dist/runtime/src/ompt-general.cpp vendor/llvm-openmp/dist/runtime/src/ompt-internal.h vendor/llvm-openmp/dist/runtime/src/ompt-specific.cpp vendor/llvm-openmp/dist/runtime/src/ompt-specific.h vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_config.h vendor/llvm-openmp/dist/runtime/src/z_Linux_asm.S vendor/llvm-openmp/dist/runtime/src/z_Linux_util.cpp Modified: vendor/llvm-openmp/dist/runtime/src/kmp.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp.h Wed Oct 23 17:53:14 2019 (r353954) @@ -2181,10 +2181,9 @@ struct kmp_dephash_entry { typedef struct kmp_dephash { kmp_dephash_entry_t **buckets; size_t size; -#ifdef KMP_DEBUG + size_t generation; kmp_uint32 nelements; kmp_uint32 nconflicts; -#endif } kmp_dephash_t; typedef struct kmp_task_affinity_info { @@ -3342,7 +3341,7 @@ extern int __kmp_aux_set_affinity_mask_proc(int proc, extern int __kmp_aux_unset_affinity_mask_proc(int proc, void **mask); extern int __kmp_aux_get_affinity_mask_proc(int proc, void **mask); extern void __kmp_balanced_affinity(kmp_info_t *th, int team_size); -#if KMP_OS_LINUX +#if KMP_OS_LINUX || KMP_OS_FREEBSD extern int kmp_set_thread_affinity_mask_initial(void); #endif #endif /* KMP_AFFINITY_SUPPORTED */ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -1968,7 +1968,7 @@ static void __kmp_dispatch_set_hierarchy_values() { __kmp_hier_max_units[kmp_hier_layer_e::LAYER_THREAD + 1] = nPackages * nCoresPerPkg * __kmp_nThreadsPerCore; __kmp_hier_max_units[kmp_hier_layer_e::LAYER_L1 + 1] = __kmp_ncores; -#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) +#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS) if (__kmp_mic_type >= mic3) __kmp_hier_max_units[kmp_hier_layer_e::LAYER_L2 + 1] = __kmp_ncores / 2; else @@ -1982,7 +1982,7 @@ static void __kmp_dispatch_set_hierarchy_values() { __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_THREAD + 1] = 1; __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_L1 + 1] = __kmp_nThreadsPerCore; -#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) +#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS) if (__kmp_mic_type >= mic3) __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_L2 + 1] = 2 * __kmp_nThreadsPerCore; Modified: vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h Wed Oct 23 17:53:14 2019 (r353954) @@ -160,6 +160,7 @@ class KMPHwlocAffinity : public KMPAffinity { (public) }; #endif /* KMP_USE_HWLOC */ +#if KMP_OS_LINUX || KMP_OS_FREEBSD #if KMP_OS_LINUX /* On some of the older OS's that we build on, these constants aren't present in <asm/unistd.h> #included from <sys.syscall.h>. They must be the same on @@ -234,6 +235,10 @@ class KMPHwlocAffinity : public KMPAffinity { (public) #endif /* __NR_sched_getaffinity */ #error Unknown or unsupported architecture #endif /* KMP_ARCH_* */ +#elif KMP_OS_FREEBSD +#include <pthread.h> +#include <pthread_np.h> +#endif class KMPNativeAffinity : public KMPAffinity { class Mask : public KMPAffinity::Mask { typedef unsigned char mask_t; @@ -294,8 +299,13 @@ class KMPNativeAffinity : public KMPAffinity { int get_system_affinity(bool abort_on_error) override { KMP_ASSERT2(KMP_AFFINITY_CAPABLE(), "Illegal get affinity operation when not capable"); +#if KMP_OS_LINUX int retval = syscall(__NR_sched_getaffinity, 0, __kmp_affin_mask_size, mask); +#elif KMP_OS_FREEBSD + int retval = + pthread_getaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast<cpuset_t *>(mask)); +#endif if (retval >= 0) { return 0; } @@ -308,8 +318,13 @@ class KMPNativeAffinity : public KMPAffinity { int set_system_affinity(bool abort_on_error) const override { KMP_ASSERT2(KMP_AFFINITY_CAPABLE(), "Illegal get affinity operation when not capable"); +#if KMP_OS_LINUX int retval = syscall(__NR_sched_setaffinity, 0, __kmp_affin_mask_size, mask); +#elif KMP_OS_FREEBSD + int retval = + pthread_setaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast<cpuset_t *>(mask)); +#endif if (retval >= 0) { return 0; } @@ -347,7 +362,7 @@ class KMPNativeAffinity : public KMPAffinity { } api_type get_api_type() const override { return NATIVE_OS; } }; -#endif /* KMP_OS_LINUX */ +#endif /* KMP_OS_LINUX || KMP_OS_FREEBSD */ #if KMP_OS_WINDOWS class KMPNativeAffinity : public KMPAffinity { Modified: vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -545,7 +545,8 @@ void __kmpc_end_serialized_parallel(ident_t *loc, kmp_ if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( &(serial_team->t.ompt_team_info.parallel_data), parent_task_data, - ompt_parallel_invoker_program, OMPT_LOAD_RETURN_ADDRESS(global_tid)); + ompt_parallel_invoker_program | ompt_parallel_team, + OMPT_LOAD_RETURN_ADDRESS(global_tid)); } __ompt_lw_taskteam_unlink(this_thr); this_thr->th.ompt_thread_info.state = ompt_state_overhead; @@ -676,7 +677,8 @@ void __kmpc_flush(ident_t *loc) { #endif // KMP_COMPILER_ICC } #endif // KMP_MIC -#elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64) +#elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64 || \ + KMP_ARCH_RISCV64) // Nothing to see here move along #elif KMP_ARCH_PPC64 // Nothing needed here (we have a real MB above). Modified: vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h Wed Oct 23 17:53:14 2019 (r353954) @@ -633,5 +633,25 @@ GOMP_loop_ull_doacross_guided_start #define KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START \ GOMP_loop_ull_doacross_runtime_start +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT \ + GOMP_loop_nonmonotonic_dynamic_next +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START \ + GOMP_loop_nonmonotonic_dynamic_start +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT \ + GOMP_loop_nonmonotonic_guided_next +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START \ + GOMP_loop_nonmonotonic_guided_start +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT \ + GOMP_loop_ull_nonmonotonic_dynamic_next +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START \ + GOMP_loop_ull_nonmonotonic_dynamic_start +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT \ + GOMP_loop_ull_nonmonotonic_guided_next +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START \ + GOMP_loop_ull_nonmonotonic_guided_start +#define KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC \ + GOMP_parallel_loop_nonmonotonic_dynamic +#define KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED \ + GOMP_parallel_loop_nonmonotonic_guided #endif /* KMP_FTN_OS_H */ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -431,7 +431,7 @@ std::atomic<int> __kmp_thread_pool_active_nth = ATOMIC /* ------------------------------------------------- * GLOBAL/ROOT STATE */ KMP_ALIGN_CACHE -kmp_global_t __kmp_global = {{0}}; +kmp_global_t __kmp_global; /* ----------------------------------------------- */ /* GLOBAL SYNCHRONIZATION LOCKS */ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -22,7 +22,7 @@ extern "C" { #endif // __cplusplus #define MKLOC(loc, routine) \ - static ident_t(loc) = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;"}; + static ident_t loc = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;"}; #include "kmp_ftn_os.h" @@ -622,10 +622,16 @@ LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STAT LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT), {}) LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START), kmp_sch_dynamic_chunked) +LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START), + kmp_sch_dynamic_chunked) LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT), {}) +LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT), {}) LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_START), kmp_sch_guided_chunked) +LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START), + kmp_sch_guided_chunked) LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT), {}) +LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT), {}) LOOP_RUNTIME_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_START), kmp_sch_runtime) LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT), {}) @@ -892,6 +898,16 @@ LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_U LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START), kmp_sch_guided_chunked) LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT), {}) +LOOP_START_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START), + kmp_sch_dynamic_chunked) +LOOP_NEXT_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT), {}) +LOOP_START_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START), + kmp_sch_guided_chunked) +LOOP_NEXT_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT), {}) LOOP_RUNTIME_START_ULL( KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START), kmp_sch_runtime) LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT), {}) @@ -1487,6 +1503,12 @@ PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALL kmp_sch_static, OMPT_LOOP_PRE, OMPT_LOOP_POST) PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC), kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) +PARALLEL_LOOP( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED), + kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) +PARALLEL_LOOP( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC), + kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED), kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME), @@ -1941,6 +1963,26 @@ KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, 45, "GOMP_4.5"); KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED, 45, "GOMP_4.5"); #endif // KMP_USE_VERSION_SYMBOLS Modified: vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -2943,10 +2943,10 @@ static int (*direct_test_check[])(kmp_dyna_lock_t *, k #undef expand // Exposes only one set of jump tables (*lock or *lock_with_checks). -void (*(*__kmp_direct_destroy))(kmp_dyna_lock_t *) = 0; -int (*(*__kmp_direct_set))(kmp_dyna_lock_t *, kmp_int32) = 0; -int (*(*__kmp_direct_unset))(kmp_dyna_lock_t *, kmp_int32) = 0; -int (*(*__kmp_direct_test))(kmp_dyna_lock_t *, kmp_int32) = 0; +void (**__kmp_direct_destroy)(kmp_dyna_lock_t *) = 0; +int (**__kmp_direct_set)(kmp_dyna_lock_t *, kmp_int32) = 0; +int (**__kmp_direct_unset)(kmp_dyna_lock_t *, kmp_int32) = 0; +int (**__kmp_direct_test)(kmp_dyna_lock_t *, kmp_int32) = 0; // Jump tables for the indirect lock functions #define expand(l, op) (void (*)(kmp_user_lock_p)) __kmp_##op##_##l##_##lock, @@ -2993,10 +2993,10 @@ static int (*indirect_test_check[])(kmp_user_lock_p, k #undef expand // Exposes only one jump tables (*lock or *lock_with_checks). -void (*(*__kmp_indirect_destroy))(kmp_user_lock_p) = 0; -int (*(*__kmp_indirect_set))(kmp_user_lock_p, kmp_int32) = 0; -int (*(*__kmp_indirect_unset))(kmp_user_lock_p, kmp_int32) = 0; -int (*(*__kmp_indirect_test))(kmp_user_lock_p, kmp_int32) = 0; +void (**__kmp_indirect_destroy)(kmp_user_lock_p) = 0; +int (**__kmp_indirect_set)(kmp_user_lock_p, kmp_int32) = 0; +int (**__kmp_indirect_unset)(kmp_user_lock_p, kmp_int32) = 0; +int (**__kmp_indirect_test)(kmp_user_lock_p, kmp_int32) = 0; // Lock index table. kmp_indirect_lock_table_t __kmp_i_lock_table; Modified: vendor/llvm-openmp/dist/runtime/src/kmp_lock.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_lock.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_lock.h Wed Oct 23 17:53:14 2019 (r353954) @@ -1122,18 +1122,18 @@ typedef struct { // Function tables for direct locks. Set/unset/test differentiate functions // with/without consistency checking. extern void (*__kmp_direct_init[])(kmp_dyna_lock_t *, kmp_dyna_lockseq_t); -extern void (*(*__kmp_direct_destroy))(kmp_dyna_lock_t *); -extern int (*(*__kmp_direct_set))(kmp_dyna_lock_t *, kmp_int32); -extern int (*(*__kmp_direct_unset))(kmp_dyna_lock_t *, kmp_int32); -extern int (*(*__kmp_direct_test))(kmp_dyna_lock_t *, kmp_int32); +extern void (**__kmp_direct_destroy)(kmp_dyna_lock_t *); +extern int (**__kmp_direct_set)(kmp_dyna_lock_t *, kmp_int32); +extern int (**__kmp_direct_unset)(kmp_dyna_lock_t *, kmp_int32); +extern int (**__kmp_direct_test)(kmp_dyna_lock_t *, kmp_int32); // Function tables for indirect locks. Set/unset/test differentiate functions // with/withuot consistency checking. extern void (*__kmp_indirect_init[])(kmp_user_lock_p); -extern void (*(*__kmp_indirect_destroy))(kmp_user_lock_p); -extern int (*(*__kmp_indirect_set))(kmp_user_lock_p, kmp_int32); -extern int (*(*__kmp_indirect_unset))(kmp_user_lock_p, kmp_int32); -extern int (*(*__kmp_indirect_test))(kmp_user_lock_p, kmp_int32); +extern void (**__kmp_indirect_destroy)(kmp_user_lock_p); +extern int (**__kmp_indirect_set)(kmp_user_lock_p, kmp_int32); +extern int (**__kmp_indirect_unset)(kmp_user_lock_p, kmp_int32); +extern int (**__kmp_indirect_test)(kmp_user_lock_p, kmp_int32); // Extracts direct lock tag from a user lock pointer #define KMP_EXTRACT_D_TAG(l) \ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_os.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_os.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_os.h Wed Oct 23 17:53:14 2019 (r353954) @@ -69,7 +69,7 @@ #error Unknown compiler #endif -#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK +#if (KMP_OS_LINUX || KMP_OS_WINDOWS || KMP_OS_FREEBSD) && !KMP_OS_CNK #define KMP_AFFINITY_SUPPORTED 1 #if KMP_OS_WINDOWS && KMP_ARCH_X86_64 #define KMP_GROUP_AFFINITY 1 @@ -165,7 +165,8 @@ 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 +#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ + KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 #define KMP_SIZE_T_SPEC KMP_UINT64_SPEC #else #error "Can't determine size_t printf format specifier." @@ -840,7 +841,7 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real6 #endif /* KMP_OS_WINDOWS */ #if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || \ - KMP_ARCH_MIPS64 + KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 #define KMP_MB() __sync_synchronize() #endif Modified: vendor/llvm-openmp/dist/runtime/src/kmp_platform.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_platform.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_platform.h Wed Oct 23 17:53:14 2019 (r353954) @@ -98,6 +98,7 @@ #define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE) #define KMP_ARCH_MIPS 0 #define KMP_ARCH_MIPS64 0 +#define KMP_ARCH_RISCV64 0 #if KMP_OS_WINDOWS #if defined(_M_AMD64) || defined(__x86_64) @@ -135,6 +136,9 @@ #undef KMP_ARCH_MIPS #define KMP_ARCH_MIPS 1 #endif +#elif defined __riscv && __riscv_xlen == 64 +#undef KMP_ARCH_RISCV64 +#define KMP_ARCH_RISCV64 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_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64 + KMP_ARCH_RISCV64) #error Unknown or unsupported architecture #endif Modified: vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -1190,8 +1190,8 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 ompt_callbacks.ompt_callback(ompt_callback_parallel_begin)( &(parent_task_info->task_data), &(parent_task_info->frame), - &ompt_parallel_data, team_size, ompt_parallel_invoker_program, - codeptr); + &ompt_parallel_data, team_size, + ompt_parallel_invoker_program | ompt_parallel_team, codeptr); } } #endif // OMPT_SUPPORT @@ -1481,9 +1481,13 @@ int __kmp_fork_call(ident_t *loc, int gtid, int team_size = master_set_numthreads ? master_set_numthreads : get__nproc_2(parent_team, master_tid); + int flags = OMPT_INVOKER(call_context) | + ((microtask == (microtask_t)__kmp_teams_master) + ? ompt_parallel_league + : ompt_parallel_team); ompt_callbacks.ompt_callback(ompt_callback_parallel_begin)( - parent_task_data, ompt_frame, &ompt_parallel_data, team_size, - OMPT_INVOKER(call_context), return_address); + parent_task_data, ompt_frame, &ompt_parallel_data, team_size, flags, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -1512,19 +1516,17 @@ int __kmp_fork_call(ident_t *loc, int gtid, // AC: we are in serialized parallel __kmpc_serialized_parallel(loc, gtid); KMP_DEBUG_ASSERT(parent_team->t.t_serialized > 1); - // AC: need this in order enquiry functions work - // correctly, will restore at join time - parent_team->t.t_serialized--; + #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_lw_taskteam_t lw_taskteam; if (ompt_enabled.enabled) { __ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid, &ompt_parallel_data, return_address); - exit_runtime_p = &(lw_taskteam.ompt_task_info.frame.exit_frame.ptr); + exit_frame_p = &(lw_taskteam.ompt_task_info.frame.exit_frame.ptr); __ompt_lw_taskteam_link(&lw_taskteam, master_th, 0); // don't use lw_taskteam after linking. content was swaped @@ -1532,19 +1534,23 @@ int __kmp_fork_call(ident_t *loc, int gtid, /* OMPT implicit task begin */ implicit_task_data = OMPT_CUR_TASK_DATA(master_th); if (ompt_enabled.ompt_callback_implicit_task) { - ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( - ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), - implicit_task_data, 1, __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? OMPT_CUR_TASK_INFO(master_th) ->thread_num = __kmp_tid_from_gtid(gtid); + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), + implicit_task_data, 1, + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); } /* OMPT state */ master_th->th.ompt_thread_info.state = ompt_state_work_parallel; } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } #endif + // AC: need to decrement t_serialized for enquiry functions to work + // correctly, will restore at join time + parent_team->t.t_serialized--; { KMP_TIME_PARTITIONED_BLOCK(OMP_parallel); @@ -1552,26 +1558,27 @@ int __kmp_fork_call(ident_t *loc, int gtid, __kmp_invoke_microtask(microtask, gtid, 0, argc, parent_team->t.t_argv #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); } #if OMPT_SUPPORT - *exit_runtime_p = NULL; if (ompt_enabled.enabled) { + *exit_frame_p = NULL; OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none; if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, implicit_task_data, 1, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); } + ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); __ompt_lw_taskteam_unlink(master_th); - if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( - OMPT_CUR_TEAM_DATA(master_th), OMPT_CUR_TASK_DATA(master_th), - OMPT_INVOKER(call_context), return_address); + &ompt_parallel_data, OMPT_CUR_TASK_DATA(master_th), + OMPT_INVOKER(call_context) | ompt_parallel_team, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -1586,6 +1593,15 @@ int __kmp_fork_call(ident_t *loc, int gtid, parent_team->t.t_level++; parent_team->t.t_def_allocator = master_th->th.th_def_allocator; // save +#if OMPT_SUPPORT + if (ompt_enabled.enabled) { + ompt_lw_taskteam_t lw_taskteam; + __ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid, + &ompt_parallel_data, return_address); + __ompt_lw_taskteam_link(&lw_taskteam, master_th, 1, true); + } +#endif + /* Change number of threads in the team if requested */ if (master_set_numthreads) { // The parallel has num_threads clause if (master_set_numthreads < master_th->th.th_teams_size.nth) { @@ -1714,7 +1730,7 @@ int __kmp_fork_call(ident_t *loc, int gtid, #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_task_info_t *task_info; ompt_lw_taskteam_t lw_taskteam; @@ -1727,19 +1743,21 @@ int __kmp_fork_call(ident_t *loc, int gtid, // don't use lw_taskteam after linking. content was swaped task_info = OMPT_CUR_TASK_INFO(master_th); - exit_runtime_p = &(task_info->frame.exit_frame.ptr); + exit_frame_p = &(task_info->frame.exit_frame.ptr); if (ompt_enabled.ompt_callback_implicit_task) { - ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( - ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), - &(task_info->task_data), 1, __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? OMPT_CUR_TASK_INFO(master_th) ->thread_num = __kmp_tid_from_gtid(gtid); + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), + &(task_info->task_data), 1, + OMPT_CUR_TASK_INFO(master_th)->thread_num, + ompt_task_implicit); } /* OMPT state */ master_th->th.ompt_thread_info.state = ompt_state_work_parallel; } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } #endif @@ -1750,25 +1768,27 @@ int __kmp_fork_call(ident_t *loc, int gtid, parent_team->t.t_argv #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); } #if OMPT_SUPPORT if (ompt_enabled.enabled) { - exit_runtime_p = NULL; + *exit_frame_p = NULL; if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, &(task_info->task_data), 1, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, + ompt_task_implicit); } - + ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); __ompt_lw_taskteam_unlink(master_th); if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( - OMPT_CUR_TEAM_DATA(master_th), parent_task_data, - OMPT_INVOKER(call_context), return_address); + &ompt_parallel_data, parent_task_data, + OMPT_INVOKER(call_context) | ompt_parallel_team, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -1800,6 +1820,23 @@ int __kmp_fork_call(ident_t *loc, int gtid, team->t.t_level--; // AC: call special invoker for outer "parallel" of teams construct invoker(gtid); +#if OMPT_SUPPORT + if (ompt_enabled.enabled) { + ompt_task_info_t *task_info = OMPT_CUR_TASK_INFO(master_th); + if (ompt_enabled.ompt_callback_implicit_task) { + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_end, NULL, &(task_info->task_data), 0, + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_initial); + } + if (ompt_enabled.ompt_callback_parallel_end) { + ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( + &ompt_parallel_data, parent_task_data, + OMPT_INVOKER(call_context) | ompt_parallel_league, + return_address); + } + master_th->th.ompt_thread_info.state = ompt_state_overhead; + } +#endif } else { argv = args; for (i = argc - 1; i >= 0; --i) @@ -1813,7 +1850,7 @@ int __kmp_fork_call(ident_t *loc, int gtid, #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_task_info_t *task_info; ompt_lw_taskteam_t lw_taskteam; @@ -1824,14 +1861,15 @@ int __kmp_fork_call(ident_t *loc, int gtid, __ompt_lw_taskteam_link(&lw_taskteam, master_th, 0); // don't use lw_taskteam after linking. content was swaped task_info = OMPT_CUR_TASK_INFO(master_th); - exit_runtime_p = &(task_info->frame.exit_frame.ptr); + exit_frame_p = &(task_info->frame.exit_frame.ptr); /* OMPT implicit task begin */ implicit_task_data = OMPT_CUR_TASK_DATA(master_th); if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), - implicit_task_data, 1, __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? + implicit_task_data, 1, __kmp_tid_from_gtid(gtid), + ompt_task_implicit); OMPT_CUR_TASK_INFO(master_th) ->thread_num = __kmp_tid_from_gtid(gtid); } @@ -1839,7 +1877,7 @@ int __kmp_fork_call(ident_t *loc, int gtid, /* OMPT state */ master_th->th.ompt_thread_info.state = ompt_state_work_parallel; } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } #endif @@ -1849,18 +1887,19 @@ int __kmp_fork_call(ident_t *loc, int gtid, __kmp_invoke_microtask(microtask, gtid, 0, argc, args #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); } #if OMPT_SUPPORT if (ompt_enabled.enabled) { - *exit_runtime_p = NULL; + *exit_frame_p = NULL; if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, &(task_info->task_data), 1, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, + ompt_task_implicit); } ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); @@ -1868,7 +1907,8 @@ int __kmp_fork_call(ident_t *loc, int gtid, if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( &ompt_parallel_data, parent_task_data, - OMPT_INVOKER(call_context), return_address); + OMPT_INVOKER(call_context) | ompt_parallel_team, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -2225,12 +2265,11 @@ static inline void __kmp_join_restore_state(kmp_info_t static inline void __kmp_join_ompt(int gtid, kmp_info_t *thread, kmp_team_t *team, ompt_data_t *parallel_data, - fork_context_e fork_context, void *codeptr) { + int flags, void *codeptr) { ompt_task_info_t *task_info = __ompt_get_task_info_object(0); if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( - parallel_data, &(task_info->task_data), OMPT_INVOKER(fork_context), - codeptr); + parallel_data, &(task_info->task_data), flags, codeptr); } task_info->frame.enter_frame = ompt_data_none; @@ -2263,6 +2302,7 @@ void __kmp_join_call(ident_t *loc, int gtid master_th->th.th_ident = loc; #if OMPT_SUPPORT + void *team_microtask = (void *)team->t.t_pkfn; if (ompt_enabled.enabled) { master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -2352,10 +2392,25 @@ void __kmp_join_call(ident_t *loc, int gtid if (master_th->th.th_teams_microtask && !exit_teams && team->t.t_pkfn != (microtask_t)__kmp_teams_master && team->t.t_level == master_th->th.th_teams_level + 1) { - // AC: We need to leave the team structure intact at the end of parallel - // inside the teams construct, so that at the next parallel same (hot) team - // works, only adjust nesting levels - +// AC: We need to leave the team structure intact at the end of parallel +// inside the teams construct, so that at the next parallel same (hot) team +// works, only adjust nesting levels +#if OMPT_SUPPORT + ompt_data_t ompt_parallel_data = ompt_data_none; + if (ompt_enabled.enabled) { + ompt_task_info_t *task_info = __ompt_get_task_info_object(0); + if (ompt_enabled.ompt_callback_implicit_task) { + int ompt_team_size = team->t.t_nproc; + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_end, NULL, &(task_info->task_data), ompt_team_size, + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); + } + task_info->frame.exit_frame = ompt_data_none; + task_info->task_data = ompt_data_none; + ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); + __ompt_lw_taskteam_unlink(master_th); + } +#endif /* Decrement our nested depth level */ team->t.t_level--; team->t.t_active_level--; @@ -2394,8 +2449,8 @@ void __kmp_join_call(ident_t *loc, int gtid #if OMPT_SUPPORT if (ompt_enabled.enabled) { - __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, fork_context, - codeptr); + __kmp_join_ompt(gtid, master_th, parent_team, &ompt_parallel_data, + OMPT_INVOKER(fork_context) | ompt_parallel_team, codeptr); } #endif @@ -2424,12 +2479,14 @@ void __kmp_join_call(ident_t *loc, int gtid if (ompt_enabled.enabled) { ompt_task_info_t *task_info = __ompt_get_task_info_object(0); if (ompt_enabled.ompt_callback_implicit_task) { - int ompt_team_size = team->t.t_nproc; + int flags = (team_microtask == (void *)__kmp_teams_master) + ? ompt_task_initial + : ompt_task_implicit; + int ompt_team_size = (flags == ompt_task_initial) ? 0 : team->t.t_nproc; ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, &(task_info->task_data), ompt_team_size, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, flags); } - task_info->frame.exit_frame = ompt_data_none; task_info->task_data = ompt_data_none; } @@ -2503,8 +2560,12 @@ void __kmp_join_call(ident_t *loc, int gtid __kmp_release_bootstrap_lock(&__kmp_forkjoin_lock); #if OMPT_SUPPORT + int flags = + OMPT_INVOKER(fork_context) | + ((team_microtask == (void *)__kmp_teams_master) ? ompt_parallel_league + : ompt_parallel_team); if (ompt_enabled.enabled) { - __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, fork_context, + __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, flags, codeptr); } #endif @@ -4432,7 +4493,7 @@ static void __kmp_initialize_team(kmp_team_t *team, in KF_TRACE(10, ("__kmp_initialize_team: exit: team=%p\n", team)); } -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED /* Sets full mask for thread and returns old mask, no changes to structures. */ static void __kmp_set_thread_affinity_mask_full_tmp(kmp_affin_mask_t *old_mask) { @@ -4980,7 +5041,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, i __kmp_partition_places(team); #endif } else { // team->t.t_nproc < new_nproc -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED kmp_affin_mask_t *old_mask; if (KMP_AFFINITY_CAPABLE()) { KMP_CPU_ALLOC(old_mask); @@ -5029,7 +5090,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, i __kmp_reinitialize_team(team, new_icvs, NULL); } -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED /* Temporarily set full mask for master thread before creation of workers. The reason is that workers inherit the affinity from master, so if a lot of workers are created on the single core quickly, they @@ -5064,7 +5125,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, i } } -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED if (KMP_AFFINITY_CAPABLE()) { /* Restore initial master thread's affinity mask */ __kmp_set_system_affinity(old_mask, TRUE); @@ -5600,7 +5661,7 @@ void __kmp_free_thread(kmp_info_t *this_th) { void *__kmp_launch_thread(kmp_info_t *this_thr) { int gtid = this_thr->th.th_info.ds.ds_gtid; /* void *stack_data;*/ - kmp_team_t *(*volatile pteam); + kmp_team_t **volatile pteam; KMP_MB(); KA_TRACE(10, ("__kmp_launch_thread: T#%d start\n", gtid)); @@ -5618,18 +5679,15 @@ void *__kmp_launch_thread(kmp_info_t *this_thr) { this_thr->th.ompt_thread_info.state = ompt_state_overhead; this_thr->th.ompt_thread_info.wait_id = 0; this_thr->th.ompt_thread_info.idle_frame = OMPT_GET_FRAME_ADDRESS(0); + this_thr->th.ompt_thread_info.parallel_flags = 0; if (ompt_enabled.ompt_callback_thread_begin) { ompt_callbacks.ompt_callback(ompt_callback_thread_begin)( ompt_thread_worker, thread_data); } - } -#endif - -#if OMPT_SUPPORT - if (ompt_enabled.enabled) { this_thr->th.ompt_thread_info.state = ompt_state_idle; } #endif + /* This is the place where threads wait for work */ while (!TCR_4(__kmp_global.g.g_done)) { KMP_DEBUG_ASSERT(this_thr == __kmp_threads[gtid]); @@ -5647,7 +5705,7 @@ void *__kmp_launch_thread(kmp_info_t *this_thr) { } #endif - pteam = (kmp_team_t * (*))(&this_thr->th.th_team); + pteam = &this_thr->th.th_team; /* have we been allocated? */ if (TCR_SYNC_PTR(*pteam) && !TCR_4(__kmp_global.g.g_done)) { @@ -6956,16 +7014,16 @@ int __kmp_invoke_task_func(int gtid) { #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_data_t *my_task_data; ompt_data_t *my_parallel_data; int ompt_team_size; if (ompt_enabled.enabled) { - exit_runtime_p = &( + exit_frame_p = &( team->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_frame.ptr); } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } my_task_data = @@ -6975,7 +7033,7 @@ int __kmp_invoke_task_func(int gtid) { ompt_team_size = team->t.t_nproc; ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size, - __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? + __kmp_tid_from_gtid(gtid), ompt_task_implicit); OMPT_CUR_TASK_INFO(this_thr)->thread_num = __kmp_tid_from_gtid(gtid); } #endif @@ -6994,11 +7052,12 @@ int __kmp_invoke_task_func(int gtid) { tid, (int)team->t.t_argc, (void **)team->t.t_argv #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); #if OMPT_SUPPORT - *exit_runtime_p = NULL; + *exit_frame_p = NULL; + this_thr->th.ompt_thread_info.parallel_flags |= ompt_parallel_team; #endif #if KMP_STATS_ENABLED @@ -7077,7 +7136,22 @@ int __kmp_invoke_teams_master(int gtid) { (void *)__kmp_teams_master); #endif __kmp_run_before_invoked_task(gtid, 0, this_thr, team); +#if OMPT_SUPPORT + int tid = __kmp_tid_from_gtid(gtid); + ompt_data_t *task_data = + &team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_data; + ompt_data_t *parallel_data = &team->t.ompt_team_info.parallel_data; + if (ompt_enabled.ompt_callback_implicit_task) { + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_begin, parallel_data, task_data, team->t.t_nproc, tid, + ompt_task_initial); + OMPT_CUR_TASK_INFO(this_thr)->thread_num = tid; + } +#endif __kmp_teams_master(gtid); +#if OMPT_SUPPORT + this_thr->th.ompt_thread_info.parallel_flags |= ompt_parallel_league; +#endif __kmp_run_after_invoked_task(gtid, 0, this_thr, team); return 1; } @@ -7118,19 +7192,32 @@ void __kmp_push_num_teams(ident_t *id, int gtid, int n thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams; // Remember the number of threads for inner parallel regions + if (!TCR_4(__kmp_init_middle)) + __kmp_middle_initialize(); // get internal globals calculated + KMP_DEBUG_ASSERT(__kmp_avail_proc); + KMP_DEBUG_ASSERT(__kmp_dflt_team_nth); if (num_threads == 0) { - if (!TCR_4(__kmp_init_middle)) - __kmp_middle_initialize(); // get __kmp_avail_proc calculated num_threads = __kmp_avail_proc / num_teams; + // adjust num_threads w/o warning as it is not user setting + // num_threads = min(num_threads, nthreads-var, thread-limit-var) + // no thread_limit clause specified - do not change thread-limit-var ICV + if (num_threads > __kmp_dflt_team_nth) { + num_threads = __kmp_dflt_team_nth; // honor nthreads-var ICV + } + if (num_threads > thr->th.th_current_task->td_icvs.thread_limit) { + num_threads = thr->th.th_current_task->td_icvs.thread_limit; + } // prevent team size to exceed thread-limit-var if (num_teams * num_threads > __kmp_teams_max_nth) { - // adjust num_threads w/o warning as it is not user setting num_threads = __kmp_teams_max_nth / num_teams; } } else { // This thread will be the master of the league masters // Store new thread limit; old limit is saved in th_cg_roots list thr->th.th_current_task->td_icvs.thread_limit = num_threads; - + // num_threads = min(num_threads, nthreads-var) + if (num_threads > __kmp_dflt_team_nth) { + num_threads = __kmp_dflt_team_nth; // honor nthreads-var ICV + } if (num_teams * num_threads > __kmp_teams_max_nth) { int new_threads = __kmp_teams_max_nth / num_teams; if (!__kmp_reserve_warn) { // user asked for too many threads @@ -8023,7 +8110,8 @@ __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 +#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ + KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 #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 Modified: vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -164,7 +164,7 @@ void *kmp_aligned_malloc(size_t sz, size_t a) { #if KMP_OS_WINDOWS res = _aligned_malloc(sz, a); #else - if (err = posix_memalign(&res, a, sz)) { + if ((err = posix_memalign(&res, a, sz))) { errno = err; // can be EINVAL or ENOMEM res = NULL; } @@ -277,7 +277,7 @@ void __kmps_get_schedule(kmp_sched_t *kind, int *modif kmp_proc_bind_t __kmps_get_proc_bind(void) { i; - return 0; + return proc_bind_false; } // __kmps_get_proc_bind double __kmps_get_wtime(void) { Modified: vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -54,12 +54,64 @@ static inline kmp_depnode_t *__kmp_node_ref(kmp_depnod enum { KMP_DEPHASH_OTHER_SIZE = 97, KMP_DEPHASH_MASTER_SIZE = 997 }; +size_t sizes[] = { 997, 2003, 4001, 8191, 16001, 32003, 64007, 131071, 270029 }; +const size_t MAX_GEN = 8; + static inline kmp_int32 __kmp_dephash_hash(kmp_intptr_t addr, size_t hsize) { // TODO alternate to try: set = (((Addr64)(addrUsefulBits * 9.618)) % // m_num_sets ); return ((addr >> 6) ^ (addr >> 2)) % hsize; } +static kmp_dephash_t *__kmp_dephash_extend(kmp_info_t *thread, + kmp_dephash_t *current_dephash) { + kmp_dephash_t *h; + + size_t gen = current_dephash->generation + 1; + if (gen >= MAX_GEN) + return current_dephash; + size_t new_size = sizes[gen]; + + kmp_int32 size_to_allocate = + new_size * sizeof(kmp_dephash_entry_t *) + sizeof(kmp_dephash_t); + +#if USE_FAST_MEMORY + h = (kmp_dephash_t *)__kmp_fast_allocate(thread, size_to_allocate); +#else + h = (kmp_dephash_t *)__kmp_thread_malloc(thread, size_to_allocate); +#endif + + h->size = new_size; + h->nelements = current_dephash->nelements; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910231753.x9NHrFQR078722>