Skip to content

Commit

Permalink
[flang][OpenMP] Add TODO and namespace for duplicate utils
Browse files Browse the repository at this point in the history
Adds a TODO for the duplicated utils that we had to copy for do
concurrent mapping. Also introduces the duplicate utils in a separate
`internal` namespace to avoid naming conflicts.
  • Loading branch information
ergawy committed Jun 5, 2024
1 parent a400728 commit d8d4c05
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions flang/lib/Optimizer/Transforms/DoConcurrentConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ namespace fir {
namespace Fortran {
namespace lower {
namespace omp {
namespace internal {
// TODO The following 2 functions are copied from "flang/Lower/OpenMP/Utils.h".
// This duplication is temporary until we find a solution for a shared location
// for these utils that does not introduce circular CMake deps.
mlir::omp::MapInfoOp
createMapInfoOp(mlir::OpBuilder &builder, mlir::Location loc,
mlir::Value baseAddr, mlir::Value varPtrPtr, std::string name,
Expand Down Expand Up @@ -139,6 +143,7 @@ mlir::Value calculateTripCount(fir::FirOpBuilder &builder, mlir::Location loc,

return tripCount;
}
} // namespace internal
} // namespace omp
} // namespace lower
} // namespace Fortran
Expand Down Expand Up @@ -219,8 +224,8 @@ class DoConcurrentConversion : public mlir::OpConversionPattern<fir::DoLoopOp> {
collapseClauseOps.loopStepVar.push_back(stepOp->getResult(0));

mlir::cast<mlir::omp::TargetOp>(targetOp).getTripCountMutable().assign(
Fortran::lower::omp::calculateTripCount(firBuilder, doLoop.getLoc(),
collapseClauseOps));
Fortran::lower::omp::internal::calculateTripCount(
firBuilder, doLoop.getLoc(), collapseClauseOps));
}

rewriter.eraseOp(doLoop);
Expand Down Expand Up @@ -337,7 +342,7 @@ class DoConcurrentConversion : public mlir::OpConversionPattern<fir::DoLoopOp> {
llvm::SmallVector<mlir::Value> boundsOps;
genBoundsOps(rewriter, liveIn.getLoc(), declareOp, boundsOps);

return Fortran::lower::omp::createMapInfoOp(
return Fortran::lower::omp ::internal::createMapInfoOp(
rewriter, liveIn.getLoc(), declareOp.getBase(), /*varPtrPtr=*/{},
declareOp.getUniqName().str(), boundsOps, /*members=*/{},
/*membersIndex=*/mlir::DenseIntElementsAttr{},
Expand Down

0 comments on commit d8d4c05

Please sign in to comment.