1//===- Passes.h - GPU NVVM pipeline entry points --------------------------===//
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#ifndef MLIR_DIALECT_GPU_PIPELINES_PASSES_H_
10#define MLIR_DIALECT_GPU_PIPELINES_PASSES_H_
11
12#include "mlir/Pass/PassOptions.h"
13
14namespace mlir {
15namespace gpu {
16
17/// Options for the gpu to nvvm pipeline.
18struct GPUToNVVMPipelineOptions
19 : public PassPipelineOptions<GPUToNVVMPipelineOptions> {
20 PassOptions::Option<int64_t> indexBitWidth{
21 *this, "index-bitwidth",
22 llvm::cl::desc("Bitwidth of the index type for the host (warning this "
23 "should be 64 until the GPU layering is fixed)"),
24 llvm::cl::init(Val: 64)};
25 PassOptions::Option<std::string> cubinTriple{
26 *this, "cubin-triple",
27 llvm::cl::desc("Triple to use to serialize to cubin."),
28 llvm::cl::init(Val: "nvptx64-nvidia-cuda")};
29 PassOptions::Option<std::string> cubinChip{
30 *this, "cubin-chip", llvm::cl::desc("Chip to use to serialize to cubin."),
31 llvm::cl::init(Val: "sm_50")};
32 PassOptions::Option<std::string> cubinFeatures{
33 *this, "cubin-features",
34 llvm::cl::desc("Features to use to serialize to cubin."),
35 llvm::cl::init(Val: "+ptx60")};
36 PassOptions::Option<std::string> cubinFormat{
37 *this, "cubin-format",
38 llvm::cl::desc("Compilation format to use to serialize to cubin."),
39 llvm::cl::init(Val: "fatbin")};
40 PassOptions::Option<int> optLevel{
41 *this, "opt-level",
42 llvm::cl::desc("Optimization level for NVVM compilation"),
43 llvm::cl::init(Val: 2)};
44 PassOptions::Option<bool> kernelUseBarePtrCallConv{
45 *this, "kernel-bare-ptr-calling-convention",
46 llvm::cl::desc(
47 "Whether to use the bareptr calling convention on the kernel "
48 "(warning this should be false until the GPU layering is fixed)"),
49 llvm::cl::init(Val: false)};
50 PassOptions::Option<bool> hostUseBarePtrCallConv{
51 *this, "host-bare-ptr-calling-convention",
52 llvm::cl::desc(
53 "Whether to use the bareptr calling convention on the host (warning "
54 "this should be false until the GPU layering is fixed)"),
55 llvm::cl::init(Val: false)};
56};
57
58//===----------------------------------------------------------------------===//
59// Building and Registering.
60//===----------------------------------------------------------------------===//
61
62/// Adds the GPU to NVVM pipeline to the given pass manager. Transforms main
63/// dialects into NVVM targets. Begins with GPU code regions, then handles host
64/// code.
65void buildLowerToNVVMPassPipeline(OpPassManager &pm,
66 const GPUToNVVMPipelineOptions &options);
67
68/// Register all pipeleines for the `gpu` dialect.
69void registerGPUToNVVMPipeline();
70
71} // namespace gpu
72} // namespace mlir
73
74#endif
75

source code of mlir/include/mlir/Dialect/GPU/Pipelines/Passes.h