[PATCH] D92065: [flang][openacc] Lower parallel loop combined construct
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 24 16:31:18 PST 2020
clementval created this revision.
clementval added reviewers: sscalpone, schweitz, jeanPerier, SouraVX, kiranchandramohan.
Herald added subscribers: llvm-commits, mehdi_amini, rriddle.
Herald added a project: LLVM.
clementval requested review of this revision.
Herald added a subscriber: stephenneuendorffer.
This patch lower the parallel loop combined construct to MLIR ops.
This code was part of the PR #558 on fir-dev
https://github.com/flang-compiler/f18-llvm-project/pull/558
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92065
Files:
flang/lib/Lower/OpenACC.cpp
Index: flang/lib/Lower/OpenACC.cpp
===================================================================
--- flang/lib/Lower/OpenACC.cpp
+++ flang/lib/Lower/OpenACC.cpp
@@ -587,6 +587,36 @@
}
}
+static void
+genACCParallelLoopOps(Fortran::lower::AbstractConverter &converter,
+ const Fortran::parser::AccClauseList &accClauseList) {
+ createParallelOp(converter, accClauseList);
+ createLoopOp(converter, accClauseList);
+}
+
+static void
+genACC(Fortran::lower::AbstractConverter &converter,
+ Fortran::lower::pft::Evaluation &eval,
+ const Fortran::parser::OpenACCCombinedConstruct &combinedConstruct) {
+ const auto &beginCombinedDirective =
+ std::get<Fortran::parser::AccBeginCombinedDirective>(combinedConstruct.t);
+ const auto &combinedDirective =
+ std::get<Fortran::parser::AccCombinedDirective>(beginCombinedDirective.t);
+ const auto &accClauseList =
+ std::get<Fortran::parser::AccClauseList>(beginCombinedDirective.t);
+
+ if (combinedDirective.v == llvm::acc::ACCD_kernels_loop) {
+ TODO("OpenACC Kernels Loop construct not lowered yet!");
+ } else if (combinedDirective.v == llvm::acc::ACCD_parallel_loop) {
+ genACCParallelLoopOps(converter, accClauseList);
+ } else if (combinedDirective.v == llvm::acc::ACCD_serial_loop) {
+ TODO("OpenACC Serial Loop construct not lowered yet!");
+ } else {
+ llvm::report_fatal_error(
+ "Unknown combined construct encountered in lowering");
+ }
+}
+
static void
genACCEnterDataOp(Fortran::lower::AbstractConverter &converter,
const Fortran::parser::AccClauseList &accClauseList) {
@@ -939,7 +969,7 @@
},
[&](const Fortran::parser::OpenACCCombinedConstruct
&combinedConstruct) {
- TODO("OpenACC Combined construct not lowered yet!");
+ genACC(converter, eval, combinedConstruct);
},
[&](const Fortran::parser::OpenACCLoopConstruct &loopConstruct) {
genACC(converter, eval, loopConstruct);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92065.307477.patch
Type: text/x-patch
Size: 2043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201125/48dc36ea/attachment.bin>
More information about the llvm-commits
mailing list