MLIR  20.0.0git
SCFToGPUPass.h
Go to the documentation of this file.
1 //===- SCFToGPUPass.h - Pass converting loops to GPU kernels ----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_
9 #define MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_
10 
12 #include "mlir/Support/LLVM.h"
13 
14 #include <memory>
15 
16 namespace mlir {
17 template <typename T>
18 class InterfacePass;
19 class Pass;
20 
21 #define GEN_PASS_DECL_CONVERTAFFINEFORTOGPU
22 #define GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPU
23 #include "mlir/Conversion/Passes.h.inc"
24 
25 /// Create a pass that converts loop nests into GPU kernels. It considers
26 /// top-level affine.for operations as roots of loop nests and converts them to
27 /// the gpu.launch operations if possible.
28 ///
29 /// No check on the size of the block or grid, or on the validity of
30 /// parallelization is performed, it is under the responsibility of the caller
31 /// to strip-mine the loops and to perform the dependence analysis before
32 /// calling the conversion.
33 std::unique_ptr<InterfacePass<FunctionOpInterface>>
34 createAffineForToGPUPass(unsigned numBlockDims, unsigned numThreadDims);
35 std::unique_ptr<InterfacePass<FunctionOpInterface>> createAffineForToGPUPass();
36 
37 /// Creates a pass that converts scf.parallel operations into a gpu.launch
38 /// operation. The mapping of loop dimensions to launch dimensions is derived
39 /// from mapping attributes. See ParallelToGpuLaunchLowering::matchAndRewrite
40 /// for a description of the used attributes.
41 std::unique_ptr<Pass> createParallelLoopToGpuPass();
42 
43 } // namespace mlir
44 
45 #endif // MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_
Include the generated interface declarations.
std::unique_ptr< InterfacePass< FunctionOpInterface > > createAffineForToGPUPass(unsigned numBlockDims, unsigned numThreadDims)
Create a pass that converts loop nests into GPU kernels.
std::unique_ptr< Pass > createParallelLoopToGpuPass()
Creates a pass that converts scf.parallel operations into a gpu.launch operation.