Commit Graph

1523 Commits

Author SHA1 Message Date
Johannes Doerfert
20da662656 [OpenMP][FIX] Fixup test that doesn't work with lit's env substitute 2023-12-05 16:32:19 -08:00
Johannes Doerfert
68db7aef74
[OpenMP] Reorganize the initialization of PluginAdaptorTy (#74397)
This introduces checked errors into the creation and initialization of
`PluginAdaptorTy`. We also allow the adaptor to "hide" devices from the
user if the initialization failed. The new organization avoids the
"initOnce" stuff but we still do not eagerly initialize the plugin
devices (I think we should merge `PluginAdaptorTy::initDevices` into
`PluginAdaptorTy::init`)
2023-12-05 16:04:01 -08:00
Johannes Doerfert
9f87509b19
[OpenMP][FIX] Ensure we allow shared libraries without kernels (#74532)
This fixes two bugs and adds a test for them:
- A shared library with declare target functions but without kernels
should not error out due to missing globals.
- Enabling LIBOMPTARGET_INFO=32 should not deadlock in the presence of
indirect declare targets.
2023-12-05 15:25:10 -08:00
Johannes Doerfert
66784dcb3b
[OpenMP] Ensure Devices is accessed exlusively (#74374)
We accessed the `Devices` container most of the time while holding the
RTLsMtx, but not always. Sometimes we used the mutex for the size query,
but then accessed Devices again unguarded. From now we properly
encapsulate the container in a ProtectedObj which ensures exclusive
accesses. We also hide the "isReady" part in the `getDevice` accessor
and use an `llvm::Expected` to allow to return errors.
2023-12-04 17:10:37 -08:00
Johannes Doerfert
27f17837bb [OpenMP][NFC] Remove PluginAdaptorManagerTy 2023-12-01 15:23:17 -08:00
Johannes Doerfert
e469f8474b [OpenMP][FIX] Fixup test 2023-12-01 15:22:51 -08:00
Johannes Doerfert
7169c45efa [OpenMP][NFCI] Organize offload entry logic
This moves the offload entry logic into classes and provides convenient
accessors. No functional change intended but we can now print all
offload entries (and later look them up), tested via
`OMPTARGET_DUMP_OFFLOAD_ENTRIES=<device_no>`.
2023-12-01 15:10:52 -08:00
Johannes Doerfert
b091a887e0
[OpenMP][NFC] Extract device image handling into a class/header (#74129) 2023-12-01 14:59:12 -08:00
Johannes Doerfert
5fe741f08e
[OpenMP] Separate Requirements into a standalone header (#74126)
This is not completely NFC since we now check all 4 requirements and the
test is checking the good and the bad case for combining flags.
2023-12-01 14:47:00 -08:00
dhruvachak
ca2d79f9ca
[OpenMP] Add an INFO message for data transfer of kernel launch env. (#74030) 2023-12-01 10:58:23 -08:00
Johannes Doerfert
3530428b8f
[OpenMP][NFC] Extract OffloadPolicy into a helper class (#74029)
OpenMP allows 3 different offload policies, handling of which we want to
encapsulate.
2023-12-01 10:55:18 -08:00
Johannes Doerfert
bc4e0c048a
[OpenMP][NFC] Modernize the plugin handling (#74034)
This basically moves code around again, but this time to provide cleaner
interfaces and remove duplication. PluginAdaptorManagerTy is almost all
gone after this.
2023-12-01 10:36:59 -08:00
Shraiysh
abaeaf3823
[OpenMP][flang] Adding more tests for commonblock with target map (#71146)
This patch addresses the concern about multiple devices and also adds
more tests for `map(to:)`, `map(from:)` and named common blocks.
2023-12-01 10:59:01 -06:00
Jon Chesterfield
f184147706
[amdgpu] Default to 1.0, instead of unspecified, for dynamic hsa (#74098)
The plugin checks the values of HSA_AMD_INTERFACE_VERSION_* so we now
set them to something safe in the header.
2023-12-01 16:37:49 +00:00
Dominik Adamski
85184b4aef
[OpenMP] Fix libomptarget build issue (#74067)
Libomptarget cannot be build because of the recent refactoring
introduced in patch 148dec9fa4 :
[OpenMP][NFC] Separate Envar (environment variable) handling (#73994)

That patch moved handling of environment variables from libomptarget
library. That's why we don't need usage of "llvm::omp::target" namespace
if we handle environment variables.
2023-12-01 13:33:11 +01:00
Johannes Doerfert
51fc8544c7
[OpenMP][NFC] Move mapping related logic into Mapping.h (#74009) 2023-11-30 17:08:41 -08:00
Johannes Doerfert
1035cc7029
[OpenMP][NFC] Encapsulate Devices.size() (#74010) 2023-11-30 16:44:47 -08:00
Johannes Doerfert
b8b2a279d0
[OpenMP][NFC] Encapsulate profiling logic (#74003)
This simply puts the profiling logic into the `Profiler` class and
allows non-RAII profiling via `beginSection` and `endSection`.
2023-11-30 15:52:02 -08:00
Johannes Doerfert
148dec9fa4
[OpenMP][NFC] Separate Envar (environment variable) handling (#73994) 2023-11-30 15:23:34 -08:00
Johannes Doerfert
b80b5f180b
[OpenMP] Replace copy and paste code with instantiation (#73991) 2023-11-30 14:16:34 -08:00
Joseph Huber
0ec4b82cfd
[Libomptarget] Output the DeviceRTL alongside the other libraries (#73705)
Summary:
Currently, the `libomp.so` and `libomptarget.so` are emitted in the
`./lib` build directory generally. This logic is internal to the
`add_llvm_library` function we use to build `libomptarget`. The
DeviceRTl static library however is in the middle of the OpenMP runtime
build, which can vary depending on if this is a runtimes or projects
build. This patch changes this to install the DeviceRTL static library
alongside the other OpenMP libraries so they are easier to find.
2023-11-30 15:48:39 -06:00
Johannes Doerfert
fce4c0acd6
[OpenMP] Start organizing PluginManager, PluginAdaptors (#73875) 2023-11-30 13:47:47 -08:00
Johannes Doerfert
2e7f47d4a8
[OpenMP][NFC] Move out plugin API and APITypes into standalone headers (#73868) 2023-11-29 16:04:19 -08:00
Johannes Doerfert
fae233c63f
[OpenMP] Avoid initializing the KernelLaunchEnvironment if possible (#73864)
If we don't have a team reduction we don't need a kernel launch
environment (for now). In that case we can avoid the cost.
2023-11-29 14:49:13 -08:00
Johannes Doerfert
40422bf150
[OpenMP][NFC] Separate OpenMP/OpenACC specific mapping code (#73817)
While this does not really encapsulate the mapping code, it at least
moves most of the declarations out of the way.
2023-11-29 10:29:54 -08:00
Johannes Doerfert
8391bb3f5c
[OpenMP][NFC] Move more declarations out of private.h (#73823) 2023-11-29 09:22:03 -08:00
Johannes Doerfert
b465f94b7c
[OpenMP][NFC] Put ExponentialBackoff in a Utils header (#73816)
"private.h" will go.
2023-11-29 09:10:29 -08:00
Johannes Doerfert
bdecfebce4
[OpenMP][NFC] Rename OmptCallback.cpp into OpenMP/OMPT/Callback.cpp (#73813)
Also revert the ifdef OMPT_SUPPORT order to have the short fallback
first and not after 400 lines.
2023-11-29 08:44:07 -08:00
Johannes Doerfert
fd2d0bf90e
[OpenMP][NFC] Replace unnecessary typedefs (#73815) 2023-11-29 08:40:41 -08:00
Johannes Doerfert
e2299e8d9d
[OpenMP][NFC] Move OMPT headers into OpenMP/OMPT (#73718) 2023-11-29 08:29:41 -08:00
Johannes Doerfert
db96a9c3b7
[OpenMP][NFC] Flatten plugin-nextgen/common folder sturcture (#73725)
For historic reasons we had it setup that there was
`  plugin-nextgen/common/PluginInterface/<sources + headers>`
which is not what we do anywhere else.
Now it looks like the rest:
```
  plugin-nextgen/common/include/<headers>
  plugin-nextgen/common/src/<sources>
```
As part of this, `dlwrap.h` was moved into common/include (as
`DLWrap.h`)
since it is exclusively used by the plugins.
2023-11-29 07:57:01 -08:00
Johannes Doerfert
2cfe7b1b66
[OpenMP][NFC] Extract timescope profile support into its own header (#73727) 2023-11-29 07:54:35 -08:00
Dominik Adamski
d4d88b8499
[OpenMP] New Openmp device RTL functions (#73225)
Add new implementation of workshare loop functions.

These functions will be used by OpenMPIRBuilder to support
handling of OpenMP workshare loops for the target region.

---------

Co-authored-by: Johannes Doerfert <johannes@jdoerfert.de>
2023-11-29 14:25:57 +01:00
Jan Patrick Lehr
3930a0b57a
[OpenMP][libomptarget] Use two SDMA engines (#73633)
Limit the use to two SDMA engines which are optimized for such transfers.
2023-11-29 14:21:44 +01:00
Johannes Doerfert
5d57041d39
[OpenMP][NFC] Move debug declares into CMAKE out of "private.h" (#73732)
Everywhere else we define this in the CMakeLists.txt and "private.h"
needs to go. Rename "Libomptarget" into "omptarget", no benefit from
"lib".
2023-11-28 17:38:49 -08:00
Johannes Doerfert
d1057014a1
[OpenMP][NFC] Create an "OpenMP" folder in the include folder (#73713)
Not everything in libomptarget (include) is "OpenMP", but some things
most certainly are. This commit moves some code around to start making
this distinction without the intention to change functionality.
2023-11-28 15:41:31 -08:00
Johannes Doerfert
7233e42dff
[OpenMP][NFC] Move Environment.h and SourceInfo.h into "Shared" folder (#73703) 2023-11-28 15:10:06 -08:00
Johannes Doerfert
8327f4a851
[OpenMP][NFC] Move Utils.h and Debug.h into a "Shared" include folder (#73701)
Headers used throughout the different runtimes are different from the
internal headers. This is a first step to bring structure in into the
include folder.
2023-11-28 13:44:57 -08:00
Johannes Doerfert
0783bf1cb3
[OpenMP][NFC] Merge MemoryManager into PluginInterface (#73678)
Similar to #73677, there is no benefit from keeping MemoryManager
seperate; it's tied into the current design. Except the move I also
replaced the getenv call with our Env handling.
2023-11-28 10:17:51 -08:00
Johannes Doerfert
4667dd62ee
[OpenMP][NFC] Merge elf_common into PluginInterface (#73677)
The overhead of a library and 4 files seems high without benefit. This
simply tries to consolidate our structure.
2023-11-28 10:03:25 -08:00
Johannes Doerfert
e1f911e40c [OpenMP][NFC] Simplify code 2023-11-27 16:02:34 -08:00
Johannes Doerfert
d2636dc390 [OpenMP][NFC] Fix diagnostic warnings 2023-11-27 16:02:34 -08:00
Johannes Doerfert
30fbe73ba9 [OpenMP][NFC] Remove else after return 2023-11-27 16:02:33 -08:00
Johannes Doerfert
755e108825 [OpenMP][NFC] Remove unused variable 2023-11-27 16:02:33 -08:00
Johannes Doerfert
77aa79d4fb [OpenMP][Docs] Cleanup libomptarget README 2023-11-27 16:02:33 -08:00
Joseph Huber
216040eef2 [OpenMP] Temporarily disable OMPT tests for x64
Summary:
These tests are currently failing, disable them so we can keep the bots
green until we find a better solution. The x64 tests are not the core
target so this is low priority.
2023-11-27 15:49:07 -06:00
Joseph Huber
71e3082d85 [OpenMP] Enable position independent code for libomptarget
Summary:
This option used to be passed manually by the `-fPIC` option that was
always enabled by the LLVM flags. Since we now do this manually we want
to specify that these are supposed for use fPIC code.
2023-11-27 14:51:48 -06:00
Johannes Doerfert
7bfcce3e94
[OpenMP] Tear down GenericDeviceTy's with GenericPluginTy (#73557)
There is no point in keeping GenericDeviceTy objects alive longer than
the associated GenericPluginTy. Instead of the old API we now tear them
down with the plugin, avoiding ordering issues.
2023-11-27 11:42:12 -08:00
Johannes Doerfert
f9436464a9 [OpenMP][NFC] Minor name and code simplification 2023-11-27 11:08:29 -08:00
Johannes Doerfert
2b2e711afc [OpenMP][NFC] Remove no-op __tgt_rtl_deinit_plugin
The order in which we deinit things, especially when shared libraries
are involved, is complicated. To simplify our lives the nextgen plugin
deinitializes the GenericPluginTy and subclasses automatically. The old
__tgt_rtl_deinit_plugin is not needed anymore.
2023-11-27 11:07:57 -08:00