diff --git a/openmp/runtime/src/kmp_lock.cpp b/openmp/runtime/src/kmp_lock.cpp index e045b48c030f4b98a8125e840306040dc984b559..c51640bfba3a7152611ce17486326d94a87ee10f 100644 --- a/openmp/runtime/src/kmp_lock.cpp +++ b/openmp/runtime/src/kmp_lock.cpp @@ -3359,7 +3359,7 @@ static void __kmp_init_nested_futex_lock_with_checks(kmp_futex_lock_t *lck) { #endif static int __kmp_is_ticket_lock_initialized(kmp_ticket_lock_t *lck) { - return lck == lck->lk.initialized; + return lck == lck->lk.self; } static void __kmp_init_ticket_lock_with_checks(kmp_ticket_lock_t *lck) { diff --git a/openmp/runtime/src/kmp_lock.h b/openmp/runtime/src/kmp_lock.h index 220236de2f5f77358b3d1db83a8b8f6e92c67db1..6a88d7bc52afbab39cd800db81dc749d19ed0f5d 100644 --- a/openmp/runtime/src/kmp_lock.h +++ b/openmp/runtime/src/kmp_lock.h @@ -649,7 +649,7 @@ extern int (*__kmp_acquire_user_lock_with_checks_)(kmp_user_lock_p lck, } \ } \ if (lck->tas.lk.poll != 0 || \ - !__kmp_compare_and_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \ + !__kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \ kmp_uint32 spins; \ KMP_FSYNC_PREPARE(lck); \ KMP_INIT_YIELD(spins); \ @@ -659,8 +659,8 @@ extern int (*__kmp_acquire_user_lock_with_checks_)(kmp_user_lock_p lck, } else { \ KMP_YIELD_SPIN(spins); \ } \ - while (lck->tas.lk.poll != 0 || \ - !__kmp_compare_and_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \ + while (lck->tas.lk.poll != 0 || !__kmp_atomic_compare_store_acq( \ + &lck->tas.lk.poll, 0, gtid + 1)) { \ if (TCR_4(__kmp_nth) > \ (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \ KMP_YIELD(TRUE); \ @@ -702,7 +702,7 @@ static inline int __kmp_test_user_lock_with_checks(kmp_user_lock_p lck, } } return ((lck->tas.lk.poll == 0) && - __kmp_compare_and_store_acq(&lck->tas.lk.poll, 0, gtid + 1)); + __kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)); } else { KMP_DEBUG_ASSERT(__kmp_test_user_lock_with_checks_ != NULL); return (*__kmp_test_user_lock_with_checks_)(lck, gtid); @@ -767,7 +767,7 @@ extern int (*__kmp_acquire_nested_user_lock_with_checks_)(kmp_user_lock_p lck, *depth = KMP_LOCK_ACQUIRED_NEXT; \ } else { \ if ((lck->tas.lk.poll != 0) || \ - !__kmp_compare_and_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \ + !__kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \ kmp_uint32 spins; \ KMP_FSYNC_PREPARE(lck); \ KMP_INIT_YIELD(spins); \ @@ -777,8 +777,9 @@ extern int (*__kmp_acquire_nested_user_lock_with_checks_)(kmp_user_lock_p lck, } else { \ KMP_YIELD_SPIN(spins); \ } \ - while ((lck->tas.lk.poll != 0) || \ - !__kmp_compare_and_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \ + while ( \ + (lck->tas.lk.poll != 0) || \ + !__kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \ if (TCR_4(__kmp_nth) > \ (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \ KMP_YIELD(TRUE); \ @@ -826,7 +827,7 @@ static inline int __kmp_test_nested_user_lock_with_checks(kmp_user_lock_p lck, return ++lck->tas.lk.depth_locked; /* same owner, depth increased */ } retval = ((lck->tas.lk.poll == 0) && - __kmp_compare_and_store_acq(&lck->tas.lk.poll, 0, gtid + 1)); + __kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)); if (retval) { KMP_MB(); lck->tas.lk.depth_locked = 1; diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp index daf5ad2db1c6aa2ec553da44aaf8353bffc8fef8..4db2113ec69ba968a158c9688a2373b34d33763f 100644 --- a/openmp/runtime/src/kmp_tasking.cpp +++ b/openmp/runtime/src/kmp_tasking.cpp @@ -811,8 +811,10 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task, kmp_taskdata_t *resumed_task) { kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task); kmp_info_t *thread = __kmp_threads[gtid]; +#if OMP_45_ENABLED kmp_task_team_t *task_team = thread->th.th_task_team; // might be NULL for serial teams... +#endif // OMP_45_ENABLED kmp_int32 children = 0; KA_TRACE(10, ("__kmp_task_finish(enter): T#%d finishing task %p and resuming " diff --git a/openmp/runtime/test/api/omp_alloc.c b/openmp/runtime/test/api/omp_alloc.c index afad4a504e3a8f5a25b6c1b573c6956e36de2f8d..2002adbec5741d1884e166f54cb107804cff8f83 100644 --- a/openmp/runtime/test/api/omp_alloc.c +++ b/openmp/runtime/test/api/omp_alloc.c @@ -1,4 +1,7 @@ // RUN: %libomp-compile-and-run + +// REQUIRES: openmp-5.0 + #include #include #include diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg index 82c3fd46c1de644a064ae0d274157b869aad2bc1..48d2f2a2190a19ddd1974af9d79e744fbb4d96e0 100644 --- a/openmp/runtime/test/lit.cfg +++ b/openmp/runtime/test/lit.cfg @@ -91,6 +91,15 @@ if config.has_ompt: # for callback.h config.test_flags += " -I " + config.test_source_root + "/ompt" +if config.libomp_omp_version >= 50: + config.available_features.add("openmp-5.0") + +if config.libomp_omp_version >= 45: + config.available_features.add("openmp-4.5") + +if config.libomp_omp_version >= 40: + config.available_features.add("openmp-4.0") + if 'Linux' in config.operating_system: config.available_features.add("linux") diff --git a/openmp/runtime/test/lit.site.cfg.in b/openmp/runtime/test/lit.site.cfg.in index c2825ee4eab53f2d9dc4751291e8058e02b4fee3..0964cfceabc1fbe4ecae889418e7ebdb12e7510f 100644 --- a/openmp/runtime/test/lit.site.cfg.in +++ b/openmp/runtime/test/lit.site.cfg.in @@ -6,6 +6,7 @@ config.test_compiler_features = @OPENMP_TEST_COMPILER_FEATURES@ config.test_filecheck = "@OPENMP_FILECHECK_EXECUTABLE@" config.test_openmp_flags = "@OPENMP_TEST_OPENMP_FLAGS@" config.test_extra_flags = "@OPENMP_TEST_FLAGS@" +config.libomp_omp_version = @LIBOMP_OMP_VERSION@ config.libomp_obj_root = "@CMAKE_CURRENT_BINARY_DIR@" config.library_dir = "@LIBOMP_LIBRARY_DIR@" config.omp_header_directory = "@LIBOMP_BINARY_DIR@/src" diff --git a/openmp/runtime/test/ompt/misc/control_tool_no_ompt_support.c b/openmp/runtime/test/ompt/misc/control_tool_no_ompt_support.c index ee64da04f0d225aa379544bba438010512f2a0f9..23daf8b313dc654ef36ea55f6f79a69a7ba62a7f 100644 --- a/openmp/runtime/test/ompt/misc/control_tool_no_ompt_support.c +++ b/openmp/runtime/test/ompt/misc/control_tool_no_ompt_support.c @@ -1,4 +1,7 @@ // RUN: %libomp-compile-and-run + +// REQUIRES: openmp-5.0 + #include int main() diff --git a/openmp/runtime/test/tasking/bug_nested_proxy_task.c b/openmp/runtime/test/tasking/bug_nested_proxy_task.c index 6c0082236e06f9ddf320cdefcb1e311597e5e875..84e4dfda9cce7bf9221b0ce43f2c8ed53afb581b 100644 --- a/openmp/runtime/test/tasking/bug_nested_proxy_task.c +++ b/openmp/runtime/test/tasking/bug_nested_proxy_task.c @@ -1,4 +1,5 @@ // RUN: %libomp-compile -lpthread && %libomp-run +// REQUIRES: openmp-4.5 // The runtime currently does not get dependency information from GCC. // UNSUPPORTED: gcc diff --git a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c index e6dd895fe1b706b21af5c4e227d823573429e3b1..fe8f18db913482e8f66746995adb02aea91a832a 100644 --- a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c +++ b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c @@ -1,4 +1,5 @@ // RUN: %libomp-compile -lpthread && %libomp-run +// REQUIRES: openmp-4.5 // The runtime currently does not get dependency information from GCC. // UNSUPPORTED: gcc diff --git a/openmp/runtime/test/tasking/kmp_task_reduction_nest.cpp b/openmp/runtime/test/tasking/kmp_task_reduction_nest.cpp index 63dffe44dad5c040449b6650fa946e573b5be23b..019a9feadfddd98a3aac977aa8e96588c28deaf9 100644 --- a/openmp/runtime/test/tasking/kmp_task_reduction_nest.cpp +++ b/openmp/runtime/test/tasking/kmp_task_reduction_nest.cpp @@ -1,5 +1,6 @@ // RUN: %libomp-cxx-compile-and-run // RUN: %libomp-cxx-compile -DFLG=1 && %libomp-run +// REQUIRES: openmp-5.0 // GCC-5 is needed for OpenMP 4.0 support (taskgroup) // XFAIL: gcc-4 #include diff --git a/openmp/runtime/test/tasking/kmp_taskloop.c b/openmp/runtime/test/tasking/kmp_taskloop.c index 4b137933bb0140f3de78476a0a3756b4ab1ed8c8..359f7a4ae916d667f5052a1f72ce3b5ebb4b1f96 100644 --- a/openmp/runtime/test/tasking/kmp_taskloop.c +++ b/openmp/runtime/test/tasking/kmp_taskloop.c @@ -1,5 +1,6 @@ // RUN: %libomp-compile-and-run // RUN: %libomp-compile && env KMP_TASKLOOP_MIN_TASKS=1 %libomp-run +// REQUIRES: openmp-4.5 #include #include #include "omp_my_sleep.h" diff --git a/openmp/runtime/test/tasking/omp_task_priority.c b/openmp/runtime/test/tasking/omp_task_priority.c index 7b62360173341c69af644ebb2bede54bb9dc0387..6acb4a804e8ed1c06e412bcbe26e44c3d07043ec 100644 --- a/openmp/runtime/test/tasking/omp_task_priority.c +++ b/openmp/runtime/test/tasking/omp_task_priority.c @@ -1,4 +1,5 @@ // RUN: %libomp-compile && env OMP_MAX_TASK_PRIORITY=42 %libomp-run +// REQUIRES: openmp-4.5 // Test OMP 4.5 task priorities // Currently only API function and envirable parsing implemented. // Test environment sets envirable: OMP_MAX_TASK_PRIORITY=42 as tested below. diff --git a/openmp/runtime/test/tasking/omp_taskloop_grainsize.c b/openmp/runtime/test/tasking/omp_taskloop_grainsize.c index 0833073efb247f30fc1686ae6a795895eb9ff2c0..c5756a481a18552c1ecedf6fedeadb30232640f8 100644 --- a/openmp/runtime/test/tasking/omp_taskloop_grainsize.c +++ b/openmp/runtime/test/tasking/omp_taskloop_grainsize.c @@ -1,5 +1,6 @@ // RUN: %libomp-compile-and-run // RUN: %libomp-compile && env KMP_TASKLOOP_MIN_TASKS=1 %libomp-run +// REQUIRES: openmp-4.5 // These compilers don't support the taskloop construct // UNSUPPORTED: gcc-4, gcc-5, icc-16 diff --git a/openmp/runtime/test/tasking/omp_taskloop_num_tasks.c b/openmp/runtime/test/tasking/omp_taskloop_num_tasks.c index 7c3c7042af385f004d9d3531d260c93e622185e0..75efea6e1c6413545fecb70a7529fb462ed3d074 100644 --- a/openmp/runtime/test/tasking/omp_taskloop_num_tasks.c +++ b/openmp/runtime/test/tasking/omp_taskloop_num_tasks.c @@ -1,5 +1,6 @@ // RUN: %libomp-compile-and-run // RUN: %libomp-compile && env KMP_TASKLOOP_MIN_TASKS=1 %libomp-run +// REQUIRES: openmp-4.5 // These compilers don't support the taskloop construct // UNSUPPORTED: gcc-4, gcc-5, icc-16 diff --git a/openmp/runtime/test/worksharing/for/kmp_doacross_check.c b/openmp/runtime/test/worksharing/for/kmp_doacross_check.c index 59b61e32eb16a97cd9d3ed31f109aca933529384..4eea328833a8b24388b2910322f93a5aac659396 100644 --- a/openmp/runtime/test/worksharing/for/kmp_doacross_check.c +++ b/openmp/runtime/test/worksharing/for/kmp_doacross_check.c @@ -1,4 +1,5 @@ // RUN: %libomp-compile-and-run +// REQUIRES: openmp-4.5 // UNSUPPORTED: gcc // This test is incompatible with gcc because of the explicit call to // __kmpc_doacross_fini(). gcc relies on an implicit call to this function diff --git a/openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c b/openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c index 5c6f94bc729af7c64a838e7c1c3943297e1331a5..6cf5d2ff82244ce9346f42a2644a77cd41d9e073 100644 --- a/openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c +++ b/openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c @@ -1,4 +1,5 @@ // RUN: %libomp-compile-and-run +// REQUIRES: openmp-4.5 /* Test for the 'schedule(simd:guided)' clause. Compiler needs to generate a dynamic dispatching and pass the schedule diff --git a/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_api.c b/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_api.c index 987a5c0d4594502066bb233cf04e2bd700d3cc5d..8b5f34a8c3fdde1f04332fd844a1dde8efdbb48c 100644 --- a/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_api.c +++ b/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_api.c @@ -1,4 +1,5 @@ // RUN: %libomp-compile-and-run +// REQUIRES: openmp-4.5 // The test checks schedule(simd:runtime) // in combination with omp_set_schedule() diff --git a/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_guided.c b/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_guided.c index 5dfaf24185e76988641f8cb830e897713ec12f49..142e9b363345110b75f830fe31c748935e25940c 100644 --- a/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_guided.c +++ b/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_guided.c @@ -6,6 +6,7 @@ // RUN: env OMP_SCHEDULE=dynamic,1 %libomp-run 1 // RUN: env OMP_SCHEDULE=dynamic,2 %libomp-run 2 // RUN: env OMP_SCHEDULE=auto %libomp-run +// REQUIRES: openmp-4.5 // The test checks schedule(simd:runtime) // in combination with OMP_SCHEDULE=guided[,chunk] diff --git a/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_static.c b/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_static.c index d76046bac1f804d470adfd6a3084b2e941cff558..e2c878fe79f324666327dfb7f03a0889a5fb6814 100644 --- a/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_static.c +++ b/openmp/runtime/test/worksharing/for/kmp_sch_simd_runtime_static.c @@ -1,5 +1,6 @@ // RUN: %libomp-compile && %libomp-run // RUN: %libomp-run 1 && %libomp-run 2 +// REQUIRES: openmp-4.5 // The test checks schedule(simd:runtime) // in combination with OMP_SCHEDULE=static[,chunk] diff --git a/openmp/runtime/test/worksharing/for/omp_doacross.c b/openmp/runtime/test/worksharing/for/omp_doacross.c index 364430675d647762f0ba63c2de3aff968243001e..32e8e82d331de4a19e631383889affa15c74dce1 100644 --- a/openmp/runtime/test/worksharing/for/omp_doacross.c +++ b/openmp/runtime/test/worksharing/for/omp_doacross.c @@ -1,4 +1,5 @@ // RUN: %libomp-compile-and-run +// REQUIRES: openmp-4.5 // XFAIL: gcc-4, gcc-5, clang-3.7, clang-3.8, icc-15, icc-16 #include #include