@@ -2267,6 +2267,39 @@ static void genUnrollOp(Fortran::lower::AbstractConverter &converter,
2267
2267
// Apply unrolling to it
2268
2268
auto cli = canonLoop.getCli ();
2269
2269
mlir::omp::UnrollHeuristicOp::create (firOpBuilder, loc, cli);
2270
+
2271
+ static mlir::omp::LoopOp
2272
+ genTiledLoopOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
2273
+ semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
2274
+ mlir::Location loc, const ConstructQueue &queue,
2275
+ ConstructQueue::const_iterator item) {
2276
+ mlir::omp::LoopOperands loopClauseOps;
2277
+ llvm::SmallVector<const semantics::Symbol *> loopReductionSyms;
2278
+ genLoopClauses (converter, semaCtx, item->clauses , loc, loopClauseOps,
2279
+ loopReductionSyms);
2280
+
2281
+ DataSharingProcessor dsp (converter, semaCtx, item->clauses , eval,
2282
+ /* shouldCollectPreDeterminedSymbols=*/ true ,
2283
+ /* useDelayedPrivatization=*/ true , symTable);
2284
+ dsp.processStep1 (&loopClauseOps);
2285
+
2286
+ mlir::omp::LoopNestOperands loopNestClauseOps;
2287
+ llvm::SmallVector<const semantics::Symbol *> iv;
2288
+ genLoopNestClauses (converter, semaCtx, eval, item->clauses , loc,
2289
+ loopNestClauseOps, iv);
2290
+
2291
+ EntryBlockArgs loopArgs;
2292
+ loopArgs.priv .syms = dsp.getDelayedPrivSymbols ();
2293
+ loopArgs.priv .vars = loopClauseOps.privateVars ;
2294
+ loopArgs.reduction .syms = loopReductionSyms;
2295
+ loopArgs.reduction .vars = loopClauseOps.reductionVars ;
2296
+
2297
+ auto loopOp =
2298
+ genWrapperOp<mlir::omp::LoopOp>(converter, loc, loopClauseOps, loopArgs);
2299
+ genLoopNestOp (converter, symTable, semaCtx, eval, loc, queue, item,
2300
+ loopNestClauseOps, iv, {{loopOp, loopArgs}},
2301
+ llvm::omp::Directive::OMPD_loop, dsp);
2302
+ return loopOp;
2270
2303
}
2271
2304
2272
2305
static mlir::omp::MaskedOp
@@ -3487,13 +3520,10 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
3487
3520
newOp = genTeamsOp (converter, symTable, stmtCtx, semaCtx, eval, loc, queue,
3488
3521
item);
3489
3522
break ;
3490
- case llvm::omp::Directive::OMPD_tile: {
3491
- unsigned version = semaCtx.langOptions ().OpenMPVersion ;
3492
- if (!semaCtx.langOptions ().OpenMPSimd )
3493
- TODO (loc, " Unhandled loop directive (" +
3494
- llvm::omp::getOpenMPDirectiveName (dir, version) + " )" );
3523
+ case llvm::omp::Directive::OMPD_tile:
3524
+ newOp =
3525
+ genTiledLoopOp (converter, symTable, semaCtx, eval, loc, queue, item);
3495
3526
break ;
3496
- }
3497
3527
case llvm::omp::Directive::OMPD_unroll:
3498
3528
genUnrollOp (converter, symTable, stmtCtx, semaCtx, eval, loc, queue, item);
3499
3529
break ;
0 commit comments