Commit graph

3714 commits

Author SHA1 Message Date
Jan Patrick Lehr
6d8d7d00a6
[OpenMP] Add target to build OpenMP runtime (#189557)
This adds a top-level target to build the OpenMP runtime, similar to
what was done in https://github.com/llvm/llvm-project/pull/186099 for
the Offload runtime.

Having this top-level target enables us to execute the build in the
pre-commit CI as shown in
https://github.com/llvm/llvm-project/pull/174955 (I actually just
cherry-picked the commit from that branch)
2026-05-05 11:40:06 +02:00
Xing Xue
f56e695272
[libomp] Set arch string for PPC (#195129)
Add the missing arch string for PPC.
2026-04-30 16:30:30 -04:00
Joseph Huber
105bd6b654
[Offload] Clean up and split Shared/Utils.h (#194876)
Summary:
This is used in the GPU portion of the build, but really shouldn't be.
Most of these helpers were only used by the GPU portion, which has much
nicer builtins available in new clang. Using these in the main offload
build is broken on Windows and not available on older compilers, so we
split. Also means one less header we share.

The alignment helpers are trivially replaced by an LLVM utility, the
only thing that remains are the pointer arithmetic functions. There's no
conveient place to put these so I just let them stay.
2026-04-29 13:10:38 -05:00
Jan André Reuter
0a4798ad4b
[OMPT][OpenMP] Use omp_initial_device for host in callbacks (#192924)
The OpenMP specification offers different ways for identifying the host
device. While users of the OpenMP API can use `omp_get_initial_device()`
or the constant `omp_initial_device` (available since OpenMP v5.2), a
tool needs to rely on the `initial_device_num` passed by the OpenMP
runtime during the `initialize` callback.

In #134451, it was discovered that the `initial_device_num` passed is
always `0`, regardless of any device are available for offload
execution. For host-only OpenMP code, this matches the result of
`omp_get_num_devices()`, and is a valid result. In the case of devices
being available though, this passed identifier is incorrect. While
`libomp` calls `omp_get_num_devices()`, `libomptarget` has not fully
initialized its PluginManager at that point, hence returning no
available devices. Tools relying on `initial_device_num` might therefore
incorrectly assume host-side execution when some code runs on a device.
Since the `ompt_get_num_devices()` entry point is also not fully
implemented, tools currently need to do on-the-fly handling for the host
device.

To make handling easier, consistently use the `omp_initial_device`
identifier as the `initial_device_num` and for all device callbacks.
This does not rely on knowing the number of available devices during
OMPT initialization in the runtime and ensures a consistent value for
tools to handle.

Closes #134451

Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
2026-04-29 12:06:41 +02:00
Mark Zhuang
ab43ab6158
[OpenMP] Fix use of uninitialized Dl_info when dladdr fails in ompd_init (#193643)
When dladdr() fails, dl_info is left uninitialized. The code printed the
error but then fell through to unconditionally call
strrchr(dl_info.dli_fname, '/'), accessing an uninitialized pointer --
typically NULL on the stack -- causing a SIGSEGV.

Fix by turning the second 'if' into 'else if', so the path-extraction
block is only reached when dladdr() succeeded and dl_info is valid.

Assisted-by: Claude Sonnet 4.6
2026-04-29 05:05:33 +08:00
Amit Tiwari
3c14034c55
[Flang][OpenMP] Validate omp_initial_device omp_invalid_device as device IDs (#193669)
As per OpenMP 5.2/6.0 the below are valid device values in a `#pragma
omp target` directive:

omp_initial_device (-1) -> refers to the host CPU.
omp_invalid_device (-2) -> an intentionally invalid device, used to
trigger a runtime error.

For the 2 values discussed above flang fails with:

```
error: The device expression of the DEVICE clause must be a positive integer expression
      !$OMP TARGET DEVICE(-1)
error: Must have INTEGER type, but is REAL(4)
      !$OMP TARGET DEVICE(OMP_INVALID_DEVICE)

```
Issue: https://github.com/llvm/llvm-project/issues/192989
2026-04-28 21:31:04 +05:30
Julian Brown
cced408278
[OpenMP] Rename ompx_taskgraph->omp_taskgraph_experimental
This patch renames the option to enable taskgraph support in the
runtime from OMPX_TASKGRAPH to OMP_TASKGRAPH_EXPERIMENTAL, to reflect
the feature's official status in OpenMP 6.0, but also the feature's
current work-in-progress nature.

commit-id:fa62775a

Reviewers: ro-i

Reviewed By: ro-i

Pull Request: https://github.com/llvm/llvm-project/pull/194045
2026-04-28 10:38:09 +01:00
Amit Tiwari
09cd294482
[Clang][OpenMP] Validate omp_initial_device omp_invalid_device as device IDs (#193688)
The counterpart fix for clang (as too done here:
[flang-fix](https://github.com/llvm/llvm-project/pull/193669))

The incorrectly interpreted device values in the `target` directive
throws:
 
```
 error: argument to 'device' clause must be a non-negative integer value
    #pragma omp target device(-1)
                              ^~
error: argument to 'device' clause must be a non-negative integer value
    #pragma omp target device(omp_invalid_device)
                              ^~~~~~~~~~~~~~~~~~
```
2026-04-28 14:28:37 +05:30
Julian Brown
295a7a9f75
[OpenMP] Make loop index unsigned in __kmpc_omp_task_with_deps/__kmp_omp_task
NFC.

Co-authored-by: Adrian Munera <adrian.munera@bsc.es>

Reviewers: ro-i

Pull Request: https://github.com/llvm/llvm-project/pull/194044
2026-04-27 10:34:35 +01:00
nvptm
8b96c2104e
[flang] Add comparison operators for c_devptr (#192687) 2026-04-23 15:13:34 -07:00
Kevin Sala Penades
3baafed3e7
[NFC][offload][OpenMP] Fix kernel replay documentation (#193832) 2026-04-23 13:13:12 -07:00
Kevin Sala Penades
254fcbefac
[offload][OpenMP] Add basic documentation for kernel record replay (#193699) 2026-04-23 09:44:06 -07:00
Kevin Sala Penades
df77a29237
[offload] Fix envar description in docs (#193642) 2026-04-23 09:42:34 -07:00
Joseph Huber
58127f3ebf
[OpenMP] Fix OpenMP device subdir installation w/ multilibs (#193378)
Summary:
These did not use the correct subdir so if you did a mulitilib build of
the OpenMP runtime it would simply overwrite it.
2026-04-22 07:46:12 -05:00
Nick Sarnie
5aea02a163
[OpenMP][Device] Fix __llvm_omp_indirect_call_lookup function pointer types (#192502)
`__llvm_omp_indirect_call_lookup` takes in and returns a function
pointer, so make sure the types are correct, which includes the correct
address space.

The FE was recently changed to generate the correct code
[here](https://github.com/llvm/llvm-project/pull/192470).

With this change, three function pointer tests start passing.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-04-16 18:51:52 +00:00
Kevin Sala Penades
18bed37e5d
[offload][OpenMP] Require CUDA 11.8 (#191100) 2026-04-15 17:01:51 -07:00
Alexandre Ganea
40690e55a8
[openmp] Fix Darwin after 988e00e (#192135)
As per
https://github.com/llvm/llvm-project/pull/191556#issuecomment-4246459320
2026-04-15 07:15:14 -04:00
Wenju He
9b8611b1c5
[OpenMP] Create check-openmp target for device targets (#192175)
offload/cmake/caches/AMDGPUBot.cmake enables
RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES="openmp". In that
sub-build, check-openmp target doesn't exist and there is build error
`unknown target 'check-openmp'` after 18f63d1375, which makes
top-level check-openmp depend on check-openmp-amdgcn-amd-amdhsa.

In openmp, the device targets only call add_subdirectory(device), which
doesn't calls construct_check_openmp_target() and check-openmp target
doesn't exist. `ninja check-openmp-amdgcn-amd-amdhsa` also fails with
the same error before 18f63d1375.

Fix by adding construct_check_openmp_target() for device targets as well.

Assisted-by: Claude Sonnet 4.6
2026-04-15 10:42:28 +08:00
Jan André Reuter
1737a913ed
[OpenMP][OMPT] Revert control_tool.c changes from #191429 (#192069)
On s390x, the changes to `control_tool.c` cause a different return
address to be returned from the call to `print_current_address(0)`. Due
to the strictness of the current address returned by this call, this
lead to a test failure.

Since the return values of `omp_control_tool` are checked in separate
tests already, revert the changes to ensure that the return address
stays at the expected value.

Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
2026-04-14 16:54:57 +02:00
Ye Luo
aab5c1075a
[Offload] Revert part of #187138. Workaround #191910 (#191925)
Closes #191910

---------

Co-authored-by: Joseph Huber <huberjn@outlook.com>
2026-04-14 02:39:32 +00:00
Alexandre Ganea
988e00ebcd
[openmp] Silence warnings when building on Windows (#191556)
Fixes unused-but-set globals on non-Unix paths in kmp_alloc.cpp
2026-04-13 07:11:35 -04:00
Amit Tiwari
1d18740d30
[Clang][OpenMP] Implement Loop splitting #pragma omp split directive (#190397)
Implement Loop-splitting #pragma omp split construct with counts clause.
Posting this PR after the revert of PR
([#183261](https://github.com/llvm/llvm-project/pull/183261))

Changes: 

1. Added `openmp/runtime/test/transform/split/lit.local.cfg`
2. Enforced ICE for `counts` clause items in `SemaOpenMP.cpp` (minor
change)
3. Updated tests `split_messages.cpp`, `split_omp_fill.cpp`,
`split_diag_errors.c`.
4. Removed `nonconstant_count.cpp`
2026-04-13 12:39:40 +05:30
Robert Imschweiler
54d4bf2acb
[OpenMP] Fix nondependent inscan variables in templated functions (#191627)
Fixes https://github.com/llvm/llvm-project/issues/191549.

Assisted-by: claude-4.6-opus
2026-04-11 15:17:42 +02:00
Jan André Reuter
c6bcd19425
[OpenMP][OMPT] Fix omp_control_tool before any directive (#191429)
When a user calls `omp_control_tool`, a tool is attached and it
registered the `ompt_control_tool` callback, the tool should receive a
callback with the users arguments.

However, in #112924, it was discovered that this only happens after at
least one host side directive or runtime call calling into
`__kmp_do_middle_initialize` has been executed.

The check for `__kmp_init_middle` in `FTN_CONTROL_TOOL` did not try to
do the middle initialization and instead always returned `-2` (no tool).
A tool therefore received no callback. The user program did not get the
info that there is a tool attached. To fix this, change the explicit
return to a call of `__kmp_middle_initialize()`, as done in several
other places of `libomp`.

Further handling is then done in `__kmp_control_tool`, where the values
`-2` (no tool), `-1` (no callback), or the tools return value are
returned.

Also expand the tests to introduce checks where no callaback is
registered, or `omp_control_tool` is called before any OpenMP directive.

Fixes #112924

CC @jprotze, @hansangbae

Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
2026-04-10 17:07:07 +02:00
theRonShark
00aede8f19
Revert "[Clang][OpenMP] Implement Loop splitting #pragma omp split directive " (#190335)
Reverts llvm/llvm-project#183261

15 new lit tests failing in openmp
2026-04-03 12:27:07 +00:00
Amit Tiwari
1972cf64fd
[Clang][OpenMP] Implement Loop splitting #pragma omp split directive (#183261)
OpenMP 6.0 Loop-splitting directive `#pragma omp split` construct with `counts`
clause
2026-04-03 10:42:31 +05:30
Michael Kruse
afb80bddf1
[Runtimes] Introduce variables containing resource dir paths (#177953)
Introduce common infrastructure for runtimes that determines compiler
resource path locations. These variables introduced are:

 * RUNTIMES_OUTPUT_RESOURCE_DIR
 * RUNTIMES_INSTALL_RESOURCE_PATH
 
That contain the location for the compiler resource path (typically
`lib/clang/<version>`) in the build tree and the install tree (the
latter relative to CMAKE_INSTALL_PREFIX).

Additionally, define

 * RUNTIMES_OUTPUT_RESOURCE_LIB_DIR
 * RUNTIMES_INSTALL_RESOURCE_LIB_PATH

as for the location of clang/flang version-locked libraries (typically
`lib${LLVM_LIBDIR_SUFFIX}/<targer-triple>`, but also depends on `APPLE`
and `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR`). This code is moved from
flang-rt and initially becomes its only user.

Refactored out of #171610 as requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2687382481).

Extracted `get_runtimes_target_libdir_common` from compiler-rt as
requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2689565634).
 
Added TODO comments to all runtimes as requested
[here](https://github.com/llvm/llvm-project/pull/171610#issuecomment-3789598635).
2026-04-02 10:32:14 +00:00
David Truby
720b8ea893
[openmp] Add support for Arm64X to libomp (#176157)
This patch allows building libomp.dll and libomp.lib as Arm64X binaries
containing both arm64 and arm64ec code and useable from applications
compiled for both architectures.
2026-03-31 16:39:02 +01:00
David Truby
161c53f66e
[openmp] Add support for arm64ec to libomp (#176151)
This patch adds arm64ec support to libomp.
Note that this support isn't entirely usable on Windows hosts as libomp
requires LLVM_PER_TARGET_RUNTIME_DIR=On for to work correctly when
multiple runtimes are built, which is unsupported on Windows. A
following patch will add arm64x support to the build to rectify this.
2026-03-31 13:07:19 +01:00
fineg74
1611a23a5b
[OFFLOAD] Add spirv implementation for named barrier (#180393)
This change adds implementation for named barriers for SPIRV backend.
Since there is no built in API/intrinsics for named barrier in SPIRV,
the implementation loosely follows implementation for AMD
2026-03-27 20:14:09 +01:00
Michael Kruse
8ab7b37e74
[OpenMP][test] Remove %flags-use-compiler-omp-h (#188789)
With the standalone and project builds removed,
`OPENMP_TEST_COMPILER_HAS_OMP_H`/`config.test_compiler_has_omp_h` is set
to constant 1, which causes the `config.omp_header_directory` search
path NOT to be added to `%flags-use-compiler-omp-h`, causing the system
`omp.h` used, or the only test actually using it
(`omp50_taskdep_depobj.c`) failing if that one is not available.

The intention of `OPENMP_TEST_COMPILER_HAS_OMP_H` was to use gcc's
`omp.h` which declares `omp_depend_t` differently than our `omp.h`
(https://reviews.llvm.org/D108790). Using `OPENMP_TEST_C_COMPILER=gcc`
was used to test libomp's GOMP compatibility layer, but testing it is
currently unmaintained and has no buildbot (60 failing tests out of 389
with gcc-13, not including OMPD and OMPT). If updating testing for GOMP,
then gcc's own `omp.h` must be used for all tests: using the GOMP ABI
requires using GOMP's `omp.h`.

Closes: #187879
2026-03-27 10:59:06 +01:00
Joseph Huber
82530154ef
[Offload] Enable multilib building for OpenMP/Offload (#188485)
Summary:
Right now the CMake does not follow the pattern other runtime projects
use. All this does is use the standard subdir to place libraries in a
unique location. This allows, for example, users to configure a debug
version of openmp / offload within the same CMake invocation.

---------

Co-authored-by: Michael Kruse <github@meinersbur.de>
2026-03-26 07:37:22 -05:00
Alex Duran
3e72f02e20
[Offload][OpenMP][libdevice] Make check to enter state machine architecture dependent (#188144)
The genericStateMachine call uses synchronize::thread wich is expected
to be implemented using a workgroup level barrier.
Currently as in some other architectures where if threads in the same
warp as the main thread reach the barrier may cause a race condition
there's a condition that makes some threads not enter the state machine.
But in Intel GPUs all threads must reach the barrier for it to be
completed, otherwise the threads in the state machine never make
progress.

This PR moves the condition into an architecture-dependent config so it
can work correctly for both kinds of hardware.
2026-03-25 16:22:22 +01:00
Joseph Huber
d18a784d41
[compiler-rt] Define GPU specific handling of profiling functions (#185763)
Summary:
The changes in https://www.github.com/llvm/llvm-project/pull/185552
allowed us to
start building the standard `libclang_rt.profile.a` for GPU targets.
This PR expands this by adding an optimized GPU routine for counter
increment and removing the special-case handling of these functions in
the OpenMP runtime.

Vast majority of these functions are boilerplate, but we should be able
to do more interesting things with this in the future, like value or
memory profiling.
2026-03-19 10:51:48 -05:00
Joseph Huber
073d019c45
[OpenMP] Use the standard fences now that they are supported (#187138)
Summary:
We can now use these on NVPTX properly.
2026-03-18 08:42:07 -05:00
Jan André Reuter
1588f08369
[OpenMP][OMPT] Add missing error entry to device tracing record union (#185683)
While `omp-tools.h` already includes the `ompt_record_error_t` struct,
the corresponding union entry was missing from `ompt_record_ompt_t`.
This commit adds the missing entry.

Note that this does not enable any functionality for device tracing
records.
This only aligns the struct with OpenMP v5.1 and newer. OpenMP v5.0 did
not contain the `error` directive.

CC: @jprotze

Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
2026-03-17 10:00:21 +01:00
Chi-Chun, Chen
2ad51ffbfa
[mlir][llvmir][OpenMP] Translate affinity clause in task construct to llvmir (#182223)
Translate affinity entries to LLVMIR by passing affinity information to
createTask (__kmpc_omp_reg_task_with_affinity is created inside
PostOutlineCB).

3/3 in stack for implementing affinity clause with iterator modifier
1/3 #182218
2/3 #182222
3/3 #182223
2026-03-16 10:16:38 -05:00
Kevin Sala Penades
ac71b185c2
[offload] Remove LIBOMPTARGET_SHARED_MEMORY_SIZE envar (#186231)
This commit removes the `LIBOMPTARGET_SHARED_MEMORY_SIZE` envar and
outputs a runtime warning if it is defined. Access to dynamic shared memory
should be obtained through the `dyn_groupprivate` clause (OpenMP 6.1) or
the launch arguments in liboffload kernel launch.
2026-03-12 21:21:29 -07:00
Michael Halkenhäuser
4f2dea8ac7
[OpenMP][OMPT] Remove Threads dependency from omptest link interface (#186183)
Link against Threads using PRIVATE scope, instead of PUBLIC.
Reason: it imposes a transitive dependency on library users.

If Threads could not be found this could cause a link error.
The issue would manifest, if omptest is used via find_package.

Addresses issues with previous PR
https://github.com/llvm/llvm-project/pull/185930
2026-03-12 18:16:36 +01:00
Kelvin Li
9ddf38b008
[OpenMP] Include the cmake policy file (#186031)
This patch is to enforce building shared library archive by default on
AIX as described in CMP0182.
2026-03-12 11:54:11 -04:00
Jan Patrick Lehr
1cd094fb70
Revert "[OpenMP][OMPT] Remove Threads dependency from omptest" (#186111)
Reverts llvm/llvm-project#185930

Breaks various buildbots
2026-03-12 13:51:01 +01:00
Michael Halkenhäuser
5f97e191b3
[OpenMP][OMPT] Remove Threads dependency from omptest (#185930)
Removed link against `Threads`.
Reason: it is potentially problematic and optional.

The issue would manifest, if `omptest` is used via `find_package`.
But `Threads` might not be found and cause a link error.
2026-03-12 13:08:49 +01:00
Kevin Sala Penades
1f583c6dee
[OpenMP][Offload] Add offload runtime support for dyn_groupprivate clause (#152831)
Part 3 adding offload runtime support. See
https://github.com/llvm/llvm-project/pull/152651.

---------

Co-authored-by: Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>
2026-03-12 01:13:06 -07:00
Robert Imschweiler
fd578f7c5c
[libomp] Fix hwloc include for non-standard paths (#184087)
Fixes https://github.com/llvm/llvm-project/issues/183884

---------

Co-authored-by: Michael Kruse <llvm-project@meinersbur.de>
2026-03-02 18:03:36 +01:00
Michael Kruse
87cbea6cdc
[openmp][cmake][NFCI] Avoid non-eval uses of ${var} (#182267)
When using

    set(var "Example")
    if (${var})

CMake will first resolve the if-argument to

    if (Example)

And what then happens depends on the existance of a variable with the
name "Example":

1. If instead of "Example", a truth constant is used ("TRUE", "FALSE",
   "ON", "OFF", "", "-NOTFOUND" ...), it is prioritized
   (https://cmake.org/cmake/help/latest/command/if.html#constant)

2. If a variable with the name "Example" exists: Use the truthiness of
   its content
   (https://cmake.org/cmake/help/latest/command/if.html#variable)

3. Otherwise, it is false-y

That is, the the result of the conditional does not only depend on the
content of `var`, but also some other variable. This is usually
unintended and leads to problems such as addressed with #154537. The
only case where this is intended is when passing an expression to be
evaluated such as with `pythonize_bool`, `append_if` and
`libomp_append`. In all other cases, using `${var}` without quotes is a
pattern to be avoided.

Remark:
If `${var}` is not one of the values considered a [truthiness
constant](https://cmake.org/cmake/help/latest/command/if.html#constant),
the result of `if (var)` and `if ("${var}")` is different:

* `if (var)` is true-ish
  (https://cmake.org/cmake/help/latest/command/if.html#variable)

* `if ("Example")` and therefore `if ("${var}")` are false-y
  (https://cmake.org/cmake/help/latest/command/if.html#string)

In this PR I am preferring `if (var)` over `if ("${var}")` because has
less clutter, resembles Python's behaviour, and problably what most
users are expecting, even though `if (${var})` in most cases would
evaluate to false-y because a variable does not exist. This ambiguity
does not exist for STREQUAL and MATCHES.
2026-03-02 13:21:36 +01:00
Joachim
d44e417945
[openmp][tests] Fix bug63197.c (#183508)
#183269 tried to fix the test, but the test can still randomly fail. The
OpenMP spec does not prevent the runtime to chose a smaller team size
than returned from omp_max_threads() for the second parallel region.

Using a larger value than `omp_max_threads()` in a `num_threads` clause
is valid OpenMP code. With a correct OpenMP implementation, the
team-size of the second parallel region must still be smaller or equal
the value returned from `omp_max_threads()`.
2026-02-26 17:26:47 +01:00
Nikita Popov
368b884869
[openmp] Fix bug63197.c test with 3 cores (#183269)
This test assumes that the number of available threads is not 3,
otherwise `#pragma omp parallel` and `#pragma omp parallel
num_thread(3)` are naturally going to do the same thing.

Instead use `omp_get_max_threads() - 1` as the number of threads in the
initial `omp parallel num_thread(N)` and then check that the number of
threads does not match the value in the later `omp parallel`.
2026-02-25 15:58:23 +01:00
Martin Storsjö
48a5119d8e
[openmp] Allow testing OpenMP without a full clang build tree (#182470)
Having a build tree with "not" and "FileCheck" is still required, but if
Clang/Flang isn't configured in that build, run the tests with the same
compiler CMake uses. This is how testing worked in the standalone build
configurations that now have been removed.
2026-02-23 23:01:44 +02:00
Michael Kruse
6295b8e763
[OpenMP] Remove standalone build mode (Reapply #149878) (#182022)
This reapplies #149878

Remove all the CMake code for openmp standalone builds. Standalone
builds have been superseded by the runtimes default build (also
sometimes called the standalone runtimes build). The runtimes default
build can be thought of a standalone build with the standalone
boilerplate contained in <llvm-project>/runtimes/CMakeLists.txt. There
is no need for each runtime to contain the same boilerplate code again.

Builds still using the standalone build via
```sh
cmake -S <llvm-project>/openmp ...
```
can switch over to the runtimes default build using
```sh
cmake -S <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp ...
```
Options that were valid for the standalone build are also valid for
default runtimes build, unless handled only in `if
(OPENMP_STANDALONE_BUILD)` regions.

The existence of both, standalone builds and runtime default builds,
easily leads to confusion such as fixed in #149871. A non-standalone
build does not mean that it is built as part of a bootstrapping-build of
LLVM inside the `runtimes/runtimes-bins` directory, nor does it mean
that the compiler is necessarily Clang. Some of the remaining code may
have been written with that assumption. However, the purpose of this
patch is to only remove the standalone build functionality.
2026-02-18 18:11:55 -05:00
Michael Kruse
e07b9d1504 Revert "[OpenMP] Remove standalone build mode (#149878)"
Downstream builds are note sufficiently prepared.

This reverts commit 176928cc13.
2026-02-18 13:52:41 +01:00
Michael Kruse
176928cc13
[OpenMP] Remove standalone build mode (#149878)
Remove all the CMake code for openmp standalone builds. Standalone
builds have been superseded by the runtimes default build (also
sometimes called the standalone runtimes build). The runtimes default
build can be thought of a standalone build with the standalone
boilerplate contained in <llvm-project>/runtimes/CMakeLists.txt. There
is no need for each runtime to contain the same boilerplate code again.

Builds still using the standalone build via
```sh
cmake -S <llvm-project>/openmp ...
```
can switch over to the runtimes default build using
```sh
cmake -S <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp ...
```
Options that were valid for the standalone build are also valid for
default runtimes build, unless handled only in
`if (OPENMP_STANDALONE_BUILD)` regions.

The existence of both, standalone builds and runtime default builds,
easily leads to confusion such as fixed in #149871. A non-standalone
build does not mean that it is built as part of a bootstrapping-build of
LLVM inside the `runtimes/runtimes-bins` directory, nor does it mean
that the compiler is necessarily Clang. Some of the remaining code may
have been written with that assumption. However, the purpose of this
patch is to only remove the standalone build functionality.
2026-02-18 12:00:04 +01:00
Ferran Toda
f560e4cfb1
[MLIR][OpenMP] Add omp.fuse operation (#168898)
This patch is a follow-up from #161213 and adds the omp.fuse loop
transformation for the OpenMP dialect. Used for lowering a `!$omp fuse`
in Flang.

Added Lowering and end2end tests.
2026-02-17 15:34:27 +01:00
Joseph Huber
d85576d368
[libc] Replace RPC 'close()' mechanism with RAII handler (#181690)
Summary:
Closing ports was previously done manually, This makes the protocol more
error prone as unclosed ports will leak and eventually the locks will
run out. I believe the original fear was that the RAII portion would
negatively impact code generation but I have not noticed anything
significant.
2026-02-16 15:14:30 -06:00
Nick Sarnie
b217e5c5a0
[OpenMP][lit] Disable flaky test tasking/issue-94260-2.c (#176452)
The test sporadically fails on Linux. See
https://github.com/llvm/llvm-project/issues/176451 for more info.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-02-13 17:06:36 +00:00
Nikita Popov
05ea779fcf
[openmp] Remove perl mentions (#181371)
These tests were converted from Perl to Python in #95307, so there is no
perl dependency here anymore. (I omitted an explicit mention of Python
here, as that's a general dependency anyway.)
2026-02-13 15:11:31 +00:00
fineg74
e0293fc7a5
[OFFLOAD] Add support for SPIRV to ompx (#179849)
After adding support to build device RTL for SPIRV, this PR will make an
ompx to use the DeviceRTL API when compiled for SPIRV
2026-02-13 06:55:44 -06:00
Joseph Huber
a969d572c2
[OpenMP] Remove special handling for SPIR-V uinc atomic (#180747)
Summary:
No longer necessary after
https://github.com/llvm/llvm-project/pull/179114
2026-02-10 10:21:16 -06:00
YunQiang Su
74e9bc6cb9
openmp: add atomic to SANITIZER_COMMON_LINK_LIBS for MIPS (#179933)
atomic is needed explicitly for MIPS.
2026-02-06 08:17:56 +08:00
Nick Sarnie
02d8c9c63a
[OpenMP] Stub vprintf on non-NVPTX if no libc (#180025)
The AMDGPU check was added in
https://github.com/llvm/llvm-project/pull/123670 where the reasoning
seems to be that the NVIDIA SDK will provide `vprintf` for the NVPTX
case and AMDGPU was the only other supported target at the time.

SPIR-V also needs this stubbed out, so just check that it's not NVPTX.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-02-05 22:11:32 +00:00
Michael Kruse
c15853ec3a
[OpenMP] Remove LLVM_ENABLE_PROJECTS=openmp build mode (#176950)
Reapply #152189 and #174963 which were reverted because it broke
publish-sphinx-docs and publish-doxygen-docs.

The build mode has been deprecated in #136314 and was supposed to be
removed in the LLVM 21 release (#136314).

OpenMP currently supports 4 build modes:

 * `cmake <llvm-project>/llvm -DLLVM_ENABLE_PROJECTS=openmp`
 * `cmake <llvm-project>/llvm -DLLVM_ENABLE_RUNTIMES=openmp` (bootstrapping build)
 * `cmake <llvm-project>/openmp` (standalone build)
 * `cmake <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp` (runtimes default/standalone build)

Each build mode increased the maintanance overhead since all build modes
must continue working and user confusion when there do not (see #151117,
#174126, #154117, ...). Let's finally remove it.
2026-01-30 21:05:29 +01:00
Joseph Huber
830236204e
[Offload] Provide a cache file for building OpenMP w/ Flang offloading (#178472)
Summary:
This build is more annoying, enables everything required for this
version of the runtime.
2026-01-29 12:35:42 -06:00
Michael Kruse
dd76d3382c
[OpenMP][docs] Revise building manual (#176175)
Go into more detail on the two non-legacy build modes. 

I decided use create a dedicated document documention the build process.
`index.rst` only keeps the "Getting Started" part. `README.rst` is
vastly outdated with the still valid parts integrated into the new
documentation. `SupportAndFAQ.rst` is unstructured and keeps only the
non-building parts.

The the new building document is written in Meltdown, following the
decision from LLVM.
2026-01-28 14:13:41 +01:00
Joseph Huber
5b98c9be17 [OpenMP] Small fixes after refactoring and adding SPIR-V support 2026-01-27 15:57:21 -06:00
fineg74
8db9774118
[OFFLOAD] Build DeviceRTL with SPIRV backend (#174675)
This PR adds configuration to build DeviceRTL with SPIRV backend. It is
primarily used for level-zero plugin for Intel GPUs

---------

Co-authored-by: Joseph Huber <huberjn@outlook.com>
2026-01-27 00:09:28 +00:00
Joseph Huber
5597903240
[OpenMP] Cleanup synchronization primitives (#177710)
Summary:
These shouldn't be so different after we moved away from variants. It's
much simpler to define this in-line with a single preprocessor
definition. This should be equivalent less a few unnecessary function
definitions with the advantage that SPIR-V now has less work to do.
2026-01-26 14:20:52 -06:00
Joseph Huber
3219f1a5ce [OpenMP] Force initialization of global device environment
Summary:
This causes issues when we omit this, which requires a constructor from
an incompatible address space and bad things happen.
2026-01-22 16:45:49 -06:00
Joseph Huber
d5899ccb6f
[Clang] Rename uinc_wrap and add normal atomic builtin (#177253)
Summary:
The `__scoped_atomic` builtins are supposed to match the standard
GNU-flavored `__atomic` builtins. We added a scoped builtin without a
corresponding standard one before the fork so this should be added in
the release candidate. These were originally added in
https://github.com/llvm/llvm-project/pull/168666

Also, the name `uinc_wrap` does not follow the naming convention. The
GNU atomics use `fetch_xyz` to indicate that the builtin returns the
previous location's value as part of the RMW operation, which these do.
This PR renames it and its uses.
2026-01-22 08:02:45 -06:00
Joseph Huber
f534711729
[OpenMP][NFC] Use uinc atomic builtins for this operation (#177207)
Summary:
We support this now, this is 1-to-1 equivalent and simply prevents us
from needing to do it ourselves.
2026-01-21 11:31:23 -06:00
Michael Kruse
8acf454ed1 Revert "[OpenMP] Remove LLVM_ENABLE_PROJECTS=openmp build mode (#174963)"
This reverts commit f7b5b670c1.

It had broken the publish-doxygen-docs buildbot
2026-01-20 13:00:54 +01:00
Michael Kruse
f7b5b670c1
[OpenMP] Remove LLVM_ENABLE_PROJECTS=openmp build mode (#174963)
Reapply #152189 which was reverted because it broke publish-sphinx-docs.

The build mode has been deprecated in #136314. According to the
deprecation message, it was supposed to be removed in the LLVM 21
release. Each build mode increased the maintanance overhead when
failing, such as in #151117.
2026-01-20 11:55:43 +01:00
Michael Halkenhäuser
696b91aeb7
[OpenMP][omptest] Fix CMake target properties (#176802)
Fix visibility of target properties:
 * INCLUDE_DIRECTORIES
 * COMPILE_DEFINITIONS

implicitly pulled in from `default_gtest`.

Fixes: https://github.com/llvm/llvm-project/pull/159416
2026-01-19 19:09:29 +00:00
Michael Halkenhäuser
d5fea7e4f0
[OpenMP][omptest] Improve CMake and address review comments (#159416)
Avoid explicit ABI breaking check deactivation
Replace whole-archive linking with dedicated build of GoogleTest lib

Addresses remaining post-merge review comments of
https://github.com/llvm/llvm-project/pull/154786
2026-01-19 17:40:32 +00:00
Aaron Ballman
bc550d380c
Nominate Michael Klemm as lead maintainer of OpenMP (#175964)
We discussed this during the OpenMP sync-up call on 1/14 and he's still
actively maintaining this component and would be happy to act as lead
for it.
2026-01-14 15:17:26 +00:00
Austin Jiang
e6cdfb75ac
Fix typos and spelling errors across codebase (#156270)
Corrected various spelling mistakes such as 'occurred', 'receiver',
'initialized', 'length', and others in comments, variable names,
function names, and documentation throughout the project. These
changes improve code readability and maintain consistency in naming
and documentation.

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2026-01-13 11:52:46 -05:00
Robert Imschweiler
26e10cda55
[OpenMP] Add libomp unit test infrastructure (#168063)
(The tests in `TestKmpStr.cpp` are an automatically generated POC to
make sure things work.)
2026-01-12 16:02:15 +01:00
Michael Kruse
9ac2d0a9b9 Revert "[OpenMP] Remove LLVM_ENABLE_PROJECTS=openmp build mode (#152189)"
This reverts commit 20d0ec8498.

The publish-sphinx-docs buildbot still uses LLVM_ENABLE_PROJECTS=openmp.
2026-01-08 13:10:46 +01:00
Michael Kruse
20d0ec8498
[OpenMP] Remove LLVM_ENABLE_PROJECTS=openmp build mode (#152189)
The build mode has been deprecated in #136314. According to the
deprecation message, it was supposed to be removed in the LLVM 21
release. Each build mode increased the maintanance overhead when
failing, such as in #151117.

Let's remove it in LLVM 22.
2026-01-08 12:01:07 +00:00
Joseph Huber
0753286b8e
[OpenMP] Add default stub for virtual methods (#174594)
Summary:
Recent OpenMP patches have added real support for virtual functions on
the device side. However, we don't provide some of the C++ ABI functions
that are emitted when using these. In practice these functions just call
`std::terminate` so we can just trap here. These are marked weak so they
will be overridden by a more correct implementation if not defined and
will also not extract on their own from a static library.
2026-01-06 08:44:02 -06:00
Joachim
b036d70eee
Revert "[OMPT][Offload][OpenMP] Fixes for OMPT data used by libomptarget" (#172827)
Reverts llvm/llvm-project#156020

We will need some time for investigating buildbot failures
2025-12-18 09:48:30 +00:00
Kaloyan Ignatov
726452720c
[OMPT][Offload][OpenMP] Fixes for OMPT data used by libomptarget (#156020)
These commits fix issues regarding storage of tool data within
libomptarget. Both libomp and libomptarget have been modified to
accommodate this. We differentiate between two cases depending on the
type of the target region:

- merged target regions (default, without `nowait` clause): behavior
remains unchanged, tool data is stored in the thread local
RegionInterface class within libomptarget.
- deferred target regions (using `nowait` clause): tool data is moved to
`ompt_task_info_t` struct within libomp, as `RegionInterface` is thread
local and its data is lost whenever another task is scheduled on the
thread, which happens with deferred target regions.

In the new implementation, `RegionInterface` receives pointers to
`ompt_task_info_t` within libomp which are handled transparently within
libomptarget. Thus, the problem of tool data getting lost when a thread
receives a new task is resolved: `target_data` and `target_task_data`
remain set.

Another issue was the value of `task_data` which is supposed to belong
to the generating task of the region according to the OpenMP standard,
but instead had been set to the `task_data` of the target task itself
until now.

Test cases have been added which check both of these fixes.

---------

Co-authored-by: Joachim <jenke@itc.rwth-aachen.de>
2025-12-18 10:20:14 +01:00
Abhinav Gaba
c62cd2877c
[OpenMP][Offload] Add LIBOMPTARGET_TREAT_ATTACH_AUTO_AS_ALWAYS to treat attach(auto) as attach(always). (#172382)
This is needed as a way to support older code that was expecting
unconditional attachment to happen for cases like:

```c
  int *p;
  int x;

  #pragma omp targret enter data map(p) // (A)
  #pragma omp target enter data map(x)  // (B)
  p = &x;

  // By default, this does NOT attach p and x
  #pragma omp target enter data map(p[0:0]) // (C)
```

When the environment variable is set, such maps, where both the pointer
and the pointee already have corresponding copies on the device, but are
not attached to one another, will be attached as-if OpenMP 6.1 TR14's
`attach(always)` map-type-modifier was specified on `(C)`.
2025-12-16 15:55:27 -08:00
Leandro Lupori
de776fb60a
[OpenMP] Fix libarcher tests on Ubuntu 22.04 (#170671)
When llvm-symbolizer is not found on PATH TSan uses system's addr2line
instead. On Ubuntu 22.04 addr2line can't handle DWARF v5, which results
in failures in some libarcher tests.

This PR adds the directory of the just built LLVM binaries to PATH, to
make llvm-symbolizer available to TSan.

The changes were tested on an AArch64 machine, on which
task-taskgroup-unrelated.c was flaky. Moving the test code to a separate
function, executed 10 times, solved the issue.

Fixes #170138
2025-12-15 11:25:54 -03:00
Michael Kruse
d233e787f0 Revert "[Flang] Move builtin .mod generation into runtimes (Reapply #137828) (#169638)"
This reverts commit 7675fc79c8.

Requested in PR:
https://github.com/llvm/llvm-project/pull/169638#issuecomment-3634227707
2025-12-09 22:39:41 +01:00
Michael Kruse
7675fc79c8
[Flang] Move builtin .mod generation into runtimes (Reapply #137828) (#169638)
Reapplication of #137828, changes:
* Workaround CMAKE_Fortran_PREPROCESS_SOURCE issue for CMake < 2.24: The
issue is that `try_compile` does not forward manually-defined compiler
flang variables to the test build environment; instead of just a
negative test result, it aborts the configuration step itself. To be
fair, manually defining these variables is deprecated since at least
CMake 3.6.
* Missing flang cmd line flags for CMake < 3.28 `-target=`, `-O2`, `-O3`
* It is now possible to set FLANG_RT_ENABLED_STATIC=OFF and
FLANG_RT_ENABLE_SHARED=OFF at the same and is the default for amdgpu and
nvptx targets. In this mode, only the .mod files are compiled --
necessary for module files in
lib/clang/22/finclude/flang/(nvptx64-nvidia-cuda|amdgpu-amd-amdhsa)/*.mod
to be available.
* For compiling omp_lib.mod for nvptx and amdgpu, the module build
functionality must be hoisted out if openmp's runtime/ directory which
is only included for host targets. This PR now requires #169909.
 

Move building the .mod files from openmp/flang to openmp/flang-rt using
a shared mechanism. Motivations to do so are:

1. Most modules are target-dependent and need to be re-compiled for each
target separately, which is something the LLVM_ENABLE_RUNTIMES system
already does. Prime example is `iso_c_binding.mod` which encodes the
target's ABI. Constants such as [`c_long_double` also have different
values](d748c81218/flang-rt/lib/runtime/iso_c_binding.f90 (L77-L81)).
Most other modules have `#ifdef`-enclosed code as well. For instance
this caused offload targets nvptx64-nvidia-cuda/amdgpu-amd-amdhsa to use
the modules files compiled for the host which may contrain uses of the
types REAL(10) or REAL(16) not available for nvptx/amdgpu.

#146876
#128015
#129742
#158790

3. CMake has support for Fortran that we should use. Among other things,
it automatically determines module dependencies so there is no need to
hardcode them in the CMakeLists.txt.

4. It allows using Fortran itself to implement Flang-RT. Currently, only
`iso_fortran_env_impl.f90` emits object files that are needed by Fortran
applications (#89403). The workaround of #95388 could be reverted (PR
#169525).


If using Flang for cross-compilation or target-offloading, flang-rt must
now be compiled for each target not only for the library, but also to
get the target-specific module files. For instance in a bootstrapping
runtime build, this can be done by adding:
`-DLLVM_RUNTIME_TARGETS=default;nvptx64-nvidia-cuda;amdgpu-amd-amdhsa`.


Some new dependencies come into play:
* openmp depends on flang-rt for building `lib_omp.mod` and
`lib_omp_kinds.mod`. Currently, if flang-rt is not found then the
modules are not built.
* check-flang depends on flang-rt: If not found, the majority of tests
are disabled. If not building in a bootstrpping build, the location of
the module files can be pointed to using
`-DFLANG_INTRINSIC_MODULES_DIR=<path>`, e.g. in a flang-standalone
build. Alternatively, the test needing any of the intrinsic modules
could be marked with `REQUIRES: flangrt-modules`.
* check-flang depends on openmp: Not a change; tests requiring
`lib_omp.mod` and `lib_omp_kinds.mod` those are already marked with
`openmp_runtime`.

As intrinsic are now specific to the target, their location is moved
from `include/flang` to `<resource-dir>/finclude/flang/<triple>`. The
mechnism to compute the location have been moved from flang-rt
(previously used to compute the location of `libflang_rt.*.a`) to common
locations in `cmake/GetToolchainDirs.cmake` and
`runtimes/CMakeLists.txt` so they can be used by both, openmp and
flang-rt. Potentially the mechnism could also be shared by other
libraries such as compiler-rt.

`finclude` was chosen because `gfortran` uses it as well and avoids
misuse such as `#include <flang/iso_c_binding.mod>`. The search location
is now determined by `ToolChain` in the driver, instead of by the
frontend. Another subdirectory `flang` avoids accidental inclusion of
gfortran-modules which due to compression would result in
user-unfriendly errors. Now the driver adds `-fintrinsic-module-path`
for that location to the frontend call (Just like gfortran does).
`-fintrinsic-module-path` had to be fixed for this because ironically it
was only added to `searchDirectories`, but not
`intrinsicModuleDirectories_`. Since the driver determines the location,
tests invoking `flang -fc1` and `bbc` must also be passed the location
by llvm-lit. This works like llvm-lit does for finding the include dirs
for Clang using `-print-file-name=...`.
2025-12-09 12:54:26 +01:00
Kevin Sala Penades
0e92beb0c0
[Clang][OpenMP] Switch to __kmpc_parallel_60 with strict parameter (#171082)
This commit switches the `__kmpc_parallel_51` to `__kmpc_parallel_60`,
and adds the strict boolean for the number of threads.
2025-12-08 09:37:11 -08:00
Robert Imschweiler
33d779dfbf
[OpenMP] Fix undefined symbol for Darwin builds (#170999)
cf.
https://github.com/llvm/llvm-project/pull/168554#issuecomment-3617253169
2025-12-08 14:15:39 +01:00
Michael Kruse
830ef4e4e2
[openmp][NFCI] Move .mod code out of runtimes subdir (#169909)
Extracted out of #169638. The motivation is that we want to build
Fortran module files for device triples (amdgpu-amd-amdhsa and
nvptx64-nvidia-cuda) as well, but the runtimes/ directory is only
included for host devices.

This PR itself should not change anything, including that omp_lib.mod is
only built on host devices triple. Some dependencies used for building
omp_lib.mod are hoisted out of runtimes/ as well. IMHO they all make
sense to hoist, e.g. LIBOMP_VERSION_MAJOR/LIBOMP_VERSION_MINOR should be
usable in the entire OpenMP subproject.
2025-12-06 12:14:55 +01:00
Jan André Reuter
94232f9f56
[OpenMP][OMPT] Use global thread id for codeptr_ra in end_critical (#169826)
When a critical construct has finished, it will trigger a
critical-released event. If a tool is attached, and the `mutex_released`
callback was registered, the tool with receive an event containing the
`codeptr_ra`, the return address of the callback invocation.

All the way back in 82e94a5934, this
`codeptr_ra` was implemented by calling `__ompt_load_return_address`
with a fixed global thread id of `0`. However, this approach results in
a race-condition, and can yield incorrect results to the tool.

`__ompt_load_return_address(0)` points to the current return address of
the thread 0 in `__kmp_threads`. This thread may already execute some
other construct. A tool might therefore receive the return address of
e.g. some `libomp` internals, or other parts of the user code.
Additionally, a call to `__ompt_load_return_address` resets the
`th.ompt_thread_info.return_address` to `NULL`, therefore also affecting
the return address of thread 0. Another dispatched event, e.g.
parallel-begin might therefore not transfer any `codeptr_ra`.

To fix this, replace the fixed thread id by the `global_tid`, which is
stored just before dispatching the `mutex_released` callback.

Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
2025-12-03 19:03:34 +01:00
Robert Imschweiler
9605666949
Fix Windows OpenMP build (#170142)
fixes Windows build issue in
https://github.com/llvm/llvm-project/pull/168554
2025-12-02 09:54:36 +01:00
Robert Imschweiler
8808beeb1a
Reland: [OpenMP] Implement omp_get_uid_from_device() / omp_get_device_from_uid() (#168554)
Reland https://github.com/llvm/llvm-project/pull/164392 with Fortran support moved to follow-up PR
2025-12-01 14:18:31 +01:00
Jan Patrick Lehr
4bc654d649
Revert "[Flang] Move builtin .mod generation into runtimes" (#169489)
Reverts llvm/llvm-project#137828

Buildbot error in
https://lab.llvm.org/staging/#/builders/105/builds/37275
2025-11-25 13:54:27 +01:00
Michael Kruse
86fbaef99a
[Flang] Move builtin .mod generation into runtimes (#137828)
Move building the .mod files from openmp/flang to openmp/flang-rt using
a shared mechanism. Motivations to do so are:

1. Most modules are target-dependent and need to be re-compiled for each
target separately, which is something the LLVM_ENABLE_RUNTIMES system
already does. Prime example is `iso_c_binding.mod` which encodes the
target's ABI. Most other modules have `#ifdef`-enclosed code as well.

2. CMake has support for Fortran that we should use. Among other things,
it automatically determines module dependencies so there is no need to
hardcode them in the CMakeLists.txt.

3. It allows using Fortran itself to implement Flang-RT. Currently, only
`iso_fortran_env_impl.f90` emits object files that are needed by Fortran
applications (#89403). The workaround of #95388 could be reverted.


Some new dependencies come into play:
* openmp depends on flang-rt for building `lib_omp.mod` and
`lib_omp_kinds.mod`. Currently, if flang-rt is not found then the
modules are not built.
* check-flang depends on flang-rt: If not found, the majority of tests
are disabled. If not building in a bootstrpping build, the location of
the module files can be pointed to using
`-DFLANG_INTRINSIC_MODULES_DIR=<path>`, e.g. in a flang-standalone
build. Alternatively, the test needing any of the intrinsic modules
could be marked with `REQUIRES: flangrt-modules`.
* check-flang depends on openmp: Not a change; tests requiring
`lib_omp.mod` and `lib_omp_kinds.mod` those are already marked with
`openmp_runtime`.

As intrinsic are now specific to the target, their location is moved
from `include/flang` to `<resource-dir>/finclude/flang/<triple>`. The
mechnism to compute the location have been moved from flang-rt
(previously used to compute the location of `libflang_rt.*.a`) to common
locations in `cmake/GetToolchainDirs.cmake` and
`runtimes/CMakeLists.txt` so they can be used by both, openmp and
flang-rt. Potentially the mechnism could also be shared by other
libraries such as compiler-rt.

`finclude` was chosen because `gfortran` uses it as well and avoids
misuse such as `#include <flang/iso_c_binding.mod>`. The search location
is now determined by `ToolChain` in the driver, instead of by the
frontend. Now the driver adds `-fintrinsic-module-path` for that
location to the frontend call (Just like gfortran does).
`-fintrinsic-module-path` had to be fixed for this because ironically it
was only added to `searchDirectories`, but not
`intrinsicModuleDirectories_`. Since the driver determines the location,
tests invoking `flang -fc1` and `bbc` must also be passed the location
by llvm-lit. This works like llvm-lit does for finding the include dirs
for Clang using `-print-file-name=...`.
2025-11-25 10:33:58 +01:00
Zahira Ammarguellat
d36e2b621f
[OpenMP][libomp] Add transparent task flag bit to kmp_tasking_flags (#168873)
Clang is adding support for the new `OpenMP transparent` clause on
`task` and `taskloop` directives.
The parsing and semantic handling for this clause is introduced in
https://github.com/llvm/llvm-project/pull/166810 .
To allow the compiler to communicate this clause to the `OpenMP`
runtime, a dedicated bit in `kmp_tasking_flags` is required.
This patch adds a new compiler-reserved bit `transparent` to the`
kmp_tasking_flags` structure.
2025-11-21 08:19:20 -05:00
Kelvin Li
4544ff68dc
[OpenMP][AIX] Not to create symbolic links to libomp.so in install step (NFC) (#168585)
Commit bb563b1 handles the links in the build directory but 
misses the case in the install step. This patch is to link only 
the libomp.a on AIX.
2025-11-20 09:08:57 -05:00
Michael Kruse
c32c1d0d21
[Runtimes] Default build must use its own output dirs (#168266)
Post-commit fix of #164794 reported at
https://github.com/llvm/llvm-project/pull/164794#issuecomment-3536253493

`LLVM_LIBRARY_OUTPUT_INTDIR` and `LLVM_RUNTIME_OUTPUT_INTDIR` is used by
`AddLLVM.cmake` as output directories. Unless we are in a
bootstrapping-build, It must not point to directories found by
`find_package(LLVM)` which may be read-only directories. MLIR for
instance sets thesese variables to its own build output
directory, so should the runtimes.
2025-11-19 13:51:14 +01:00
Robert Imschweiler
9a0fd22da1
Revert "[OpenMP] Implement omp_get_uid_from_device() / omp_get_device_from_uid()" (#168547)
Reverts llvm/llvm-project#164392 due to fortran issues
2025-11-18 15:10:42 +00:00
Robert Imschweiler
65c4a534bd
[OpenMP] Implement omp_get_uid_from_device() / omp_get_device_from_uid() (#164392)
Use the implementation in libomptarget. If libomptarget is not
available, always return the UID / device number of the host / the
initial device.
2025-11-18 15:22:49 +01:00
Michael Kruse
e69d2bf603 [OpenMP][omptest] Fix missing source extention
The file extention was accidentally omitted from #164794.
2025-11-17 17:09:23 +01:00
Joseph Huber
670c453aeb
[Offload] Remove handling for device memory pool (#163629)
Summary:
This was a lot of code that was only used for upstream LLVM builds of
AMDGPU offloading. We have a generic and fast `malloc` in `libc` now so
just use that. Simplifies code, can be added back if we start providing
alternate forms but I don't think there's a single use-case that would
justify it yet.
2025-11-06 10:15:18 -06:00
Kelvin Li
bb563b196f
[OpenMP][AIX] Not to create symbolic links to libomp.so on AIX (#165890)
On AIX, it generates libomp for both static and dynamic. There is no
need to create symbolic links to libomp.so.

---------

Co-authored-by: Xing Xue <xingxue@outlook.com>
2025-11-03 22:58:56 -05:00