• 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 utility functions exposed by the GPU dialect
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_GPU_UTILS_H_
14 #define MLIR_DIALECT_GPU_UTILS_H_
15 
16 #include "mlir/Support/LLVM.h"
17 
18 namespace mlir {
19 struct LogicalResult;
20 class Value;
21 
22 namespace gpu {
23 class GPUFuncOp;
24 class LaunchOp;
25 } // namespace gpu
26 
27 /// Get a gpu.func created from outlining the region of a gpu.launch op with the
28 /// given `kernelFnName`. The region of the `launchOp` can use values from
29 /// above. These need to be captured and passed as arguments to the generated
30 /// gpu.func. The generated function has arguments
31 /// - corresponding to the values passed in as `operands`, in that order.
32 /// - any additional values that might be used within the region of the
33 ///   `launchOp` and defined above it. These captured values are appended to the
34 ///   `operands` list.
35 gpu::GPUFuncOp outlineKernelFunc(gpu::LaunchOp launchOp, StringRef kernelFnName,
36                                  SmallVectorImpl<Value> &operands);
37 
38 /// Sink operations into the `launchOp` to reduce the number of values that are
39 /// used within the region of the operation, but defined outside of the
40 /// region.
41 LogicalResult sinkOperationsIntoLaunchOp(gpu::LaunchOp launchOp);
42 
43 } // namespace mlir
44 #endif // MLIR_DIALECT_GPU_UTILS_H_
45