Commit Graph

945 Commits

Author SHA1 Message Date
Peyton, Jonathan L 771f0fb92d [OpenMP] Add NULL check in dispatcher debug output
Patch by Nawrin Sultana

Differential Revision: https://reviews.llvm.org/D90403
2020-10-29 14:08:03 -05:00
AndreyChurbanov d6a0957467 [OpenMP] changing OMP rtl to use shared memory instead of env variable
Patch by Erdner, Todd <todd.erdner@intel.com>

Differential Revision: https://reviews.llvm.org/D89898
2020-10-26 19:02:21 +03:00
Joachim Protze 34b34e90fc [OpenMP][Tests] NFC: fix flaky test failure caused by rare scheduling
The worker thread can start execution of the task before creation of the second task
Fixes the spurious failure reported in https://reviews.llvm.org/D61657
2020-10-05 16:55:32 +02:00
Joachim Protze 6104b30446 [OpenMP][OMPT] Update OMPT tests for newly added GOMP interface patches
This patch updates the expected results for the GOMP interface patches: D87267, D87269, and D87271.
The taskwait-depend test is changed to really use taskwait-depend and copied to an task_if0-depend test.

To pass the tests, the handling of the return address was fixed.

Differential Revision: https://reviews.llvm.org/D87680
2020-10-01 00:53:41 +02:00
Joachim Protze 55cff5b288 [OpenMP][libomptarget] make omp_get_initial_device 5.1 compliant
OpenMP 5.1 defines omp_get_initial_device to return the same value as omp_get_num_devices.
Since this change is also 5.0 compliant, no versioning is needed.

Differential Revision: https://reviews.llvm.org/D88149
2020-10-01 00:51:11 +02:00
Peyton, Jonathan L ee1c04a926 [OpenMP] Fix if0 task with dependencies in the runtime
The current GOMP interface for serialized tasks does not take into
account task dependencies. Add the check and wait for dependencies.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=46573

Differential Revision: https://reviews.llvm.org/D87271
2020-09-24 09:47:53 -05:00
Peyton, Jonathan L 9089b4a5c5 [OpenMP] Introduce GOMP taskwait depend in the runtime
This change introduces the GOMP_taskwait_depend() function. It implements
the OpenMP 5.0 feature of #pragma omp taskwait with depend() clause by
wrapping around __kmpc_omp_wait_deps().

Differential Revision: https://reviews.llvm.org/D87269
2020-09-24 09:45:14 -05:00
Peyton, Jonathan L 72ada5ae6c [OpenMP] Introduce GOMP mutexinoutset in the runtime
Encapsulate GOMP task dependencies in separate class and introduce the
new mutexinoutset dependency type. This separate class allows
future GOMP task APIs easier access to the task dependency functionality
and better ability to propagate new dependency types to all existing GOMP
task APIs which use task dependencies.

Differential Revision: https://reviews.llvm.org/D87267
2020-09-24 09:45:13 -05:00
Peyton, Jonathan L ea34d95e0a [OpenMP] Introduce GOMP teams support in runtime
Implement GOMP_teams_reg() function which enables GOMP support of the
standalone teams construct. The GOMP_parallel* functions were modified
to call __kmp_fork_call() unconditionally so that the teams-specific
code could be reused within __kmp_fork_call() instead of reproduced
inside the GOMP_* functions.

Differential Revision: https://reviews.llvm.org/D87167
2020-09-24 09:45:13 -05:00
Raul Tambre 21c0e74c9e [CMake][OpenMP] Remove old dead CMake code
LLVM requires CMake 3.13.4 so remove code behind checks for an older version.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D87191
2020-09-07 10:56:56 +03:00
AndreyChurbanov 1596ea80fd [OpenMP] Fix import library installation with MinGW
Patch by mati865@gmail.com

Differential Revision: https://reviews.llvm.org/D86552
2020-08-26 21:56:01 +03:00
AndreyChurbanov 09af378f49 [OpenMP] Fix build on macOS sdk 10.12 and newer
Patch by nihui (Ni Hui)

Differential Revision: https://reviews.llvm.org/D76755
2020-08-26 16:52:46 +03:00
Dimitry Andric 47b0262d3f Add <stdarg.h> include to kmp_os.h, to get the va_list type, required
after cde8f4c164. Sort system includes, while here.
2020-08-24 22:45:02 +02:00
Dimitry Andric cde8f4c164 Move special va_list handling to kmp_os.h
Instead of copying and pasting the same `#ifdef` expressions in multiple
places, define a type and a pair of macros in `kmp_os.h`, to handle
whether `va_list` is pointer-like or not:

* `kmp_va_list` is the type to use for `__kmp_fork_call()`
* `kmp_va_deref()` dereferences a `va_list`, if necessary
* `kmp_va_addr_of()` takes the address of a `va_list`, if necessary

Also add FreeBSD to the list of OSes that has a non pointer-like
va_list. This can now be easily extended to other OSes too.

Reviewed By: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D86397
2020-08-24 22:31:56 +02:00
AndreyChurbanov d0f4f5a182 [OpenMP] Check if _MSC_VER is defined before using it
Patch by mati865@gmail.com

Differential Revision: https://reviews.llvm.org/D86448
2020-08-24 17:50:38 +03:00
Joachim Protze 66a3575c28 [OpenMP] Fix releasing of stack memory
Starting with 787eb0c637 I got spurious segmentation faults for some testcases. I could nail it down to `brel` trying to release the "memory" of the node allocated on the stack of __kmpc_omp_wait_deps. With this patch, you will see the assertion triggering for some of the tests in the test suite.

My proposed solution for the issue is to just patch __kmpc_omp_wait_deps:
```
  __kmp_init_node(&node);
-  node.dn.on_stack = 1;
+  // the stack owns the node
+  __kmp_node_ref(&node);
```

What do you think?

Reviewed By: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D84472
2020-08-14 10:32:53 +02:00
Adrian Pop bf2aa74e51 [OpenMP] support build on msys2/mingw with clang or gcc
RTM Adaptive Locks are supported on msys2/mingw for clang and gcc.

Differential Revision: https://reviews.llvm.org/D81776
2020-08-04 23:15:36 +03:00
AndreyChurbanov 4a04bc8995 [OpenMP] Don't use MSVC workaround with MinGW
Patch by mati865@gmail.com

Differential Revision: https://reviews.llvm.org/D85210
2020-08-04 18:48:25 +03:00
David Blaikie 0c938a8dd8 OpenMP: Fix typo variabls -> variables 2020-08-03 17:00:15 -07:00
Joachim Protze 03116a9f8c [OpenMP] Use weak attribute in interface only for static library
This is to address the issue reported at:
https://bugs.llvm.org/show_bug.cgi?id=46863

Since weak is meaningless for a shared library interface function, this patch
disables the attribute, when the OpenMP library is built as shared library.

ompt_start_tool is not an interface function, but a internally called function
possibly implemented by an OMPT tool.
This function needs to be weak if possible to allow overwriting ompt_start_tool
with a function implementation built into the application.

Differential Revision: https://reviews.llvm.org/D84871
2020-07-31 12:29:05 +02:00
Jinsong Ji d28f86723f Re-land "[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support"
This reverts commit bf544fa1c3.

Fixed the typo in PPCInstrInfo.cpp.
2020-07-28 14:00:11 +00:00
Jinsong Ji bf544fa1c3 Revert "[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support"
This reverts commit adffce7153.

This is breaking test-suite, revert while investigation.
2020-07-27 21:07:00 +00:00
Jinsong Ji adffce7153 [PowerPC] Remove QPX/A2Q BGQ/BGP CNK support
Per RFC http://lists.llvm.org/pipermail/llvm-dev/2020-April/141295.html
no one is making use of QPX/A2Q/BGQ/BGP CNK anymore.

This patch remove the support of QPX/A2Q in llvm, BGQ/BGP in clang,
CNK support in openmp/polly.

Reviewed By: hfinkel

Differential Revision: https://reviews.llvm.org/D83915
2020-07-27 19:24:39 +00:00
David Truby bb099c87ab [openmp] Don't copy exports into the source folder by default.
Additionally fix the copy if enabled on multi-config targets.

Summary:
This changes the copy command for libomp.so to use the output of the target as
the source of the copy, rather than trying to find it based on
${LIBOMP_LIBRARY_DIR}, which appears to be incorrect in multi-config generator
builds.

Reviewers: jdoerfert

Subscribers: mgorny, yaxunl, guansong, sstefan1, openmp-commits

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D84148
2020-07-24 14:34:50 +01:00
Louis Dionne afa1afd410 [CMake] Bump CMake minimum version to 3.13.4
This upgrade should be friction-less because we've already been ensuring
that CMake >= 3.13.4 is used.

This is part of the effort discussed on llvm-dev here:

  http://lists.llvm.org/pipermail/llvm-dev/2020-April/140578.html

Differential Revision: https://reviews.llvm.org/D78648
2020-07-22 14:25:07 -04:00
Saiyedul Islam 741e55aeed [OpenMP] Temporarily disable failing runtime tests for clang-12
Following tests were disabled for clang-11 after upgrading to
version 5.0 in D82963:

1. openmp/runtime/test/env/kmp_set_dispatch_buf.c
2. openmp/runtime/test/worksharing/for/kmp_set_dispatch_buf.c

They are also failing for clang-12. Thus this temporary disabling
until they are fixed.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D84241
2020-07-21 15:32:46 +00:00
AndreyChurbanov 617787ea77 [OpenMP] add missed REQUIRES:ompt for 2 OMPT tests 2020-07-21 16:31:17 +03:00
AndreyChurbanov 5a8779169e [OpenMP] libomp build fix without OMPT_SUPPORT 2020-07-21 16:03:17 +03:00
AndreyChurbanov 917f842159 [OpenMP] libomp cleanup: add checks of bad memory access
Add check of frm to prevent array out-of-bound access;
add check of new_nproc to prevent access of unallocated hot_teams array;
add check of location info pointer to prevent NULL dereference;
add check of d_tn pointer to prevent NULL dereference in release build.
These checks make static analyzers happier.

This is second part of the patch from https://reviews.llvm.org/D84062.
2020-07-21 00:12:46 +03:00
AndreyChurbanov 787eb0c637 [OpenMP] libomp cleanup: add check of input global tid parameter
Add check of negative gtid before indexing __kmp_threads.
This makes static analyzers happier.
This is the first part of the patch split in two parts.

Differential Revision: https://reviews.llvm.org/D84062
2020-07-20 23:49:58 +03:00
Joachim Protze f226171429 [OpenMP][Tests][NFC] Mark compatibility with older versions of clang 2020-07-20 13:53:29 +02:00
AndreyChurbanov 86fb2db49b [OpenMP] libomp cleanup: check presence of hwloc objects CORE, PACKAGE
hwloc documentation guarantees the only object that is always present
in the topology is PU. We can check the presence of other objects
in the topology, just in case.

Differential Revision: https://reviews.llvm.org/D84065
2020-07-18 01:15:37 +03:00
AndreyChurbanov 62d88a1c79 [OpenMP] libomp: add itt notifications for teams construct on host
Add barrier/region notification for parallel inside teams construct
when number of teams is 1, as VTune only shows outer level regions for
simplicity.

Differential Revision: https://reviews.llvm.org/D84024
2020-07-17 21:10:25 +03:00
serge-sans-paille 515bc8c155 Harmonize Python shebang
Differential Revision: https://reviews.llvm.org/D83857
2020-07-16 21:53:45 +02:00
AndreyChurbanov ffd8f00931 [openmp] libomp: added itt notifications for task, taskwait, taskgroup
Add releasing->acquire edges for child task->taskwait and
child task->end of taskgroup.

Differential Revision: https://reviews.llvm.org/D83804
2020-07-16 14:28:46 +03:00
Joachim Protze 0fa0cf8638 [OpenMP][Tests] Update compatibility with GCC (NFC)
Commit 95a28df5c provided implementation for GOMP*_nonmonotonic*runtime*
functions. Now the tests succeed with gcc 9 and 10
2020-07-08 00:27:19 +02:00
Peyton, Jonathan L 95a28df5c4 [OpenMP] Add GOMP 5.0 loop entry points
This patch adds missing GOMP_5.0 loop entry points which incorporate
new non-monotonic default into entry point name.  Since monotonic
schedules are a subset of nonmonotonic, it is acceptable to use
monotonic as the implementation.  This patch simply has the nonmonotonic
(and possibly non-monontonic) versions of the loop entry points as
wrappers around the monotonic ones.

Differential Revision: https://reviews.llvm.org/D73922
2020-07-06 17:22:26 -05:00
Joachim Protze 6d9626d2da [OpenMP][Tests] Fix/Mark compatibilty for GCC
Reviewed by: Hahnfeld, saiislam

Differential Revision: https://reviews.llvm.org/D82267
2020-07-06 23:56:09 +02:00
Saiyedul Islam 4c4bda1630 [OpenMP] Temporarily disable failing runtime tests for OpenMP 5.0
Following tests are failing after upgrading to version 5.0 but are passing
for version 4.5:
1. openmp/runtime/test/env/kmp_set_dispatch_buf.c
2. openmp/runtime/test/worksharing/for/kmp_set_dispatch_buf.c

To be enabled as soon as these tests are fixed.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D82963
2020-07-06 14:04:43 +00:00
Joachim Protze 8289f2891e [OpenMP][Tests] Flag compatibility of OpenMP runtime tests with GCC versions
If the compilation fails, the test is marked as unsupported.
-> This will never change for a specific version of gcc

If the linking fails, the test is marked as expected to fail.
-> This might change as LLVM/OpenMP implements the missing GOMP interface function

Reviewed by: Hahnfeld

Differential Revision: https://reviews.llvm.org/D83077
2020-07-05 22:49:54 +02:00
Joachim Protze 30205865d9 [OpenMP][OMPT] Fix ifdefs for OMPT code
Fixes build with LIBOMP_OMPT_SUPPORT=off

Reported by: Jason Edson

Reviewed by: Hahnfeld

Differential Revision: https://reviews.llvm.org/D83171
2020-07-05 22:39:25 +02:00
Joachim Protze 3fc97f9636 [OpenMP][Tests] NFC use type macro in printf 2020-07-05 09:17:18 +02:00
Joachim Protze 47cb8a0f0b [OpenMP][OMPT]Add event callbacks for taskwait with depend
This adds the missing event callbacks to express dependencies on included tasks
and taskwait with depend clause.

The test fails for GCC, see bug report:
https://bugs.llvm.org/show_bug.cgi?id=46573

Reviewed by: hbae

Differential Revision: https://reviews.llvm.org/D81891
2020-07-03 09:58:31 +02:00
AndreyChurbanov 7f3d9cc1c0 [openmp][NFC] Cleanup: guard __kmp_mic_type by KMP_MIC_SUPPORTED macro.
Differential Revision: https://reviews.llvm.org/D82301
2020-06-29 14:14:56 +03:00
Joachim Protze 63a3c5925d [OpenMP][OMPT] Pass mutexinoutset to the tool
Adds OMPT support for the mutexinoutset dependency

Reviewed by: hbae

Differential Revision: https://reviews.llvm.org/D81890
2020-06-19 12:51:18 +02:00
Alexey Bataev 08029595ca [OPENMP]Fix overflow during counting the number of iterations.
Summary:
The OpenMP loops are normalized and transformed into the loops from 0 to
max number of iterations. In some cases, original scheme may lead to
overflow during calculation of number of iterations. If it is unknown,
if we can end up with overflow or not (the bounds are not constant and
  we cannot define if there is an overflow), cast original type to the
  unsigned.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, openmp-commits, cfe-commits, caomhin

Tags: #clang, #openmp

Differential Revision: https://reviews.llvm.org/D81881
2020-06-17 08:47:01 -04:00
Joachim Protze e9b8ed1fd7 [OpenMP][Tool] Header-only multiplexing of OMPT tools
Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D76012
2020-06-17 09:16:46 +02:00
Joachim Protze cbea36903e [OpenMP][OMPT] Add callbacks for doacross loops
Adds the callbacks for ordered with source/sink dependencies.

The test for task dependencies changed, because callbach.h now actually prints
the passed dependencies and the test also checks for the address.

Reviewed by: hbae

Differential Revision: https://reviews.llvm.org/D81807
2020-06-16 16:53:40 +02:00
Joachim Protze 9e5aefc5f9 [OpenMP][Tests] fix data race in an OpenMP runtime test
Reviewed by: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D81804
2020-06-15 18:48:35 +02:00
Joachim Protze d056d7592a [OpenMP][Tool] Extend reuse of OMPT testing
This patch allows to specify a prefix (default:empty) to be included into print-out
written by callback.h.
Also adding a cmake target to find the header file from other tests.

Reviewed by: jdoerfert

Differential Revision: https://reviews.llvm.org/D76008
2020-06-14 15:55:32 +02:00