@@ -604,6 +604,18 @@ class ClauseProcessor {
604
604
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
605
605
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
606
606
&useDeviceSymbols) const ;
607
+ bool
608
+ processIsDevicePtr (llvm::SmallVectorImpl<mlir::Value> &operands,
609
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
610
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
611
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
612
+ &isDeviceSymbols) const ;
613
+ bool
614
+ processHasDeviceAddr (llvm::SmallVectorImpl<mlir::Value> &operands,
615
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
616
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
617
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
618
+ &isDeviceSymbols) const ;
607
619
608
620
// Call this method for these clauses that should be supported but are not
609
621
// implemented yet. It triggers a compilation error if any of the given
@@ -1890,6 +1902,34 @@ bool ClauseProcessor::processUseDevicePtr(
1890
1902
});
1891
1903
}
1892
1904
1905
+ bool ClauseProcessor::processIsDevicePtr (
1906
+ llvm::SmallVectorImpl<mlir::Value> &operands,
1907
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
1908
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
1909
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &isDeviceSymbols)
1910
+ const {
1911
+ return findRepeatableClause<ClauseTy::IsDevicePtr>(
1912
+ [&](const ClauseTy::IsDevicePtr *devPtrClause,
1913
+ const Fortran::parser::CharBlock &) {
1914
+ addUseDeviceClause (converter, devPtrClause->v , operands, isDeviceTypes,
1915
+ isDeviceLocs, isDeviceSymbols);
1916
+ });
1917
+ }
1918
+
1919
+ bool ClauseProcessor::processHasDeviceAddr (
1920
+ llvm::SmallVectorImpl<mlir::Value> &operands,
1921
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
1922
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
1923
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &isDeviceSymbols)
1924
+ const {
1925
+ return findRepeatableClause<ClauseTy::HasDeviceAddr>(
1926
+ [&](const ClauseTy::HasDeviceAddr *devAddrClause,
1927
+ const Fortran::parser::CharBlock &) {
1928
+ addUseDeviceClause (converter, devAddrClause->v , operands, isDeviceTypes,
1929
+ isDeviceLocs, isDeviceSymbols);
1930
+ });
1931
+ }
1932
+
1893
1933
template <typename ... Ts>
1894
1934
void ClauseProcessor::processTODO (mlir::Location currentLocation,
1895
1935
llvm::omp::Directive directive) const {
@@ -2617,6 +2657,10 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
2617
2657
llvm::SmallVector<mlir::Type> mapSymTypes;
2618
2658
llvm::SmallVector<mlir::Location> mapSymLocs;
2619
2659
llvm::SmallVector<const Fortran::semantics::Symbol *> mapSymbols;
2660
+ llvm::SmallVector<mlir::Value> devicePtrOperands, deviceAddrOperands;
2661
+ llvm::SmallVector<mlir::Type> useDeviceTypes;
2662
+ llvm::SmallVector<mlir::Location> useDeviceLocs;
2663
+ llvm::SmallVector<const Fortran::semantics::Symbol *> useDeviceSymbols;
2620
2664
2621
2665
ClauseProcessor cp (converter, clauseList);
2622
2666
cp.processIf (Fortran::parser::OmpIfClause::DirectiveNameModifier::Target,
@@ -2626,11 +2670,13 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
2626
2670
cp.processNowait (nowaitAttr);
2627
2671
cp.processMap (currentLocation, directive, semanticsContext, stmtCtx,
2628
2672
mapOperands, &mapSymTypes, &mapSymLocs, &mapSymbols);
2673
+ cp.processIsDevicePtr (devicePtrOperands, useDeviceTypes, useDeviceLocs,
2674
+ useDeviceSymbols);
2675
+ cp.processHasDeviceAddr (deviceAddrOperands, useDeviceTypes, useDeviceLocs,
2676
+ useDeviceSymbols);
2629
2677
cp.processTODO <Fortran::parser::OmpClause::Private,
2630
2678
Fortran::parser::OmpClause::Depend,
2631
2679
Fortran::parser::OmpClause::Firstprivate,
2632
- Fortran::parser::OmpClause::IsDevicePtr,
2633
- Fortran::parser::OmpClause::HasDeviceAddr,
2634
2680
Fortran::parser::OmpClause::Reduction,
2635
2681
Fortran::parser::OmpClause::InReduction,
2636
2682
Fortran::parser::OmpClause::Allocate,
@@ -2705,7 +2751,7 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
2705
2751
2706
2752
auto targetOp = converter.getFirOpBuilder ().create <mlir::omp::TargetOp>(
2707
2753
currentLocation, ifClauseOperand, deviceOperand, threadLimitOperand,
2708
- nowaitAttr, mapOperands);
2754
+ nowaitAttr, devicePtrOperands, deviceAddrOperands, mapOperands);
2709
2755
2710
2756
genBodyOfTargetOp (converter, eval, targetOp, mapSymTypes, mapSymLocs,
2711
2757
mapSymbols, currentLocation);
@@ -3101,6 +3147,8 @@ genOMP(Fortran::lower::AbstractConverter &converter,
3101
3147
!std::get_if<Fortran::parser::OmpClause::Map>(&clause.u ) &&
3102
3148
!std::get_if<Fortran::parser::OmpClause::UseDevicePtr>(&clause.u ) &&
3103
3149
!std::get_if<Fortran::parser::OmpClause::UseDeviceAddr>(&clause.u ) &&
3150
+ !std::get_if<Fortran::parser::OmpClause::IsDevicePtr>(&clause.u ) &&
3151
+ !std::get_if<Fortran::parser::OmpClause::HasDeviceAddr>(&clause.u ) &&
3104
3152
!std::get_if<Fortran::parser::OmpClause::ThreadLimit>(&clause.u ) &&
3105
3153
!std::get_if<Fortran::parser::OmpClause::NumTeams>(&clause.u )) {
3106
3154
TODO (clauseLocation, " OpenMP Block construct clause" );
0 commit comments