Skip to content

Commit d4a5470

Browse files
committed
[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
1 parent d78701e commit d4a5470

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

flang/lib/Lower/OpenACC.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,20 @@ mlir::acc::ReductionRecipeOp Fortran::lower::createOrGetReductionRecipe(
888888
return recipe;
889889
}
890890

891+
/// Determine if the bounds represent a dynamic shape.
892+
bool hasDynamicShape(llvm::SmallVector<mlir::Value> &bounds) {
893+
if (bounds.empty())
894+
return false;
895+
for (auto b : bounds) {
896+
auto op = mlir::dyn_cast<mlir::acc::DataBoundsOp>(b.getDefiningOp());
897+
if (((op.getLowerbound() && !fir::getIntIfConstant(op.getLowerbound())) ||
898+
(op.getUpperbound() && !fir::getIntIfConstant(op.getUpperbound()))) &&
899+
op.getExtent() && !fir::getIntIfConstant(op.getExtent()))
900+
return true;
901+
}
902+
return false;
903+
}
904+
891905
static void
892906
genReductions(const Fortran::parser::AccObjectListWithReduction &objectList,
893907
Fortran::lower::AbstractConverter &converter,
@@ -908,6 +922,9 @@ genReductions(const Fortran::parser::AccObjectListWithReduction &objectList,
908922
converter, builder, semanticsContext, stmtCtx, accObject,
909923
operandLocation, asFortran, bounds);
910924

925+
if (hasDynamicShape(bounds))
926+
TODO(operandLocation, "OpenACC reductions with dynamic shaped array");
927+
911928
mlir::Type reductionTy = fir::unwrapRefType(baseAddr.getType());
912929
if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(reductionTy))
913930
reductionTy = seqTy.getEleTy();

0 commit comments

Comments
 (0)