• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- Passes.h - Pass Entrypoints ------------------------------*- 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 //
9 // This header file defines prototypes that expose pass constructors.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_GPU_PASSES_H_
14 #define MLIR_DIALECT_GPU_PASSES_H_
15 
16 #include "mlir/Pass/Pass.h"
17 
18 namespace mlir {
19 /// Replaces `gpu.launch` with `gpu.launch_func` by moving the region into
20 /// a separate kernel function.
21 std::unique_ptr<OperationPass<ModuleOp>> createGpuKernelOutliningPass();
22 
23 /// Rewrites a function region so that GPU ops execute asynchronously.
24 std::unique_ptr<OperationPass<FuncOp>> createGpuAsyncRegionPass();
25 
26 /// Collect a set of patterns to rewrite all-reduce ops within the GPU dialect.
27 void populateGpuAllReducePatterns(MLIRContext *context,
28                                   OwningRewritePatternList &patterns);
29 
30 /// Collect all patterns to rewrite ops within the GPU dialect.
populateGpuRewritePatterns(MLIRContext * context,OwningRewritePatternList & patterns)31 inline void populateGpuRewritePatterns(MLIRContext *context,
32                                        OwningRewritePatternList &patterns) {
33   populateGpuAllReducePatterns(context, patterns);
34 }
35 
36 //===----------------------------------------------------------------------===//
37 // Registration
38 //===----------------------------------------------------------------------===//
39 
40 /// Generate the code for registering passes.
41 #define GEN_PASS_REGISTRATION
42 #include "mlir/Dialect/GPU/Passes.h.inc"
43 
44 } // namespace mlir
45 
46 #endif // MLIR_DIALECT_GPU_PASSES_H_
47