aboutsummaryrefslogtreecommitdiff
path: root/openmp
AgeCommit message (Collapse)AuthorFilesLines
2023-12-07[OpenMP][Fix] Fix test initialization (#74801)Gheorghe-Teodor Bercea1-6/+6
Fix test initialization
2023-12-07Revert "[OpenMP][Fix] Fix test array initialization. (#74799)" (#74800)Gheorghe-Teodor Bercea1-6/+6
This reverts commit d41368134478d1d41726aa85ba82f49b5bce130c.
2023-12-07[OpenMP][Fix] Fix test array initialization. (#74799)Gheorghe-Teodor Bercea1-6/+6
Fix test array initialization.
2023-12-07Fix test. (#74745)jyu2-git1-0/+2
Just add // REQUIRES: libomptarget-debug So that test will not run with release compiler.
2023-12-07[OpenMP] Fix runtime problem due to wrong map size. (#74692)jyu2-git1-0/+23
Currently we are missing set up-boundary address for FinalArraySection as highests elements in partial struct data. Currently for: \#pragma omp target map(D.a) map(D.b[:2]) The size is: %a = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 0 %b = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 1 %arrayidx = getelementptr inbounds [2 x float], ptr %b, i64 0, i64 0 %2 = getelementptr float, ptr %arrayidx, i32 1 %3 = ptrtoint ptr %2 to i64 %4 = ptrtoint ptr %a to i64 %5 = sub i64 %3, %4 %6 = sdiv exact i64 %5, ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64) Where %2 is wrong for (D.b[:2]) is pointer to first element of array section. It should pointe to last element of array section. The fix is to emit the pointer to the last element of array section and use this pointer as the highest element in partial struct data. After change IR: %a = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 0 %b = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 1 %arrayidx = getelementptr inbounds [2 x float], ptr %b, i64 0, i64 0 %b1 = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 1 %arrayidx2 = getelementptr inbounds [2 x float], ptr %b1, i64 0, i64 1 %1 = getelementptr float, ptr %arrayidx2, i32 1 %2 = ptrtoint ptr %1 to i64 %3 = ptrtoint ptr %a to i64 %4 = sub i64 %2, %3 %5 = sdiv exact i64 %4, ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64)
2023-12-07[Libomptarget][Obvious] Fix incorrect if-else in CMake for destinationJoseph Huber2-2/+2
Summary: This was added in a previous patch to update how we export the static library used for OpenMP offloading. By mistake this if-else was using the output incorrectly. Fixes https://github.com/llvm/llvm-project/issues/74079
2023-12-06Revert " [OpenMP][NFC] Remove `DelayedBinDesc`" (#74679)Johannes Doerfert5-7/+25
Reverts llvm/llvm-project#74360 As I wrote in the analysis of #74360: Since https://github.com/llvm/llvm-project/commit/bc4e0c048aa3cd940b0cea787014c7e8680e5040 we will not add PluginAdaptors into the container of all plugin adaptors before the plugin is not ready. The error is thereby gone. When and old HSA loads other libraries they can call register_image but that will simply not register the image with the plugin we are currently initializing. That seems like reasonable behavior, thought it is good to keep in mind if we ever want a kernel library (@jhuber6 @mjklemm). We can still have a standalone kernel library though or load it late after all plugins are setup (which seems reasonable). I did not expect one our tests actually doing exactly what this will not allow anymore, at least when you use rocm <5.5.0. Need to figure out if we want this behavior (for rocm <5.5.0).
2023-12-06[OpenMP][NFC] Actually use a string in the error messageJohannes Doerfert1-1/+1
2023-12-06[OpenMP][FIX] Ensure we do not read outside the device image (#74669)Johannes Doerfert4-13/+48
Before we expected all symbols in the device image to be backed up with data that we could read. However, uninitialized values are not. We now check for this case and avoid reading random memory. This also replaces the correct readGlobalFromImage call with a isSymbolInImage check after https://github.com/llvm/llvm-project/pull/74550 picked the wrong one. Fixes: https://github.com/llvm/llvm-project/issues/74582
2023-12-06[OpenMP][FIX] Use unique library name to avoid clashes with other testsJohannes Doerfert1-2/+2
We probably should use a temporary name, but having stable names helps debugging.
2023-12-06 [OpenMP][NFC] Remove `DelayedBinDesc` (#74360)Johannes Doerfert5-25/+7
Remove `DelayedBinDesc` as it is not necessary since https://github.com/llvm/llvm-project/commit/bc4e0c048aa3cd940b0cea787014c7e8680e5040. See https://github.com/llvm/llvm-project/pull/74360#issuecomment-1843603736 for details.
2023-12-06[OpenMP] Allow to specify what plugins to look for (#74538)Johannes Doerfert3-11/+26
By default we now only look for the plugins we build, but the user can overwrite that with `LIBOMPTARGET_PLUGINS_TO_LOAD="cuda,amdgpu,x86_64"`
2023-12-06[Libomptarget] Add a utility function for checking existence of symbols (#74550)Joseph Huber6-23/+30
Summary: There are now a few cases that check if a symbol is present before continuing, effectively making them optional features if present in the image. This was done in at least three locations and required an ugly operation to consume the error. This patch makes a utility function to handle that instead.
2023-12-06[OpenMP] Disable offloading/barrier_fence testJP Lehr1-0/+2
Unblock build bot, while investigating. Issue is tracked under llvm https://github.com/llvm/llvm-project/issues/74582
2023-12-05[OpenMP][FIX] Fixup test that doesn't work with lit's `env` substituteJohannes Doerfert1-2/+2
2023-12-05[OpenMP] Reorganize the initialization of `PluginAdaptorTy` (#74397)Johannes Doerfert5-99/+137
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[OpenMP][FIX] Ensure we allow shared libraries without kernels (#74532)Johannes Doerfert6-12/+51
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-04[OpenMP] Ensure `Devices` is accessed exlusively (#74374)Johannes Doerfert9-226/+237
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-03[OpenMP] return empty stmt for `nothing` (#74042)Sandeep Kosuri1-0/+27
- `nothing` directive was effecting the `if` block structure which it should not. So return an empty statement instead of an error statement while parsing to avoid this.
2023-12-01[OpenMP][NFC] Remove PluginAdaptorManagerTyJohannes Doerfert4-205/+198
2023-12-01[OpenMP][FIX] Fixup testJohannes Doerfert1-1/+1
2023-12-01[OpenMP][NFCI] Organize offload entry logicJohannes Doerfert10-55/+179
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[OpenMP][NFC] Extract device image handling into a class/header (#74129)Johannes Doerfert6-47/+103
2023-12-01[OpenMP] Separate Requirements into a standalone header (#74126)Johannes Doerfert8-71/+118
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[OpenMP] Re-enable KMP_HAVE_QUAD on NetBSD 10.0 with GCC 10.5 (#73478)Brad Smith1-2/+3
2023-12-01[OpenMP] Add an INFO message for data transfer of kernel launch env. (#74030)dhruvachak1-0/+6
2023-12-01[OpenMP][NFC] Extract OffloadPolicy into a helper class (#74029)Johannes Doerfert4-41/+68
OpenMP allows 3 different offload policies, handling of which we want to encapsulate.
2023-12-01[OpenMP][NFC] Modernize the plugin handling (#74034)Johannes Doerfert5-174/+170
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[OpenMP][flang] Adding more tests for commonblock with target map (#71146)Shraiysh1-4/+51
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[amdgpu] Default to 1.0, instead of unspecified, for dynamic hsa (#74098)Jon Chesterfield1-0/+9
The plugin checks the values of HSA_AMD_INTERFACE_VERSION_* so we now set them to something safe in the header.
2023-12-01[OpenMP] Fix libomptarget build issue (#74067)Dominik Adamski1-1/+0
Libomptarget cannot be build because of the recent refactoring introduced in patch 148dec9fa43b : [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-11-30[OpenMP][NFC] Move mapping related logic into Mapping.h (#74009)Johannes Doerfert4-21/+21
2023-11-30[OpenMP][NFC] Encapsulate Devices.size() (#74010)Johannes Doerfert2-16/+13
2023-11-30[OpenMP][NFC] Encapsulate profiling logic (#74003)Johannes Doerfert3-15/+72
This simply puts the profiling logic into the `Profiler` class and allows non-RAII profiling via `beginSection` and `endSection`.
2023-11-30[OpenMP][NFC] Separate Envar (environment variable) handling (#73994)Johannes Doerfert8-196/+212
2023-11-30[OpenMP] Replace copy and paste code with instantiation (#73991)Johannes Doerfert9-211/+116
2023-11-30[Libomptarget] Output the DeviceRTL alongside the other libraries (#73705)Joseph Huber4-3/+15
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[OpenMP] Start organizing PluginManager, PluginAdaptors (#73875)Johannes Doerfert11-229/+264
2023-11-30Revert "[OpenMP] Use simple VLA implementation to replace uses of actual VLA"Shilei Tian3-64/+4
This reverts commit 97e16da450e94c92456fa5a74768ec1b22fe6b63 because it causes build error on i386 system.
2023-11-29[OpenMP] Add an 'stddef.h' include to 'omp.h' (#73876)Joseph Huber1-0/+1
Summary: We use `size_t` internally in the omp.h header, which is normally provided by `stdlib.h` which is already included. Howevever, some cases when using `-ffreestanding` can result in this not being defined via `stdlib.h`. This patch simply adds an explicit inclusion of this header, which is provided by the `clang` resource directory, to resolve this in all cases.
2023-11-29[OpenMP][NFC] Move out plugin API and APITypes into standalone headers (#73868)Johannes Doerfert7-78/+108
2023-11-29[OpenMP] Avoid initializing the KernelLaunchEnvironment if possible (#73864)Johannes Doerfert1-2/+5
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[OpenMP][NFC] Separate OpenMP/OpenACC specific mapping code (#73817)Johannes Doerfert6-429/+474
While this does not really encapsulate the mapping code, it at least moves most of the declarations out of the way.
2023-11-29[OpenMP][NFC] Move more declarations out of private.h (#73823)Johannes Doerfert5-116/+128
2023-11-29[OpenMP][NFC] Put ExponentialBackoff in a Utils header (#73816)Johannes Doerfert3-30/+55
"private.h" will go.
2023-11-29[OpenMP][NFC] Rename OmptCallback.cpp into OpenMP/OMPT/Callback.cpp (#73813)Johannes Doerfert2-9/+11
Also revert the ifdef OMPT_SUPPORT order to have the short fallback first and not after 400 lines.
2023-11-29[OpenMP][NFC] Replace unnecessary typedefs (#73815)Johannes Doerfert3-25/+20
2023-11-29[OpenMP][NFC] Move OMPT headers into OpenMP/OMPT (#73718)Johannes Doerfert13-27/+27
2023-11-29[OpenMP][NFC] Flatten plugin-nextgen/common folder sturcture (#73725)Johannes Doerfert19-108/+99
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[OpenMP][NFC] Extract timescope profile support into its own header (#73727)Johannes Doerfert7-19/+44