19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/Support/CommandLine.h"
23 #define GEN_PASS_DEF_CONVERTAFFINEFORTOGPUPASS
24 #define GEN_PASS_DEF_CONVERTPARALLELLOOPTOGPUPASS
25 #include "mlir/Conversion/Passes.h.inc"
36 :
public impl::ConvertAffineForToGPUPassBase<ForLoopMapper> {
39 void runOnOperation()
override {
40 for (
Operation &op : llvm::make_early_inc_range(
41 getOperation().getFunctionBody().getOps())) {
42 if (
auto forOp = dyn_cast<affine::AffineForOp>(&op)) {
51 struct ParallelLoopToGpuPass
52 :
public impl::ConvertParallelLoopToGpuPassBase<ParallelLoopToGpuPass> {
53 void runOnOperation()
override {
57 target.markUnknownOpDynamicallyLegal([](
Operation *) {
return true; });
static MLIRContext * getContext(OpFoldResult val)
This class describes a specific conversion target.
Operation is the basic unit of execution within MLIR.
Include the generated interface declarations.
void finalizeParallelLoopToGPUConversion(Operation *op)
Clean up after applyPartialConversion/applyFullConversion call.
void populateParallelLoopToGPUPatterns(RewritePatternSet &patterns)
Adds the conversion pattern from scf.parallel to gpu.launch to the provided pattern list.
LogicalResult convertAffineLoopNestToGPULaunch(affine::AffineForOp forOp, unsigned numBlockDims, unsigned numThreadDims)
Convert a perfect affine loop nest with the outermost loop identified by forOp into a gpu::Launch ope...
const FrozenRewritePatternSet & patterns
LogicalResult applyPartialConversion(ArrayRef< Operation * > ops, const ConversionTarget &target, const FrozenRewritePatternSet &patterns, ConversionConfig config=ConversionConfig())
Below we define several entry points for operation conversion.
void configureParallelLoopToGPULegality(ConversionTarget &target)
Configures the rewrite target such that only scf.parallel operations that are not rewritten by the pr...