MLIR  20.0.0git
Passes.h
Go to the documentation of this file.
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 
14 namespace mlir {
15 namespace gpu {
16 
17 /// Options for the gpu to nvvm pipeline.
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(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("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("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("+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("fatbin")};
40  PassOptions::Option<int> optLevel{
41  *this, "opt-level",
42  llvm::cl::desc("Optimization level for NVVM compilation"),
43  llvm::cl::init(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(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(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.
66  const GPUToNVVMPipelineOptions &options);
67 
68 /// Register all pipeleines for the `gpu` dialect.
70 
71 } // namespace gpu
72 } // namespace mlir
73 
74 #endif
static llvm::ManagedStatic< PassManagerOptions > options
This class represents a pass manager that runs passes on either a specific operation type,...
Definition: PassManager.h:47
Subclasses of PassPipelineOptions provide a set of options that can be used to initialize a pass pipe...
Definition: PassOptions.h:368
void registerGPUToNVVMPipeline()
Register all pipeleines for the gpu dialect.
void buildLowerToNVVMPassPipeline(OpPassManager &pm, const GPUToNVVMPipelineOptions &options)
Adds the GPU to NVVM pipeline to the given pass manager.
Include the generated interface declarations.
Options for the gpu to nvvm pipeline.
Definition: Passes.h:19
PassOptions::Option< std::string > cubinChip
Definition: Passes.h:29
PassOptions::Option< int > optLevel
Definition: Passes.h:40
PassOptions::Option< bool > hostUseBarePtrCallConv
Definition: Passes.h:50
PassOptions::Option< std::string > cubinFeatures
Definition: Passes.h:32
PassOptions::Option< std::string > cubinFormat
Definition: Passes.h:36
PassOptions::Option< int64_t > indexBitWidth
Definition: Passes.h:20
PassOptions::Option< std::string > cubinTriple
Definition: Passes.h:25
PassOptions::Option< bool > kernelUseBarePtrCallConv
Definition: Passes.h:44