18#include "mlir/Dialect/OpenACC/OpenACC.h"
25void CIRGenFunction::updateLoopOpParallelism(mlir::acc::LoopOp &op,
30 if (op.hasParallelismFlag(mlir::acc::DeviceType::None))
35 llvm_unreachable(
"Invalid parent directive kind");
39 op.addIndependent(builder.getContext(), {});
43 op.addAuto(builder.getContext(), {});
47 if (op.hasDefaultGangWorkerVector())
48 op.addAuto(builder.getContext(), {});
50 op.addSeq(builder.getContext(), {});
57 mlir::Location start =
getLoc(
s.getSourceRange().getBegin());
58 mlir::Location end =
getLoc(
s.getSourceRange().getEnd());
61 auto op = builder.create<LoopOp>(start, retTy, operands);
120 emitOpenACCClauses(op,
s.getDirectiveKind(),
s.getDirectiveLoc(),
123 updateLoopOpParallelism(op,
s.isOrphanedLoopConstruct(),
124 s.getParentComputeConstructKind());
126 mlir::LogicalResult stmtRes = mlir::success();
129 mlir::Block &block = op.getRegion().emplaceBlock();
130 mlir::OpBuilder::InsertionGuard guardCase(builder);
131 builder.setInsertionPointToEnd(&block);
132 LexicalScope ls{*
this, start, builder.getInsertionBlock()};
133 ActiveOpenACCLoopRAII activeLoop{*
this, &op};
136 builder.create<mlir::acc::YieldOp>(end);
This file defines OpenACC AST classes for statement-level contructs.
__device__ __2f16 float __ockl_bool s
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
mlir::LogicalResult emitStmt(const clang::Stmt *s, bool useCurrentScope, llvm::ArrayRef< const Attr * > attrs={})
mlir::LogicalResult emitOpenACCLoopConstruct(const OpenACCLoopConstruct &s)
This class represents a 'loop' construct.
The JSON file list parser is used to communicate input to InstallAPI.
Represents a scope, including function bodies, compound statements, and the substatements of if/while...