Commit 9e13ed3
committed
[MLIR][OpenMP] Refactor translation of
The `omp.loop_nest` operation is always wrapped by a set of one or more OpenMP
loop wrapper operations (i.e. implementing the `omp::LoopWrapperInterface`),
which impact how it must be lowered.
However, the creation of the list of canonical loop objects and processing of
the `collapse` information (plus potentially other loop transformations when
supported in the future) have to be performed in the same way regardless of the
loop wrappers applied. This patch extracts this common handling out of the
translation functions for `omp.wsloop` and `omp.simd` and makes some
infrastructure changes in preparation for handling multiple wrappers (i.e.
composite constructs).
This work uncovered a couple bugs that are also addressed:
- `LoopNestOp::gatherWrappers()` would include `omp.parallel` when not taking
a loop wrapper role.
- Translation to LLVM IR of `omp.loop_nest` inside of `omp.simd` always
assumed the stop value was included, which wasn't caught due to a broken unit
test.
This patch is implemented assuming `omp.parallel` remains a loop wrapper
operation, which is currently under discussion in this
[RFC](https://discourse.llvm.org/t/rfc-disambiguation-between-loop-and-block-associated-omp-parallelop/79972).
Until consensus is reached there, this will remain as a draft PR.omp.loop_nest
1 parent 82ee7ae commit 9e13ed3
File tree
3 files changed
+184
-143
lines changed- mlir
- lib
- Dialect/OpenMP/IR
- Target/LLVMIR/Dialect/OpenMP
- test/Target/LLVMIR
3 files changed
+184
-143
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2144 | 2144 | | |
2145 | 2145 | | |
2146 | 2146 | | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
2147 | 2153 | | |
2148 | 2154 | | |
2149 | 2155 | | |
| |||
0 commit comments