Commit Graph
189 Commits
Author SHA1 Message Date
Ivan R. Ivanov 58f386207a [offload] Remove omptarget references from tests (#208205)
Make check lines more generic so that we can move and rename components
without breaking the tests

This is in preparation for splitting off parts of libomptarget into
libompaccsupport, which will be used by both OpenACC and OpenMP. Some
debug prints will be printed from `ompaccsupport` and not `omptarget`,
thus the need for this change.
2026-08-03 16:55:38 +02:00
Abhinav GabaandClaude Opus 4.8 187c39ba03 [OpenMP] Propagate ALWAYS/DELETE/CLOSE map-type modifiers to mapper entries (#210210)
Per OpenMP, when a map/motion clause uses a mapper, any
map-type-modifying modifier on that clause applies to each map the
declared mapper specifies.

This change propagates the `ALWAYS`, `DELETE`, and `CLOSE` bits from the
outer clause's map type into every entry emitted by
emitUserDefinedMapper, except `ATTACH` entries (`ATTACH`|`ALWAYS` is
reserved for `attach(always)`, and the other bits have no meaning for an
`ATTACH` entry).

`PRESENT` is intentionally NOT propagated here: it requires
distinguishing pointee entries from the struct's own storage and is
handled in a follow-up.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 23:07:32 -07:00
Robert Imschweiler 29a956e40a [offload][OpenMP] Add atomic cross-team reductions (#209298)
Regular cross-team reductions have two phases: the intra-team reduction
and the inter-team reduction. Atomic cross-team reductions replace the
second phase with a atomic instruction which is used by the main thread
of each team to directly fold the result of the intra-team reduction
into the final result. Since this requires a combination of "data type"
and "combine operation" for which an atomic instruction is available,
only some (but very common) reductions can be transformed to atomic
reductions. In cases where multiple reductions are performed on the same
construct, the atomic path is only taken if all reductions can be
transformed. Otherwise, we fall back to the regular cross-team reduction
using a buffer with per-team slots. This is not strictly necessary, but
hybrid reductions would induce more complexity with questionable
benefit.

Selecting an atomic path might not be the best option for every
situation, which is why it is not enabled by default. Instead, it can be
enabled via `-fopenmp-target-atomic-reduction`. Note that enabling the
atomic path will not *force* atomic reductions. They will only be
applied if possible, as described above.

The performance (measured with https://github.com/ro-i/xteam-test @
c71339705091500f731e2a39f247d2660bacbdce, array size 177,777,777) is up
to +15% faster (aka, more throughput) for supported reductions on a
gfx942, with no noticeable regressions.
Example:
- sum reduction, type double: +10.22% faster
- sum reduction, type uint: +15.57% faster
- sum reduction, type ulong: +13.31% faster

On a gfx90a, there is little to negative benefit:
- sum reduction, type double: -4.32% faster (aka, slower)
- sum reduction, type uint: +3.08% faster
- sum reduction, type ulong: +1.68% faster

Claude assisted with this patch.
2026-08-02 14:01:32 +02:00
Abhinav Gaba a1d93f19be [OpenMP][Offload] Fix use-after-free of the packed firstprivate transfer buffer (#212905)
`packAndTransfer()` called `submitData()`, which captured the address of
the data of
the `SmallVector` member of `PrivateArgumentManagerTy`, as the host
source of an
async transfer. The manager was later moved into an `AsyncInfo`
post-processing
lambda, changing the underlying address of the data:
`addPostProcessingFunction()`
copies the closure rather than moving it, but even if it "moved", the
address of the data owned by `SmallVector`'s inline capacity would have
changed.

The AMDGPU plugin read from the stale host source address when doing the
actual transfer.

Fix: allocate the packed buffer via
`getOrCreateSourceBufferForSubmitData()`, so
that `AsyncInfo` owns it. The non-packed
corresponding-pointer-initialization
path in this same class already built its source buffer that way.
2026-07-30 16:17:20 -07:00
Abhinav GabaandClaude Opus 4.8 1a2691c3d3 [NFC][OpenMP] Add mapper-specific tests exercising pointee section mapping. (#204269)
* Add a few tests for when a mapper does something like `map(s.p[0:10])`
where `p` is a pointer.
* Add a few tests that require propagation of bits like `present/always`
into a mapper.
* Fix a few tests that were expecting `p` to be mapped when the mapper
only said `map(s.p[0:10])`.

The output of a few tests is different from what we expect. They have
been annotated with FIXMEs, and the expected output for when the
follow-up changes in this stack to propagate the map-type-modifier bits
and using attach-style mapping for mappers get merged.

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 11:27:03 -07:00
Akash BanerjeeandCodex 2a1200e08c [Flang][OpenMP] Fix Fortran automap handling (#162501)
This fixes Fortran `declare target enter(automap:...)` handling for
allocatable
descriptors.

- Replace the previous `has_device_addr` target-region rewrite with
explicit
  target data operations around allocation/deallocation.
- On allocation, emit:
  - descriptor `map(always,to)` to keep the Fortran descriptor present
  - storage `map(storage)` for the allocated array data
- `map(attach)` to update the device descriptor base address to the
device data
- On deallocation, delete both the mapped storage and descriptor.
- Add a weak visible offload-entry alias for local/hidden `declare
target to/enter`
globals so libomptarget can associate the host descriptor with the real
device
  global without changing the original symbol linkage.

This fixes `offload/test/offloading/fortran/declare-target-automap.f90`
reported broken in #161265.

Co-authored-by: Codex <codex@openai.com>
2026-07-14 16:03:05 +01:00
Abid Qadeer abd72b0eb7 [OpenMP] Publish target-init team state with acq_rel barrier (#208701)
In __kmpc_target_init, thread 0 initializes the team state in LDS
(HasThreadState = 0, ThreadStates = nullptr) and then releases the other
threads with synchronize::threadsAligned(atomic::relaxed). Because the
relaxed ordering emits no memory fence, the initializing LDS stores are
not guaranteed to be visible to the worker threads before they proceed.
A worker thread can then read the uninitialized team state and produce
wrong results or crash. This is the flow that causes the race as I
understand it.

```
__kmpc_target_init                                    (Kernel.cpp:107)
  -> initializeRuntime                                (Kernel.cpp:38)
       -> state::init                                         (State.cpp:286)
            -> TeamState.init(IsSPMD)                 (State.cpp:295)
                 -> HasThreadState = false            (State.cpp:248)   // <-- the value later read stale
               ThreadStates = nullptr                 (State.cpp:296)
  -> synchronize::threadsAligned(atomic::relaxed)     (Kernel.cpp:115)  // <-- insufficient barrier:
     //     relaxed emits no fence, so the state stores above are not published to the other threads

        ... worker threads continue past the barrier ...

__kmpc_parallel_60                                    (Parallelism.cpp:143)
  if (OMP_UNLIKELY(!if_expr || state::HasThreadState || ...))   (Parallelism.cpp:158)
        ^ reads HasThreadState from LDS; a stale/unpublished value (!= 0)
          diverts the worker onto the wrong (serialized) path
```
The fix changes the barrier at Kernel.cpp:115 from atomic::relaxed to
atomic::acq_rel so that the memory fences are emitted.

Reproducing the problem requires an `if` clause with a non-constant
condition on the target region. The worker's read of HasThreadState
originates from the serialized-region check in __kmpc_parallel_60. When
the `if` condition is constant (or absent), the optimizer can prove that
branch is dead and eliminates the HasThreadState load entirely, so the
race has nothing to observe. A non-constant `if` keeps if_expr, and
hence the LDS read alive, exposing the problem.

I have added a Fortran offload regression test that launches a target
region many times to make the timing-dependent race likely to surface.

Fixes https://github.com/llvm/llvm-project/issues/208698.

Assisted-by: Cursor
2026-07-13 09:57:52 +01:00
Kewen Meng b2f93b13fe [OpenMP][Offload] Fix flang offload test (#208829)
This PR attempts to address the remaining flang offload test failure
after https://github.com/llvm/llvm-project/pull/208617. Bot:
https://lab.llvm.org/buildbot/#/builders/67/builds/8412

The problem with is test is that `foo__l8` kernel was not linked into
device image without explicitly use the amdgpu-amd-amdhsa triple in the
compilation. It only happened to this specific test.

Local test results after fix:
```
Testing Time: 146.44s

 Total Discovered Tests: 3478
   Skipped          :   77 (2.21%)
   Unsupported      :  341 (9.80%)
   Passed           : 3055 (87.84%)
   Expectedly Failed:    5 (0.14%)
```
2026-07-11 09:00:38 +02:00
agozillon 7e89dcfba2 [Flang][OpenMP] Support mapping of zero-sized arrays (#208133)
Whilst there is no data in theory to map with a zero sized array, the
Fortran OpenMP specification considers the case of a zero sized array
being mapped to device as the data being present on device. This
includes both the data and the descriptor, and it should fundamentlaly
work as a zero-sized array would on device with the respective Fortran
functions for presence and size checking etc.

We can't actually map a nullptr to device and expect it to be present in
current OpenMP (for good reason), however, thankfully, a zero sized
array isn't actually a nullptr, it is a descriptor contianing an
allocated 1-byte of data. So, we can map this to device, alongside the
descriptor and then the zero sized array is correctlly on device for all
intents and purposes. This case is notably different from a
non-allocated or non-zero sized array so we can do this without shooting
ourselves in the foot.
2026-07-11 01:03:33 +02:00
Kewen MengandJan Patrick Lehr 71fe35814f [OpenMP][Offload][AMDGPU] Fix offload tests failure after the new triple (#208617)
Offload tests failed after introducing the new triple. This PR attempts
to address that. It includes the changes in
https://github.com/llvm/llvm-project/pull/208551. In addition, it also
made following changes:

- Updated flang builder that our buildbot uses;
- Updated the CMakeLists for offload and AMDGPU device runtime (a little
duplications to avoid breaking other buildbots);
- Added per target linker path and mapping for lit substitution/features
in lit config;
- Updated hard-coded check lines in the tests.

This PR reduces the failed offload tests from 246 to 2 on my test runs
locally. Test results and the two failed tests:
```
Failed Tests (2):
   libomptarget :: amdgpu-amd-amdhsa :: offloading/fortran/declare-target-common-block-main.f90
   libomptarget :: amdgpu-amd-amdhsa :: sanitizer/use_after_free_2.c

 Total Discovered Tests: 3478
   Skipped          :   77 (2.21%)
   Unsupported      :  341 (9.80%)
   Passed           : 3053 (87.78%)
   Expectedly Failed:    5 (0.14%)
   Failed           :    2 (0.06%)
```

I was not able to identify the commits for the two failed tests yet
(didn't look like flakiness), will try again later.

Co-authored-by: Jan Patrick Lehr <JanPatrick.Lehr@amd.com>
2026-07-10 11:38:16 -07:00
agozillon 3046fb3de4 [Flang][OpenMP][Offload] Add Flang offload tests for common block and declare target (#202949)
This PR adds a couple of tests revolving around the usage of common
block with declare target in Fortran OpenMP.
2026-07-07 18:02:58 +02:00
Sergio Afonso 1548349165 [Flang][OpenMP][MLIR] Improve SPMD-No-Loop handling (#206953)
This patch modifies the handling of the
`-fopenmp-assume-teams-oversubscription` and
`-fopenmp-assume-threads-oversubscription` compiler options in Flang and
the corresponding `omp.flags` MLIR attribute to have this information
present on both host and target device MLIR modules. This is necessary
to ensure SPMD to SPMD-No-Loop kernel promotion happens uniformly and no
divergence between host and device representations of the same target
region is introduced.

The identification of the kernel type in Flang lowering is updated to
address some broken edge cases. In particular, no SPMD to SPMD-No-Loop
transformation is performed on `target parallel do [simd]` kernels. A
split `target + parallel loop` is now marked SPMD, which was a case
missed previously, and the trip count on `target teams ompx_bare`
kernels isn't host evaluated even if removing the `ompx_bare` clause
would result in a valid SPMD kernel.
2026-07-01 16:54:06 +01:00
Robert Imschweiler 336aa49924 [offload][OpenMP] Fix partial warp reduction (#205861)
Don't use a full warp for the final cross-team reduction if the
reduction's thread limit is below the warp size.

Claude assisted with the test.
2026-06-25 21:06:47 +02:00
Sergio Afonso 5fdc948298 [Offload][OpenMP][Flang] Update no-loop test (#205803)
Updates to the kernel type detection logic now allow `target parallel
do` to be promoted to SPMD-No-Loop.

A currently broken offload test that was affected by this change is
updated here.
2026-06-25 14:19:02 +01:00
Jason Van Beusekom e57ebfdaef [Flang][OpenMP] remove enable-delayed-privatization-staging to suppor… (#203626)
…t target first private default

This commit follows the decision in #182356 to remove the not yet
implemented for delayed privatization for firstprivate and private in
`omp target` regions in flang


Fixes #182356

Assisted with Opus
2026-06-15 10:27:04 -05:00
Jason Van Beusekom 5c8e727562 Revert "[Flang][OpenMP] remove enable-delayed-privatization-staging to suppor…" (#203348)
Reverts llvm/llvm-project#200952

test added in commit llvm/llvm-project#200952
`/offload/test/offloading/fortran/target-firstprivate.f90` on x86
offload, will fix test and open new PR with fixed changes
2026-06-11 12:31:33 -05:00
Jason Van Beusekom 1ee93f9e1a [Flang][OpenMP] remove enable-delayed-privatization-staging to suppor… (#200952)
…t target first private by default

This commit follows the decision in
https://github.com/llvm/llvm-project/issues/182356 to remove the not yet
implemented for delayed privatization for firstprivate and private in
`omp target` regions in flang


Fixes https://github.com/llvm/llvm-project/issues/182356

Assisted with Opus
2026-06-11 10:25:39 -05:00
Robert Imschweiler f1267565f5 [OpenMP][offload] use per-type checks for multiple_reductions.cpp (#201045) 2026-06-06 07:50:59 +02:00
Robert Imschweiler 73802c2e9d [OpenMP][offload] Add enhanced array-reduction tests (#201040) 2026-06-04 09:29:48 +02:00
Nick Sarnie d8fb3dc721 [offload][lit] Disable three more tests on Intel GPU (#201381)
Buildbot is still unstable, these tests are causing kernel driver errors
so let's disable them.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-06-03 19:28:34 +00:00
Nick Sarnie 1f467e7180 [offload][LIT] Disable two tests failing on new Intel GPU driver (#200856)
One new consistent failure and one which causes instability.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-06-01 17:00:17 +00:00
Kevin Sala Penades f15904ec71 [offload][OpenMP] Add strict flag for blocks and threads in kernel arguments (#199483)
Until now, strict behavior in the number of threads and blocks has been
applied only when the kernel is in bare mode. When this mode is enabled,
the values passed in UserNumBlocks and UserThreadLimit are not adjusted
and are the definitive values used to launch the kernel. This commit
detaches the strictness from the kernel mode.

This is going to be used by the kernel replay tool. Additionally, it
starts clearing the path for the upcoming OpenMP dims modifier, used to
configure multidimensional teams and leagues, which will include
strictness choices for teams and threads.

All the bare kernels must indicate strict behavior. Asserts are added to
check this condition.
2026-05-30 02:28:35 -07:00
agozillon 42b563ba12 [Flang][OpenMP][Offload] Modify MapInfoFinalization to handle attach mapping and 6.1's ref_* and attach map keywords (#177715)
This PR is one of four required to implement the attach mapping
semantics in Flang, alongside the ref_ptr/ref_ptee/ref_ptr_ptee map
modifiers and the attach(always/never/auto) modifiers.

This PR is the MapInfoFinalization changes required to support these
features, it mainly deals with applying the correct attach map type and
manipulating the descriptor types maps for base address and descriptor
so that when we specify ref_ptr/ref_ptee we emit one of the two maps and
when we emit ref_ptr_ptee we emit our usual default maps. In all cases
we add the "glue" of an new attach map except in cases where a user has
provided attach never. In cases where we are provided an always, we
apply the always map type to our attach maps.

It's important to note the runtime has a toggle for the auto map
behavior, which will flip the attach behavior to the newer semantics or
the older semantics for backwards compatibility (outside the purview of
this PR but good to mention).
2026-05-15 00:07:41 +00:00
David Pagan 9a3193b1a0 [clang][OpenMP 6.0][CodeGen] Codegen for declare_target 'local' clause (#196431)
Implement code generation for the OpenMP 6.0 declare_target 'local'
clause, which creates device-only variables with per-device static
storage.

A 'local' variable exists in the device image with its static
initializer and is always accessed directly by device code. This is the
same as 'to'/'enter' without unified shared memory, except that no
offload entry is registered.

Using 'device_type(nohost)' with 'local' is not yet supported. Sema
generates a warning and converts it to 'device_type(any)'.

Testing:
- Updated tests:
     clang/test/OpenMP/declare_target_messages.cpp
     clang/test/OpenMP/declare_target_ast_print.cpp
- New tests:
     clang/test/OpenMP/declare_target_local_codegen.cpp
     clang/test/OpenMP/declare_target_local_usm_codegen.cpp
     offload/test/offloading/declare_target_local.cpp
2026-05-11 06:18:44 -07:00
Robert Imschweiler a7b6c02a4e [OpenMP][offload] Add enhanced cross-team reduction test (#195940)
Tests different patterns of OpenMP cross-team reductions, for multiple
data types.
If run with `LIBOMPTARGET_INFO=16`, shows current register spilling due
to dispatch jump chains (which grow for every reduction in the same
translation unit) for indirect function calls in the reduction runtime.
2026-05-06 17:23:35 +02:00
agozillonand@chichunchen 42c326725d [Flang][OpenMP] Fix assert trigger in MapInfoFinalization pass for implicit record member maps (#193851)
The current iteration of the implicit record member mapping segment of
the MapInfoFinalization pass makes the assumption that child maps of
parents are already bound to the targets block arguments, but that is
not the case apon initial lowering from PFT to MLIR. This actually
happens as the end of the MapInfoFinalization pass currently where we
"canonicalize" that all maps are inserted as Block arguments to their
respective targets.

This assumption unfortunately leads to a few cases where we trigger the
assertion, to address this we can impose this canonicalization of map
<-> block arguments as soon as we enter the pass and then once again at
the end of the pass for any new members generated by the
MapInfoFinalization pass. This allows the implicit record member mapping
process to continue unhindered whilst changing very little elsewhere
other than the ordering of block arguments (hence some lit tests
tweaks). The main downside is the extra processing required for running
the "canonialization" twice.

I adopted some tests created by @chichunchen in his version of the fix
to help test for regressions.

Co-authored-by: @chichunchen
2026-05-05 18:41:09 +02:00
Abid Qadeer f3f0830e44 [offload] Update test after ed07c92c96. (#195822)
We now get `a(:n) at dump_map_tables.f90:20:11` so test has been updated
accordingly. This should fix the regression seen after
https://github.com/llvm/llvm-project/pull/195346.
2026-05-05 11:26:20 +01:00
Alex Duran 5e7e097888 [offload] Enable Intel GPU tests and mark CUDA tests unsupported (#194790)
- Remove UNSUPPORTED: intelgpu from 12 passing tests:
  * mapping/data_member_ref.cpp
  * offloading/bug50022.cpp, info.c
* offloading/target_critical_region.cpp, target_depend_nowait.cpp,
target_nowait_target.cpp
  * offloading/strided_update/* (6 tests)
  * unified_shared_memory/close_member.c

- Change CUDA tests from XFAIL to UNSUPPORTED for Intel GPU:
  * offloading/CUDA/basic_launch.cu
  * offloading/CUDA/basic_launch_blocks_and_threads.cu
  * offloading/CUDA/basic_launch_multi_arg.cu
  * offloading/CUDA/launch_tu.cu

- Add Intel GPU configuration section to lit.cfg to disable USM tests by
default
2026-04-29 15:14:20 +02:00
Jan Patrick Lehr ee8ca6b33e Revert "[Flang][OpenMP] Clear close on descriptor members for box parents in USM" (#194568)
Reverts llvm/llvm-project#194287

Buildbot errors in https://lab.llvm.org/buildbot/#/builders/67/builds/3464
local revert fixed the issues.
2026-04-28 11:17:46 +02:00
Kareem ErgawyandComposer 1cb85dd460 [Flang][OpenMP] Clear close on descriptor members for box parents in USM (#194287)
Extend the MapInfoFinalization walk introduced in #185330 so
parent/member close consistency is enforced whenever
unified_shared_memory is in effect, not only when the parent map's
variable is a fir.RecordType. Allocatable (box) roots expand to member
maps the same way as derived-type instances; getDescriptorMapType may
add OMP_MAP_CLOSE to implicit descriptor members while the parent map
does not set close, which led to bad device behavior under
-fopenmp-force-usm with multiple mapped allocatables.

PR stack:
- https://github.com/llvm/llvm-project/pull/194287 (this one)
- https://github.com/llvm/llvm-project/pull/194291

Co-authored-by: Composer (Cursor) <ai@cursor.com>
2026-04-28 05:58:47 +02:00
Kevin Sala Penades 98fe008141 [offload] Un-XFAIL interop-print.c test for nvidia (#194447) 2026-04-27 13:03:10 -07:00
Nick Sarnie 5e451509b6 [offload][lit] Enable ctor_dtor.cpp on Intel GPUs (#194389)
It was fixed with https://github.com/llvm/llvm-project/pull/192725 and
https://github.com/llvm/llvm-project/pull/192730.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-04-27 14:50:52 +00:00
Sergio Afonso fad06a418b [MLIR][OpenMP][OMPIRBuilder] Improve shared memory checks (#161864)
This patch refines checks to decide whether to use device shared memory
or regular stack allocations. In particular, it adds support for
parallel regions residing on standalone target device functions.

The changes are:
- Shared memory is introduced for `omp.target` implicit allocations,
such as those related to privatization and mapping, as long as they are
shared across threads in a nested parallel region.
- Standalone target device functions are interpreted as being part of a
Generic kernel, since the fact that they are present in the module after
filtering means they must be reachable from a target region.
- Prevent allocations whose only shared uses inside of an `omp.parallel`
region are as part of a `private` clause from being moved to device
shared memory.
2026-04-27 13:15:05 +01:00
Sergio Afonso 333f636c9a [OpenMPOpt] Make parallel regions reachable from new DeviceRTL loop functions (#150927)
This patch updates the OpenMP optimization pass to know about the new
DeviceRTL functions for loop constructs.

This change marks these functions as potentially containing parallel
regions, which fixes a current bug with the state machine rewrite
optimization. It previously failed to identify parallel regions located
inside of the callbacks passed to these new DeviceRTL functions, causing
the resulting code to skip executing these parallel regions.

As a result, Generic kernels produced by Flang that contain parallel
regions now work properly.

One known related issue not fixed by this patch is that the presence of
calls to these functions will prevent the SPMD-ization of Generic
kernels by OpenMPOpt. Previously, this was due to assuming there was no
parallel region. This is changed by this patch, but instead we now mark
it temporarily as unsupported in an SPMD context. The reason is that,
without additional changes, code intended for the main thread of the
team located outside of the parallel region would not be guarded
properly, resulting in race conditions and generally invalid behavior.
2026-04-27 13:11:17 +01:00
Alex Duran 7039515e0c [OpenMP] Fix convention of SPIRV outline functions (#192450)
When creating an outline function for device code we're not setting the
right calling convention when the target is SPIRV. This results in the
calls to the function to be removed by the InstCombine pass as it thinks
is not callable.
2026-04-16 22:10:15 +02:00
Alex Duran 14ee89214c [OFFLOAD] Fix interop-print test commands (#191969)
Using %libomptarget-run-generic will fail or run an incorrect binary if
the previous %libomptarget-compile becames ignored because there's no
such device. Switching to use %libomptarget-compile-and-run-* which
doesn't have this issue.

Fixes post-merge issue of #191901
2026-04-14 15:26:20 +02:00
Alex Duran 654da0889b [OFFLOAD][OpenMP][L0] Add Intel strings to interop-print test (#191901) 2026-04-14 00:27:33 +02:00
Alex Duran e0adc50e64 [OFFLOAD][L0] Handle group sizes correctly for multidimensional bare kernels (#191770)
Don't use the L0 heuristics if all the dimensions are specified by the
user code.
2026-04-13 15:37:47 +00:00
Amit Tiwari 7459e10f34 [OpenMP][NFC] Refactor Non-contiguous Update Tests (#190923)
The PR refactors the non-contiguous update tests as raised as a TODO in
one of the comments in the related PR. Prefixed all with
`strided_update`. For offload tests, added a dedicated sub-directory.
2026-04-10 11:43:12 +05:30
Kareem ErgawyandClaude ff071d6165 [flang][DoConcurrent] Map reduction variables as tofrom ByRef for device offloading (#189378)
Scalar reduction variables in `do concurrent reduce(...)` were being
mapped with `implicit ByCopy` when offloaded to device, because
`genMapInfoOpForLiveIn` treated all trivial types uniformly. This caused
the reduction result to be silently dropped — the device-side reduction
would compute the correct value but never write it back to the host.

Fix by detecting reduction variables and forcing `implicit tofrom ByRef`
mapping, matching the behavior of explicit
`!$omp target teams distribute parallel do reduction(...)`.

Co-authored-by: ergawy <kareem.ergawy@amd.com>
Co-authored-by: Claude <noreply@anthropic.com>
Made-with: Cursor

Fixes: https://github.com/ROCm/llvm-project/issues/1844

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-08 07:54:00 +02:00
Nick Sarnie 899a78cbc4 [offload][lit] Disable target_critical_region.cpp on Intel GPU (#189682)
Already disabled on other GPU platforms and sporadically failing on our
builder, so this test seems not be doing too hot.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-03-31 18:54:17 +00:00
Nick Sarnie 38a46a12c4 [offload][lit] Disable tests failing on Intel GPU (#189422)
Fix some tests causing hangs, one fail, and a few XPASSing. We are
seeing new passes/fails because of the named barrier changes being
merged.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-03-30 18:02:34 +00:00
fineg74 563d3f6865 [OFFLOAD] Disable tests that may cause hangs in CI (#189116) 2026-03-27 21:32:25 +00: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
Nick Sarnie 1aefe3b111 [offload][L0] Remove XFAIL from XPASSING test strided_offset_multidim_update.c (#188836)
Passing now I guess

https://lab.llvm.org/buildbot/#/builders/225/builds/4729

```
********************
Unexpectedly Passed Tests (1):
  libomptarget :: spirv64-intel :: offloading/strided_offset_multidim_update.c
```

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-03-26 21:06:22 +00:00
Ivan R. Ivanov 19420c0e77 [OpenMP] Fix non-contiguous array omp target update (#156889)
The existing implementation has three issues which this patch addresses.

1. The last dimension which represents the bytes in the type, has the
wrong stride and count. For example, for a 4 byte int, count=1 and
stride=4. The correct representation here is count=4 and stride=1
because there are 4 bytes (count=4) that we need to copy and we do not
skip any bytes (stride=1).

2. The size of the data copy was computed using the last dimension.
However, this is incorrect in cases where some of the final dimensions
get merged into one. In this case we need to take the combined size of
the merged dimensions, which is (Count * Stride) of the first merged
dimension.

3. The Offset into a dimension was computed as a multiple of its Stride.
However, this Stride which is in bytes, already includes the stride
multiplier given by the user. This means that when the user specified
1:3:2, i.e. elements 1, 3, 5, the runtime incorrectly copied elements 2,
4, 6. Fix this by precomputing at compile time the Offset to be in bytes
by correctly multiplying the offset by the stride of the dimension
without the user-specified multiplier.
2026-03-26 15:55:31 +01:00
Robert Imschweiler bc6a265e3b [offload] Use flang-rt for test feature requirements (#187733) 2026-03-20 18:59:06 +01:00
fineg74andDuran, Alex 2890f9883c [OFFLOAD] Improve handling of synchronization errors in L0 plugin and reenable tests (#186927)
This change improves handling of errors during synchronization in Level
Zero plugin by ensuring cleanup of queues and events in case of an
synchronization error. As a result multiple tests stopped hanging.

---------

Co-authored-by: Duran, Alex <alejandro.duran@intel.com>
2026-03-18 05:50:06 +01:00
Nick Sarnie 1beec14434 [offload][lit] XFAIL new tests failing on intelgpu (#185908)
New tests from https://github.com/llvm/llvm-project/pull/176708 and
https://github.com/llvm/llvm-project/pull/181987 fail on `intelgpu`, I
updated the [GH
issue](https://github.com/llvm/llvm-project/issues/182897).

Example fails
[here](https://lab.llvm.org/buildbot/#/builders/225/builds/3441).

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-03-12 14:37:56 +00:00
Kevin Sala PenadesandKrzysztof Parzyszek 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