History log of /llvm-project/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp (Results 1 – 25 of 46)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# a0406ce8 16-Jan-2025 Kareem Ergawy <kareem.ergawy@amd.com>

[flang][OpenMP] Add `hostIsSource` paramemter to `copyHostAssociateVar` (#123162)

This fixes a bug when the same variable is used in `firstprivate` and
`lastprivate` clauses on the same construct.

[flang][OpenMP] Add `hostIsSource` paramemter to `copyHostAssociateVar` (#123162)

This fixes a bug when the same variable is used in `firstprivate` and
`lastprivate` clauses on the same construct. The issue boils down to the
fact that `copyHostAssociateVar` was deciding the direction of the copy
assignment (i.e. the `lhs` and `rhs`) based on whether the
`copyAssignIP`
parameter is set. This is not the best way to do it since it is not
related to whether we doing a copy from host to localized copy or the
other way around. When we set the insertion for `firstprivate` in
delayed privatization, this resulted in switching the direction of the
copy assignment. Instead, this PR adds a new paramter to explicitely
tell
the function the direction of the assignment.

This is a follow up PR for
https://github.com/llvm/llvm-project/pull/122471, only the latest commit
is relevant.

show more ...


Revision tags: llvmorg-19.1.7
# 5130a4ea 07-Jan-2025 Leandro Lupori <leandro.lupori@linaro.org>

[flang][OpenMP] Handle pointers and allocatables in clone init (#121824)

InitializeClone(), implemented in #120295, was not handling top
level pointers and allocatables correctly.
Pointers and una

[flang][OpenMP] Handle pointers and allocatables in clone init (#121824)

InitializeClone(), implemented in #120295, was not handling top
level pointers and allocatables correctly.
Pointers and unallocated variables must be skipped.

This caused some regressions in the Fujitsu testsuite:
https://linaro.atlassian.net/browse/LLVM-1488

show more ...


# 1fcb6a97 19-Dec-2024 Leandro Lupori <leandro.lupori@linaro.org>

[flang][OpenMP] Initialize allocatable members of derived types (#120295)

Allocatable members of privatized derived types must be allocated,
with the same bounds as the original object, whenever th

[flang][OpenMP] Initialize allocatable members of derived types (#120295)

Allocatable members of privatized derived types must be allocated,
with the same bounds as the original object, whenever that member
is also allocated in it, but Flang was not performing such
initialization.

The `Initialize` runtime function can't perform this task unless
its signature is changed to receive an additional parameter, the
original object, that is needed to find out which allocatable
members, with their bounds, must also be allocated in the clone.
As `Initialize` is used not only for privatization, sometimes this
other object won't even exist, so this new parameter would need
to be optional.
Because of this, it seemed better to add a new runtime function:
`InitializeClone`.
To avoid unnecessary calls, lowering inserts a call to it only for
privatized items that are derived types with allocatable members.

Fixes https://github.com/llvm/llvm-project/issues/114888
Fixes https://github.com/llvm/llvm-project/issues/114889

show more ...


Revision tags: llvmorg-19.1.6
# db9856b5 11-Dec-2024 Leandro Lupori <leandro.lupori@linaro.org>

[flang][OpenMP][NFC] Turn symTable into a reference (#119435)

Convert `DataSharingProcessor::symTable` from pointer to reference.
This avoids accidental null pointer dereferences and makes it
poss

[flang][OpenMP][NFC] Turn symTable into a reference (#119435)

Convert `DataSharingProcessor::symTable` from pointer to reference.
This avoids accidental null pointer dereferences and makes it
possible to use `symTable` when delayed privatization is disabled.

show more ...


# ff78cd5f 05-Dec-2024 jeanPerier <jperier@nvidia.com>

[flang] fix private pointers and default initialized variables (#118494)

Both OpenMP privatization and DO CONCURRENT LOCAL lowering was incorrect
for pointers and derived type with default initiali

[flang] fix private pointers and default initialized variables (#118494)

Both OpenMP privatization and DO CONCURRENT LOCAL lowering was incorrect
for pointers and derived type with default initialization.

For pointers, the descriptor was not established with the rank/type
code/element size, leading to undefined behavior if any inquiry was made
to it prior to a pointer assignment (and if/when using the runtime for
pointer assignments, the descriptor must have been established).

For derived type with default initialization, the copies were not
default initialized.

show more ...


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

[MLIR][OpenMP] Remove terminators from loop wrappers (#112229)

This patch simplifies the representation of OpenMP loop wrapper
operations by introducing the `NoTerminator` trait and updating
accor

[MLIR][OpenMP] Remove terminators from loop wrappers (#112229)

This patch simplifies the representation of OpenMP loop wrapper
operations by introducing the `NoTerminator` trait and updating
accordingly the verifier for the `LoopWrapperInterface`.

Since loop wrappers are already limited to having exactly one region
containing exactly one block, and this block can only hold a single
`omp.loop_nest` or loop wrapper and an `omp.terminator` that does not
return any values, it makes sense to simplify the representation of loop
wrappers by removing the terminator.

There is an extensive list of Lit tests that needed updating to remove
the `omp.terminator`s adding some noise to this patch, but actual
changes are limited to the definition of the `omp.wsloop`, `omp.simd`,
`omp.distribute` and `omp.taskloop` loop wrapper ops, Flang lowering for
those, `LoopWrapperInterface::verifyImpl()`, SCF to OpenMP conversion
and OpenMP dialect documentation.

show more ...


Revision tags: llvmorg-19.1.2
# c734d77b 04-Oct-2024 Tom Eccles <tom.eccles@arm.com>

[flang][semantics][OpenMP] no privatisation of stmt functions (#106550)

OpenMP prohibits privatisation of variables that appear in expressions
for statement functions.

This is a re-working of an

[flang][semantics][OpenMP] no privatisation of stmt functions (#106550)

OpenMP prohibits privatisation of variables that appear in expressions
for statement functions.

This is a re-working of an old patch https://reviews.llvm.org/D93213 by
@praveen-g-ctt.

The old patch couldn't be landed because of ordering concerns. Statement
functions are rewritten during parse tree rewriting, but this was done
after resolve-directives and so some array expressions were incorrectly
identified as statement functions. For this reason **I have opted to
re-order the semantics driver so that resolve-directives is run after
parse tree rewriting**.

Closes #54677

---------

Co-authored-by: Praveen <praveen@compilertree.com>

show more ...


# eafa1500 03-Oct-2024 NimishMishra <42909663+NimishMishra@users.noreply.github.com>

[flang][OpenMP] Enable lastprivate on simd (#93786)

This PR enables the lowering of lastprivate when defined on simd
construct


# f9824439 02-Oct-2024 Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>

[flang][OpenMP] Parse lastprivate modifier, add TODO to lowering (#110568)

Parse the lastprivate clause with a modifier. Codegen for it is not yet
implemented.


Revision tags: llvmorg-19.1.1
# 49df12c0 30-Sep-2024 Matthias Springer <me@m-sp.org>

[mlir][NFC] Minor cleanup around `ModuleOp` usage (#110498)

Use `moduleOp.getBody()` instead of `moduleOp.getBodyRegion().front()`.


Revision tags: llvmorg-19.1.0
# 433ca3eb 10-Sep-2024 Sergio Afonso <safonsof@amd.com>

[Flang][Lower] Introduce SymMapScope helper class (NFC) (#107866)

This patch creates a simple RAII wrapper class for `SymMap` to make it
easier to use and prevent a missing matching `popScope()` fo

[Flang][Lower] Introduce SymMapScope helper class (NFC) (#107866)

This patch creates a simple RAII wrapper class for `SymMap` to make it
easier to use and prevent a missing matching `popScope()` for a
`pushScope()` call on simple use cases.

Some push-pop pairs are replaced with instances of the new class by this
patch.

show more ...


# 12c4d26c 06-Sep-2024 Sergio Afonso <safonsof@amd.com>

[Flang][OpenMP] NFC: DataSharingProcessor cleanup (#107391)

This patch removes unused and undefined method declarations from
`DataSharingProcessor`, as well as the unused `hasLastPrivateOp` class

[Flang][OpenMP] NFC: DataSharingProcessor cleanup (#107391)

This patch removes unused and undefined method declarations from
`DataSharingProcessor`, as well as the unused `hasLastPrivateOp` class
member. The `insPt` class member is replaced by a local `InsertionGuard`
in the only place it is set and used.

show more ...


# 797f0119 05-Sep-2024 Leandro Lupori <leandro.lupori@linaro.org>

[flang][OpenMP] Make lastprivate work with reallocated variables (#106559)

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


Revision tags: llvmorg-19.1.0-rc4
# 2784060c 29-Aug-2024 Sergio Afonso <safonsof@amd.com>

[MLIR][Flang][OpenMP] Remove omp.parallel from loop wrapper ops (#105833)

This patch updates the `omp.parallel` operation according to the results
of the discussion in [this
RFC](https://discourse

[MLIR][Flang][OpenMP] Remove omp.parallel from loop wrapper ops (#105833)

This patch updates the `omp.parallel` operation according to the results
of the discussion in [this
RFC](https://discourse.llvm.org/t/rfc-disambiguation-between-loop-and-block-associated-omp-parallelop/79972).
It is removed from the set of loop wrapper operations, changing the
expected MLIR representation for composite `distribute parallel do/for`
into the following:

```mlir
omp.parallel {
...
omp.distribute {
omp.wsloop {
omp.loop_nest ... { ... }
omp.terminator
}
omp.terminator
}
...
omp.terminator
}
```

MLIR verifiers for operations impacted by this representation change are
updated, as well as related tests. The `LoopWrapperInterface` is also
updated, since it's no longer representing an optional "role" of an
operation but a mandatory set of restrictions instead.

show more ...


# 216ba6bc 26-Aug-2024 Leandro Lupori <leandro.lupori@linaro.org>

[flang][OpenMP] Privatize vars referenced in statement functions (#103390)

Variables referenced in the body of statement functions need to be
handled as if they are explicitly referenced. Otherwise

[flang][OpenMP] Privatize vars referenced in statement functions (#103390)

Variables referenced in the body of statement functions need to be
handled as if they are explicitly referenced. Otherwise, they are
skipped during implicit privatization, because statement functions
are represented as procedures in the parse tree.

To avoid missing symbols referenced only in statement functions
during implicit privatization, new symbols, associated with them,
are created and inserted into the context of the directive that
privatizes them. They are later collected and processed in
lowering. To avoid confusing these new symbols with regular ones,
they are tagged with the new OmpFromStmtFunction flag.

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

show more ...


Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2
# bbadbf75 01-Aug-2024 Kareem Ergawy <kareem.ergawy@amd.com>

[flang][OpenMP] Delayed privatization for variables with `equivalence` association (#100531)

Handles variables that are storage associated via `equivalence`. The
problem is that these variables are

[flang][OpenMP] Delayed privatization for variables with `equivalence` association (#100531)

Handles variables that are storage associated via `equivalence`. The
problem is that these variables are declared as `fir.ptr`s while their
privatized storage is declared as `fir.ref` which was triggering a
validation error in the OpenMP dialect.

show more ...


# 46ecd7bb 29-Jul-2024 Sergio Afonso <safonsof@amd.com>

[MLIR][OpenMP] Create `LoopRelatedClause` (#99506)

This patch introduces a new OpenMP clause definition not defined by the spec.

Its main purpose is to define the `loop_inclusive` (previously "in

[MLIR][OpenMP] Create `LoopRelatedClause` (#99506)

This patch introduces a new OpenMP clause definition not defined by the spec.

Its main purpose is to define the `loop_inclusive` (previously "inclusive",
renamed according to the parent of this PR in the stack) argument of
`omp.loop_nest` in such a way that a followup implementation of a tablegen
backend to automatically generate clause and operation operand structures
directly from `OpenMP_Op` and `OpenMP_Clause` definitions can properly generate
the `LoopNestOperands` structure.

`collapse` clause arguments are also moved into this new definition, as they
represent information on the loop nests being collapsed rather than the
`collapse` clause itself.

show more ...


# fdfeea5b 29-Jul-2024 Sergio Afonso <safonsof@amd.com>

[MLIR][OpenMP][Flang] Normalize clause arguments names (#99505)

Currently, there are some inconsistencies to how clause arguments are
named in the OpenMP dialect. Additionally, the clause operand s

[MLIR][OpenMP][Flang] Normalize clause arguments names (#99505)

Currently, there are some inconsistencies to how clause arguments are
named in the OpenMP dialect. Additionally, the clause operand structures
associated to them also diverge in certain cases. The purpose of this
patch is to normalize argument names across all `OpenMP_Clause` tablegen
definitions and clause operand structures.

This has the benefit of providing more consistent representations for
clauses in the dialect, but the main short-term advantage is that it
enables the development of an OpenMP-specific tablegen backend to
automatically generate the clause operand structures without breaking
dependent code.

The main re-naming decisions made in this patch are the following:
- Variadic arguments (i.e. multiple values) have the "_vars" suffix.
This and other similar suffixes are removed from array attribute
arguments.
- Individual required or optional value arguments do not have any suffix
added to them (e.g. "val", "var", "expr", ...), except for `if` which
would otherwise result in an invalid C++ variable name.
- The associated clause's name is prepended to argument names that don't
already contain it as part of its name. This avoids future collisions
between arguments named the same way on different clauses and adding
both clauses to the same operation.
- Privatization and reduction related arguments that contain lists of
symbols pointing to privatizer/reducer operations use the "_syms"
suffix. This removes the inconsistencies between the names for
"copyprivate_funcs", "[in]reductions", "privatizers", etc.
- General improvements to names, replacement of camel case for snake
case everywhere, etc.
- Renaming of operation-associated operand structures to use the
"Operands" suffix in place of "ClauseOps", to better differentiate
between clause operand structures and operation operand structures.
- Fields on clause operand structures are sorted according to the
tablegen definition of the same clause.

The assembly format for a few arguments is updated to better reflect the
clause they are associated with:
- `chunk_size` -> `dist_schedule_chunk_size`
- `grain_size` -> `grainsize`
- `simd` -> `par_level_simd`

show more ...


Revision tags: llvmorg-19.1.0-rc1
# 98e733ea 25-Jul-2024 Tom Eccles <tom.eccles@arm.com>

[flang][OpenMP] Initialize privatised derived type variables (#100417)

Fixes #91928


Revision tags: llvmorg-20-init
# 2e6558b8 22-Jul-2024 Tom Eccles <tom.eccles@arm.com>

[flang][OpenMP] fix lastprivate for allocatables (#99686)

Don't use `copyHostAssociateVar` for allocatable variables. It isn't
clear to me whether or not this should be addressed in
`copyHostAssoc

[flang][OpenMP] fix lastprivate for allocatables (#99686)

Don't use `copyHostAssociateVar` for allocatable variables. It isn't
clear to me whether or not this should be addressed in
`copyHostAssociateVar` instead of inside OpenMP. I opted for OpenMP
to minimise how many things I effected. `copyHostAssociateVar` will
not update the destination variable if the destination variable
was unallocated. This is incorrect because assignment inside of the
openmp block can cause the allocation status of the variable to
change. Furthermore, `copyHostAssociateVar` seems to only copy the
variable address not other metadata like the size of the allocation.
Reallocation by assignment could cause this to change.

show more ...


# 4b9fab59 19-Jul-2024 David Truby <david.truby@arm.com>

[flang][OpenMP] Implement lastprivate with collapse (#99500)

This patch enables the lastprivate clause to be used in the presence of
the collapse clause.

Note: the way we currently implement las

[flang][OpenMP] Implement lastprivate with collapse (#99500)

This patch enables the lastprivate clause to be used in the presence of
the collapse clause.

Note: the way we currently implement lastprivate means that this adds a
large number of compare instructions to the end of every iteration of
the loop. This is a clearly non-optimal thing to do, but lastprivate in
general will need re-implementing to prevent this. This is planned as
part of the delayed privatization work. This current implementation is
just a stop-gap measure as generating sub-optimal but working code is
better than crashing out.

show more ...


# 99f6ff9c 04-Jul-2024 Sergio Afonso <safonsof@amd.com>

[Flang][OpenMP] Use InsertionGuard in DataSharingProcessor (#97562)

This patch removes the introduction of `fir.undef` operations as a way
to keep track of insertion points inside of the `DataShari

[Flang][OpenMP] Use InsertionGuard in DataSharingProcessor (#97562)

This patch removes the introduction of `fir.undef` operations as a way
to keep track of insertion points inside of the `DataSharingProcessor`,
and it replaces them with an `InsertionGuard` to avoid creating such
operations inside of loop wrappers.

Leaving any `fir.undef` operation inside of a loop wrapper would result
in a verifier error, since they enforce strict requirements on the
contents of their code regions.

show more ...


Revision tags: llvmorg-18.1.8
# 913a8244 07-Jun-2024 Kareem Ergawy <kareem.ergawy@amd.com>

[flang][OpenMP] Lower `target .. private(..)` to `omp.private` ops (#94195)

Extends delayed privatization support to `taraget .. private(..)`. With
this PR, `private` is support for `target` **only

[flang][OpenMP] Lower `target .. private(..)` to `omp.private` ops (#94195)

Extends delayed privatization support to `taraget .. private(..)`. With
this PR, `private` is support for `target` **only** is delayed
privatization mode.

show more ...


Revision tags: llvmorg-18.1.7
# 8b18f2fe 05-Jun-2024 Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>

[flang][OpenMP] Add `sym()` member function to omp::Object (#94493)

The object identity requires more than just `Symbol`. Don't use `id()`
to get the Symbol associated with the object, becase the r

[flang][OpenMP] Add `sym()` member function to omp::Object (#94493)

The object identity requires more than just `Symbol`. Don't use `id()`
to get the Symbol associated with the object, becase the return value
will need to change. Instead use `sym()` which is added for that reason.

show more ...


# e1aa8ad6 29-May-2024 Kareem Ergawy <kareem.ergawy@amd.com>

[flang][OpenMP] Fix bug in emitting `dealloc` logic (#93641)

Fixes a bug in emiting deacllocation logic when delayed privatization is
disabled. I introduced the bug when implementing delayed privat

[flang][OpenMP] Fix bug in emitting `dealloc` logic (#93641)

Fixes a bug in emiting deacllocation logic when delayed privatization is
disabled. I introduced the bug when implementing delayed privatization
for allocatables: when delayed privatization is disabled the
deacllocation ops are emitted for only one allocatable variables.

show more ...


12