9 Commits

Author SHA1 Message Date
Sergio Afonso
0a17bdfc36
[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.
2024-10-15 11:28:39 +01:00
Tom Eccles
f2027a9388
[flang][OpenMP] use reduction alloc region (#102525)
I removed the `*-hlfir*` tests because they are duplicate now that the
other tests have been updated to use the HLFIR lowering.

3/3
Part 1: https://github.com/llvm/llvm-project/pull/102522
Part 2: https://github.com/llvm/llvm-project/pull/102524
2024-08-22 14:12:07 +01:00
Kareem Ergawy
6af4118f15
Reapply #91116 with fix (#93160)
This PR contains 2 commits:
1. A commit to reapply changes introduced #91116 (was reverted earlier
due to test suite failures)
2. A commit containing a possible solution for the issue causing the
test suite failures. In particular, it introduces a simple symbol
visitor class to keep track of the current active OMP construct and
marking this active construct as the scope defining the symbol being
visisted.
2024-05-27 14:26:52 +02:00
Muhammad Omair Javaid
85e1124049 Revert "[flang][OpenMP] Try to unify induction var privatization for OMP regions. (#91116)"
This reverts commit 2a97b507dc643b7ee3bc651b3f21b754cfba433c.

It has broken LLVM testsuite on various bots
https://lab.llvm.org/buildbot/#/builders/184/builds/12760
https://lab.llvm.org/buildbot/#/builders/197/builds/14376
https://lab.llvm.org/buildbot/#/builders/179/builds/10176
2024-05-21 06:51:30 +05:00
Kareem Ergawy
2a97b507dc
[flang][OpenMP] Try to unify induction var privatization for OMP regions. (#91116) 2024-05-18 08:39:58 +02:00
Tom Eccles
74a87548e5
[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.
2024-05-16 15:27:59 +01:00
Sergio Afonso
ca4dbc2718
[Flang][OpenMP][Lower] Update workshare-loop lowering (5/5) (#89215)
This patch updates lowering from PFT to MLIR of workshare loops to
follow the loop wrapper approach. Unit tests impacted by this change are
also updated.

As the last patch of the stack, this should compile and pass unit tests.
2024-04-24 14:30:03 +01:00
Tom Eccles
18bf0c3c1d
[flang][OpenMP] fix reduction of arrays with non-default lower bounds (#89611)
It turned out that `hlfir::genVariableBox` didn't add lower bounds to
the boxes it created. Using a shapeshift instead of only a shape adds
the lower bounds information to the thread-local copy of the box.

Fixes #89259
2024-04-24 10:29:33 +01:00
Tom Eccles
8cc34fadec
[flang][OpenMP] Support reduction of allocatable variables (#88392)
Both arrays and trivial scalars are supported. Both cases must use
by-ref reductions because both are boxed.

My understanding of the standards are that OpenMP says that this should
follow the rules of the intrinsic reduction operators in fortran, and
fortran says that unallocated allocatable variables can only be
referenced to allocate them or test if they are already allocated.
Therefore we do not need a null pointer check in the combiner region.
2024-04-23 10:34:28 +01:00