History log of /llvm-project/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp (Results 1 – 25 of 176)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 81d18ad8 27-Jan-2025 Jeremy Morse <jeremy.morse@sony.com>

[NFC][DebugInfo] Make some block-start-position methods return iterators (#124287)

As part of the "RemoveDIs" work to eliminate debug intrinsics, we're
replacing methods that use Instruction*'s as

[NFC][DebugInfo] Make some block-start-position methods return iterators (#124287)

As part of the "RemoveDIs" work to eliminate debug intrinsics, we're
replacing methods that use Instruction*'s as positions with iterators. A
number of these (such as getFirstNonPHIOrDbg) are sufficiently
infrequently used that we can just replace the pointer-returning version
with an iterator-returning version, hopefully without much/any
disruption.

Thus this patch has getFirstNonPHIOrDbg and
getFirstNonPHIOrDbgOrLifetime return an iterator, and updates all
call-sites. There are no concerns about the iterators returned being
converted to Instruction*'s and losing the debug-info bit: because the
methods skip debug intrinsics, the iterator head bit is always false
anyway.

show more ...


# 07ed8187 25-Jan-2025 Alex MacLean <amaclean@nvidia.com>

[OpenMP] Replace nvvm.annotation usage with kernel calling conventions (#122320)

Specifying a kernel with the `ptx_kernel` or `amdgpu_kernel` calling
convention is a more idiomatic and compile-time

[OpenMP] Replace nvvm.annotation usage with kernel calling conventions (#122320)

Specifying a kernel with the `ptx_kernel` or `amdgpu_kernel` calling
convention is a more idiomatic and compile-time performant than using
the `nvvm.annoation !"kernel"` metadata.

Transition OMPIRBuilder to use calling conventions for PTX kernels and
no longer emit `nvvm.annoation`. Update OpenMPOpt to work with kernels
specified via calling convention as well as metadata. Update OpenMP
tests to use the calling conventions.

show more ...


# 6292a808 24-Jan-2025 Jeremy Morse <jeremy.morse@sony.com>

[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)

As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNo

[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)

As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNonPHI and similar feed into
instruction insertion positions. Call-sites where that's necessary were
updated a year ago; but to ensure some type safety however, we'd like to
have all calls to getFirstNonPHI use the iterator-returning version.

This patch changes a bunch of call-sites calling getFirstNonPHI to use
getFirstNonPHIIt, which returns an iterator. All these call sites are
where it's obviously safe to fetch the iterator then dereference it. A
follow-up patch will contain less-obviously-safe changes.

We'll eventually deprecate and remove the instruction-pointer
getFirstNonPHI, but not before adding concise documentation of what
considerations are needed (very few).

---------

Co-authored-by: Stephen Tozer <Melamoto@gmail.com>

show more ...


# 7bb949ec 22-Jan-2025 Mats Jun Larsen <mats@jun.codes>

[IR][unittests] Replace of PointerType::getUnqual(Type) with opaque version (NFC) (#123901)

Follow up to https://github.com/llvm/llvm-project/issues/123569


# 9bc88280 15-Jan-2025 Sergio Afonso <safonsof@amd.com>

[OMPIRBuilder][MLIR] Add support for target 'if' clause (#122478)

This patch implements support for handling the 'if' clause of OpenMP
'target' constructs in the OMPIRBuilder and updates MLIR to LL

[OMPIRBuilder][MLIR] Add support for target 'if' clause (#122478)

This patch implements support for handling the 'if' clause of OpenMP
'target' constructs in the OMPIRBuilder and updates MLIR to LLVM IR
translation of the `omp.target` MLIR operation to make use of this new
feature.

show more ...


# d0b641b7 14-Jan-2025 Sergio Afonso <safonsof@amd.com>

[OMPIRBuilder] Propagate attributes to outlined target regions (#117875)

This patch copies the target-cpu and target-features attributes of
functions containing target regions into the correspondin

[OMPIRBuilder] Propagate attributes to outlined target regions (#117875)

This patch copies the target-cpu and target-features attributes of
functions containing target regions into the corresponding outlined
function holding the target region.

This mirrors what is currently being done for all other outlined
functions through the `CodeExtractor` in `OpenMPIRBuilder::finalize()`.

show more ...


# fabc443e 14-Jan-2025 Sergio Afonso <safonsof@amd.com>

[OMPIRBuilder] Support runtime number of teams and threads, and SPMD mode (#116051)

This patch introduces a `TargetKernelRuntimeAttrs` structure to hold
host-evaluated `num_teams`, `thread_limit`,

[OMPIRBuilder] Support runtime number of teams and threads, and SPMD mode (#116051)

This patch introduces a `TargetKernelRuntimeAttrs` structure to hold
host-evaluated `num_teams`, `thread_limit`, `num_threads` and trip count
values passed to the runtime kernel offloading call.

Additionally, kernel type information is used to influence target device
code generation and the `IsSPMD` flag is replaced by `ExecFlags`, which
provides more granularity.

show more ...


# 27bc6bda 14-Jan-2025 Sergio Afonso <safonsof@amd.com>

[OMPIRBuilder] Introduce struct to hold default kernel teams/threads (#116050)

This patch introduces the `OpenMPIRBuilder::TargetKernelDefaultAttrs`
structure used to simplify passing default and c

[OMPIRBuilder] Introduce struct to hold default kernel teams/threads (#116050)

This patch introduces the `OpenMPIRBuilder::TargetKernelDefaultAttrs`
structure used to simplify passing default and constant values for
number of teams and threads, and possibly other target kernel-related
information in the future.

This is used to forward values passed to `createTarget` to
`createTargetInit`, which previously used a default unrelated set of
values.

show more ...


Revision tags: llvmorg-19.1.7
# b79ed872 09-Jan-2025 Sergio Afonso <safonsof@amd.com>

[OpenMP][OMPIRBuilder] Handle non-failing calls properly (#115863)

The preprocessor definition used to enable asserts and the one that
`llvm::Error` and `llvm::Expected` use to ensure all created i

[OpenMP][OMPIRBuilder] Handle non-failing calls properly (#115863)

The preprocessor definition used to enable asserts and the one that
`llvm::Error` and `llvm::Expected` use to ensure all created instances are
checked are not the same. By making these checks inside of an `assert` in cases
where errors are not expected, certain build configurations would trigger
runtime failures (e.g. `-DLLVM_ENABLE_ASSERTIONS=OFF
-DLLVM_UNREACHABLE_OPTIMIZE=ON`).

The `llvm::cantFail()` function, which was intended for this use case, is used
by this patch in place of `assert` to prevent these runtime failures. In tests,
new preprocessor definitions based on `ASSERT_THAT_EXPECTED` and
`EXPECT_THAT_EXPECTED` are used instead, to avoid silent failures in release
builds.

show more ...


# d3eb65f1 03-Jan-2025 Kaviya Rajendiran <67495422+kaviya2510@users.noreply.github.com>

[MLIR][OpenMP] Lowering aligned clause to LLVM IR for SIMD directive (#119536)

This patch,
- Added a translation support for aligned clause in SIMD directive by passing the alignment details to "ll

[MLIR][OpenMP] Lowering aligned clause to LLVM IR for SIMD directive (#119536)

This patch,
- Added a translation support for aligned clause in SIMD directive by passing the alignment details to "llvm.assume" intrinsic.
- Updated the insertion point for llvm.assume intrinsic call in "OMPIRBuilder.cpp".
- Added a check in aligned clause MLIR lowering, to ensure that the alignment value must be a power of 2.

show more ...


Revision tags: llvmorg-19.1.6
# f9734b9d 12-Dec-2024 Kareem Ergawy <kareem.ergawy@amd.com>

[mlir][OpenMP] - MLIR to LLVMIR translation support for delayed privatization of allocatables in `omp.target` ops (#116576)

This PR adds support to translate the `private` clause from MLIR to
LLVMI

[mlir][OpenMP] - MLIR to LLVMIR translation support for delayed privatization of allocatables in `omp.target` ops (#116576)

This PR adds support to translate the `private` clause from MLIR to
LLVMIR when used on allocatables in the context of an `omp.target` op.

This replaces https://github.com/llvm/llvm-project/pull/113208.

Parent PR: https://github.com/llvm/llvm-project/pull/116770. Only the
latest commit is relevant to the PR.

show more ...


Revision tags: llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3
# d87964de 25-Oct-2024 Sergio Afonso <safonsof@amd.com>

[OpenMP][OMPIRBuilder] Error propagation across callbacks (#112533)

This patch implements an approach to communicate errors between the
OMPIRBuilder and its users. It introduces `llvm::Error` and

[OpenMP][OMPIRBuilder] Error propagation across callbacks (#112533)

This patch implements an approach to communicate errors between the
OMPIRBuilder and its users. It introduces `llvm::Error` and
`llvm::Expected` objects to replace the values returned by callbacks
passed to `OMPIRBuilder` codegen functions. These functions then check
the result for errors when callbacks are called and forward them back to
the caller, which has the flexibility to recover, exit cleanly or dump a
stack trace.

This prevents a failed callback to leave the IR in an invalid state and
still continue the codegen process, triggering unrelated assertions or
segmentation faults. In the case of MLIR to LLVM IR translation of the
'omp' dialect, this change results in the compiler emitting errors and
exiting early instead of triggering a crash for not-yet-implemented
errors. The behavior in Clang and openmp-opt stays unchanged, since
callbacks will continue always returning 'success'.

show more ...


Revision tags: llvmorg-19.1.2
# 2a65f081 04-Oct-2024 Youngsuk Kim <youngsuk.kim@hpe.com>

[llvm][OpenMPIRBuilderTest] Avoid Type::getPointerTo() (NFC) (#111196)

`llvm::Type::getPointerTo()` is to be deprecated & removed soon.


Revision tags: llvmorg-19.1.1
# eb6e7e8f 21-Sep-2024 Jay Foad <jay.foad@amd.com>

[unittests] Use {} instead of std::nullopt to initialize empty ArrayRef (#109388)

Follow up to #109133.


Revision tags: llvmorg-19.1.0
# 9e08db79 04-Sep-2024 Abid Qadeer <haqadeer@amd.com>

[OpenMPIRBuilder] Don't drop debug info for target region. (#80692)

When an outlined function is generated for omp target region, a
corresponding DISubprogram was not being generated. This resulted

[OpenMPIRBuilder] Don't drop debug info for target region. (#80692)

When an outlined function is generated for omp target region, a
corresponding DISubprogram was not being generated. This resulted in all
the debug information for the target region being dropped.

This commit adds DISubprogram for the outlined function if there is one
available for the parent function. It also updates the current debug
location so that the right scope is used for the entries in the outlined
function.

There are places in the OpenMPIRBuilder which changes insertion point but
don't update the debug location accordingly. They cause issue when debug info
is enabled. I have fixed a few that I observed to cause issue. But there may be
more and a systematic cleanup may be required.

With this change in place, I can set source line breakpoint in target
region and run to them in debugger.

show more ...


Revision tags: llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2
# 84b1e595 02-Aug-2024 Sergio Afonso <safonsof@amd.com>

[MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.target_triples (#100156)

This patch modifies MLIR to LLVM IR lowering of the OpenMP dialect to take into
consideration the contents of the

[MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.target_triples (#100156)

This patch modifies MLIR to LLVM IR lowering of the OpenMP dialect to take into
consideration the contents of the `omp.target_triples` module attribute while
generating code for `omp.target` operations.

It adds the `OpenMPIRBuilderConfig::TargetTriples` field and initializes it
using the `amendOperation` flow of the `OpenMPToLLVMIRTranslation` pass. Some
changes are introduced into the `OpenMPIRBuilder` to allow passing the
information about whether a target region is intended to be offloaded from
outside.

The result of this change is that offloading calls are only generated when the
`--offload-arch` or `-fopenmp-targets` options are given to the compiler.
Otherwise, only the host fallback code is generated. This fixes linker errors
currently triggered by `flang-new` if a source file containing a `target`
construct is compiled without any of the aforementioned options.

Several unit tests impacted by these changes, which are intended to check host
code generated for `omp.target` operations, are updated to contain the new
attribute. Without it, no calls to `__tgt_target_kernel` and associated control
flow operations are generated.

Fixes #100209.

show more ...


Revision tags: llvmorg-19.1.0-rc1
# 5b4e5f8a 25-Jul-2024 Pranav Bhandarkar <pranav.bhandarkar@amd.com>

[OpenMPIRBuilder][Clang][NFC] - Combine `emitOffloadingArrays` and `emitOffloadingArraysArgument` in OpenMPIRBuilder (#97088)

This patch introduces a new interface in `OpenMPIRBuilder` that combines

[OpenMPIRBuilder][Clang][NFC] - Combine `emitOffloadingArrays` and `emitOffloadingArraysArgument` in OpenMPIRBuilder (#97088)

This patch introduces a new interface in `OpenMPIRBuilder` that combines
the creation of the so-called offloading pointer arrays and their
subsequent preparation as arguments to the OpenMP runtime library. We
then use this in Clang.

This is intended to be used in the near future
by other frontends such as Flang when lowering MLIR to LLVMIR.

show more ...


Revision tags: llvmorg-20-init
# 6b1c51bc 26-Jun-2024 Akash Banerjee <akash.banerjee@amd.com>

[OpenMP] Migrate GPU Reductions CodeGen from Clang to OMPIRBuilder (#80343)

This patch migrates the CGOpenMPRuntimeGPU::emitReduction and related functions to the OpenMPIRBUilder. In future patches

[OpenMP] Migrate GPU Reductions CodeGen from Clang to OMPIRBuilder (#80343)

This patch migrates the CGOpenMPRuntimeGPU::emitReduction and related functions to the OpenMPIRBUilder. In future patches MLIR OpenMP translation would be making use of these functions.

Co-authored-by: Jan Leyonberg <jan.leyonberg@amd.com>

show more ...


# d75f9dd1 24-Jun-2024 Stephen Tozer <stephen.tozer@sony.com>

Revert "[IR][NFC] Update IRBuilder to use InsertPosition (#96497)"

Reverts the above commit, as it updates a common header function and
did not update all callsites:

https://lab.llvm.org/buildbot

Revert "[IR][NFC] Update IRBuilder to use InsertPosition (#96497)"

Reverts the above commit, as it updates a common header function and
did not update all callsites:

https://lab.llvm.org/buildbot/#/builders/29/builds/382

This reverts commit 6481dc57612671ebe77fe9c34214fba94e1b3b27.

show more ...


# 6481dc57 24-Jun-2024 Stephen Tozer <stephen.tozer@sony.com>

[IR][NFC] Update IRBuilder to use InsertPosition (#96497)

Uses the new InsertPosition class (added in #94226) to simplify some of
the IRBuilder interface, and removes the need to pass a BasicBlock

[IR][NFC] Update IRBuilder to use InsertPosition (#96497)

Uses the new InsertPosition class (added in #94226) to simplify some of
the IRBuilder interface, and removes the need to pass a BasicBlock
alongside a BasicBlock::iterator, using the fact that we can now get the
parent basic block from the iterator even if it points to the sentinel.
This patch removes the BasicBlock argument from each constructor or call
to setInsertPoint.

This has no functional effect, but later on as we look to remove the
`Instruction *InsertBefore` argument from instruction-creation
(discussed
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
this will simplify the process by allowing us to deprecate the
InsertPosition constructor directly and catch all the cases where we use
instructions rather than iterators.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6
# 74a87548 16-May-2024 Tom Eccles <tom.eccles@arm.com>

[flang][MLIR][OpenMP] make reduction by-ref toggled per variable (#92244)

Fixes #88935

Toggling reduction by-ref broke when multiple reduction clauses were
used. Decisions made for the by-ref st

[flang][MLIR][OpenMP] make reduction by-ref toggled per variable (#92244)

Fixes #88935

Toggling reduction by-ref broke when multiple reduction clauses were
used. Decisions made for the by-ref status for later clauses could then
invalidate decisions for earlier clauses. For example,

```
reduction(+:scalar,scalar2) reduction(+:array)
```

The first clause would choose by value reduction and generate by-value
reduction regions, but then after this the second clause would force
by-ref to support the array argument. But by the time the second clause
is processed, the first clause has already had the wrong kind of
reduction regions generated.

This is solved by toggling whether a variable should be reduced by
reference per variable. In the above example, this allows only `array`
to be reduced by ref.

show more ...


Revision tags: llvmorg-18.1.5
# 3eb0ba34 17-Apr-2024 Sergio Afonso <safonsof@amd.com>

[MLIR][Flang][OpenMP] Make omp.simdloop into a loop wrapper (#87365)

This patch updates the definition of `omp.simdloop` to enforce the
restrictions of a wrapper operation. It has been renamed to `

[MLIR][Flang][OpenMP] Make omp.simdloop into a loop wrapper (#87365)

This patch updates the definition of `omp.simdloop` to enforce the
restrictions of a wrapper operation. It has been renamed to `omp.simd`,
to better reflect the naming used in the spec. All uses of "simdloop" in
function names have been updated accordingly.

Some changes to Flang lowering and OpenMP to LLVM IR translation are
introduced to prevent the introduction of compilation/test failures. The
eventual long term solution might be different.

show more ...


Revision tags: llvmorg-18.1.4
# 470aefb2 09-Apr-2024 Joseph Huber <huberjn@outlook.com>

[Offload][NFC] Remove `omp_` prefix from offloading entries (#88071)

Summary:
These entires are generic for offloading with the new driver now. Having
the `omp` prefix was a historical artifact an

[Offload][NFC] Remove `omp_` prefix from offloading entries (#88071)

Summary:
These entires are generic for offloading with the new driver now. Having
the `omp` prefix was a historical artifact and is confusing when used
for CUDA. This patch just renames them for now, future patches will
rework the binary format to make it more common.

show more ...


Revision tags: llvmorg-18.1.3, llvmorg-18.1.2
# e9da5f00 19-Mar-2024 Akash Banerjee <akash.banerjee@amd.com>

[OpenMP] Fix target data region codegen being omitted for device pass (#85218)

This patch enables the BodyCodeGen callback to still trigger for the
TargetData nested region during the device pass.

[OpenMP] Fix target data region codegen being omitted for device pass (#85218)

This patch enables the BodyCodeGen callback to still trigger for the
TargetData nested region during the device pass. There maybe Target code
nested within the TargetData region for which this is required.

Also add tests for the same.

show more ...


Revision tags: llvmorg-18.1.1
# 64422cf8 28-Feb-2024 Leandro Lupori <leandro.lupori@linaro.org>

[llvm][mlir][OMPIRBuilder] Translate omp.single's copyprivate (#80488)

Use the new copyprivate list from omp.single to emit calls to
__kmpc_copyprivate, during the creation of the single operation

[llvm][mlir][OMPIRBuilder] Translate omp.single's copyprivate (#80488)

Use the new copyprivate list from omp.single to emit calls to
__kmpc_copyprivate, during the creation of the single operation
in OMPIRBuilder.

This is patch 4 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128

show more ...


12345678