[flang-commits] [flang] d4a5470 - [flang][openacc] Add proper TODO for reduction with dynamic shaped array
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Mon Jul 17 13:03:43 PDT 2023
Author: Valentin Clement
Date: 2023-07-17T13:03:36-07:00
New Revision: d4a5470d8c4075045392397b016d4ca60def5da3
URL: https://github.com/llvm/llvm-project/commit/d4a5470d8c4075045392397b016d4ca60def5da3
DIFF: https://github.com/llvm/llvm-project/commit/d4a5470d8c4075045392397b016d4ca60def5da3.diff
LOG: [flang][openacc] Add proper TODO for reduction with dynamic shaped array
Lowering for reduction with dynamic shaped arrays is not implemented yet.
Add a proper TODO for the time being.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155324
Added:
Modified:
flang/lib/Lower/OpenACC.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 745f9ac17f8fe5..8f8ce041a77c3a 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -888,6 +888,20 @@ mlir::acc::ReductionRecipeOp Fortran::lower::createOrGetReductionRecipe(
return recipe;
}
+/// Determine if the bounds represent a dynamic shape.
+bool hasDynamicShape(llvm::SmallVector<mlir::Value> &bounds) {
+ if (bounds.empty())
+ return false;
+ for (auto b : bounds) {
+ auto op = mlir::dyn_cast<mlir::acc::DataBoundsOp>(b.getDefiningOp());
+ if (((op.getLowerbound() && !fir::getIntIfConstant(op.getLowerbound())) ||
+ (op.getUpperbound() && !fir::getIntIfConstant(op.getUpperbound()))) &&
+ op.getExtent() && !fir::getIntIfConstant(op.getExtent()))
+ return true;
+ }
+ return false;
+}
+
static void
genReductions(const Fortran::parser::AccObjectListWithReduction &objectList,
Fortran::lower::AbstractConverter &converter,
@@ -908,6 +922,9 @@ genReductions(const Fortran::parser::AccObjectListWithReduction &objectList,
converter, builder, semanticsContext, stmtCtx, accObject,
operandLocation, asFortran, bounds);
+ if (hasDynamicShape(bounds))
+ TODO(operandLocation, "OpenACC reductions with dynamic shaped array");
+
mlir::Type reductionTy = fir::unwrapRefType(baseAddr.getType());
if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(reductionTy))
reductionTy = seqTy.getEleTy();
More information about the flang-commits
mailing list