@@ -641,6 +641,18 @@ class ClauseProcessor {
641
641
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
642
642
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
643
643
&useDeviceSymbols) const ;
644
+ bool
645
+ processIsDevicePtr (llvm::SmallVectorImpl<mlir::Value> &operands,
646
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
647
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
648
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
649
+ &isDeviceSymbols) const ;
650
+ bool
651
+ processHasDeviceAddr (llvm::SmallVectorImpl<mlir::Value> &operands,
652
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
653
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
654
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
655
+ &isDeviceSymbols) const ;
644
656
645
657
template <typename T>
646
658
bool processMotionClauses (Fortran::lower::StatementContext &stmtCtx,
@@ -2072,6 +2084,34 @@ bool ClauseProcessor::processMotionClauses(
2072
2084
2073
2085
mapOperands.push_back (mapOp);
2074
2086
}
2087
+ });
2088
+ }
2089
+
2090
+ bool ClauseProcessor::processIsDevicePtr (
2091
+ llvm::SmallVectorImpl<mlir::Value> &operands,
2092
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
2093
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
2094
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &isDeviceSymbols)
2095
+ const {
2096
+ return findRepeatableClause<ClauseTy::IsDevicePtr>(
2097
+ [&](const ClauseTy::IsDevicePtr *devPtrClause,
2098
+ const Fortran::parser::CharBlock &) {
2099
+ addUseDeviceClause (converter, devPtrClause->v , operands, isDeviceTypes,
2100
+ isDeviceLocs, isDeviceSymbols);
2101
+ });
2102
+ }
2103
+
2104
+ bool ClauseProcessor::processHasDeviceAddr (
2105
+ llvm::SmallVectorImpl<mlir::Value> &operands,
2106
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
2107
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
2108
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &isDeviceSymbols)
2109
+ const {
2110
+ return findRepeatableClause<ClauseTy::HasDeviceAddr>(
2111
+ [&](const ClauseTy::HasDeviceAddr *devAddrClause,
2112
+ const Fortran::parser::CharBlock &) {
2113
+ addUseDeviceClause (converter, devAddrClause->v , operands, isDeviceTypes,
2114
+ isDeviceLocs, isDeviceSymbols);
2075
2115
});
2076
2116
}
2077
2117
@@ -2999,6 +3039,10 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
2999
3039
llvm::SmallVector<mlir::Type> mapSymTypes;
3000
3040
llvm::SmallVector<mlir::Location> mapSymLocs;
3001
3041
llvm::SmallVector<const Fortran::semantics::Symbol *> mapSymbols;
3042
+ llvm::SmallVector<mlir::Value> devicePtrOperands, deviceAddrOperands;
3043
+ llvm::SmallVector<mlir::Type> useDeviceTypes;
3044
+ llvm::SmallVector<mlir::Location> useDeviceLocs;
3045
+ llvm::SmallVector<const Fortran::semantics::Symbol *> useDeviceSymbols;
3002
3046
3003
3047
ClauseProcessor cp (converter, semaCtx, clauseList);
3004
3048
cp.processIf (Fortran::parser::OmpIfClause::DirectiveNameModifier::Target,
@@ -3008,11 +3052,13 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
3008
3052
cp.processNowait (nowaitAttr);
3009
3053
cp.processMap (currentLocation, directive, stmtCtx, mapOperands, &mapSymTypes,
3010
3054
&mapSymLocs, &mapSymbols);
3055
+ cp.processIsDevicePtr (devicePtrOperands, useDeviceTypes, useDeviceLocs,
3056
+ useDeviceSymbols);
3057
+ cp.processHasDeviceAddr (deviceAddrOperands, useDeviceTypes, useDeviceLocs,
3058
+ useDeviceSymbols);
3011
3059
cp.processTODO <Fortran::parser::OmpClause::Private,
3012
3060
Fortran::parser::OmpClause::Depend,
3013
3061
Fortran::parser::OmpClause::Firstprivate,
3014
- Fortran::parser::OmpClause::IsDevicePtr,
3015
- Fortran::parser::OmpClause::HasDeviceAddr,
3016
3062
Fortran::parser::OmpClause::Reduction,
3017
3063
Fortran::parser::OmpClause::InReduction,
3018
3064
Fortran::parser::OmpClause::Allocate,
@@ -3093,7 +3139,8 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
3093
3139
3094
3140
auto targetOp = converter.getFirOpBuilder ().create <mlir::omp::TargetOp>(
3095
3141
currentLocation, ifClauseOperand, deviceOperand, threadLimitOperand,
3096
- nullptr , mlir::ValueRange (), nowaitAttr, mapOperands);
3142
+ nullptr , mlir::ValueRange (), nowaitAttr, devicePtrOperands,
3143
+ deviceAddrOperands, mapOperands);
3097
3144
3098
3145
genBodyOfTargetOp (converter, semaCtx, eval, genNested, targetOp, mapSymTypes,
3099
3146
mapSymLocs, mapSymbols, currentLocation);
@@ -3700,6 +3747,8 @@ genOMP(Fortran::lower::AbstractConverter &converter,
3700
3747
!std::get_if<Fortran::parser::OmpClause::Map>(&clause.u ) &&
3701
3748
!std::get_if<Fortran::parser::OmpClause::UseDevicePtr>(&clause.u ) &&
3702
3749
!std::get_if<Fortran::parser::OmpClause::UseDeviceAddr>(&clause.u ) &&
3750
+ !std::get_if<Fortran::parser::OmpClause::IsDevicePtr>(&clause.u ) &&
3751
+ !std::get_if<Fortran::parser::OmpClause::HasDeviceAddr>(&clause.u ) &&
3703
3752
!std::get_if<Fortran::parser::OmpClause::ThreadLimit>(&clause.u ) &&
3704
3753
!std::get_if<Fortran::parser::OmpClause::NumTeams>(&clause.u )) {
3705
3754
TODO (clauseLocation, " OpenMP Block construct clause" );
0 commit comments