46 void buildCommonPassPipeline(
48 pm.
addPass(createConvertNVGPUToNVVMPass());
49 pm.
addPass(createGpuKernelOutliningPass());
51 pm.
addPass(createSCFToControlFlowPass());
52 pm.
addPass(createConvertNVVMToLLVMPass());
53 pm.
addPass(createConvertFuncToLLVMPass());
54 pm.
addPass(memref::createExpandStridedMetadataPass());
56 GpuNVVMAttachTargetOptions nvvmTargetOptions;
57 nvvmTargetOptions.triple =
options.cubinTriple;
58 nvvmTargetOptions.chip =
options.cubinChip;
59 nvvmTargetOptions.features =
options.cubinFeatures;
60 nvvmTargetOptions.optLevel =
options.optLevel;
61 nvvmTargetOptions.cmdOptions =
options.cmdOptions;
62 pm.
addPass(createGpuNVVMAttachTarget(nvvmTargetOptions));
63 pm.
addPass(createLowerAffinePass());
64 pm.
addPass(createArithToLLVMConversionPass());
65 ConvertIndexToLLVMPassOptions convertIndexToLLVMPassOpt;
66 convertIndexToLLVMPassOpt.indexBitwidth =
options.indexBitWidth;
67 pm.
addPass(createConvertIndexToLLVMPass(convertIndexToLLVMPassOpt));
77 ConvertGpuOpsToNVVMOpsOptions opt;
78 opt.useBarePtrCallConv =
options.kernelUseBarePtrCallConv;
79 opt.indexBitwidth =
options.indexBitWidth;
80 pm.
addNestedPass<gpu::GPUModuleOp>(createConvertGpuOpsToNVVMOps(opt));
83 pm.
addNestedPass<gpu::GPUModuleOp>(createReconcileUnrealizedCastsPass());
91 GpuToLLVMConversionPassOptions opt;
92 opt.hostBarePtrCallConv =
options.hostUseBarePtrCallConv;
93 opt.kernelBarePtrCallConv =
options.kernelUseBarePtrCallConv;
94 pm.
addPass(createGpuToLLVMConversionPass(opt));
96 GpuModuleToBinaryPassOptions gpuModuleToBinaryPassOptions;
97 gpuModuleToBinaryPassOptions.compilationTarget =
options.cubinFormat;
98 pm.
addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions));
99 pm.
addPass(createConvertMathToLLVMPass());
102 pm.
addPass(createReconcileUnrealizedCastsPass());
110 buildCommonPassPipeline(pm,
options);
113 buildGpuPassPipeline(pm,
options);
116 buildHostPostPipeline(pm,
options);
121 "gpu-lower-to-nvvm-pipeline",
122 "The default pipeline lowers main dialects (arith, memref, scf, "
123 "vector, gpu, and nvgpu) to NVVM. It starts by lowering GPU code to the "
124 "specified compilation target (default is fatbin) then lowers the host "
static llvm::ManagedStatic< PassManagerOptions > options
This class represents a pass manager that runs passes on either a specific operation type,...
void addPass(std::unique_ptr< Pass > pass)
Add the given pass to this pass manager.
void addNestedPass(std::unique_ptr< Pass > pass)
Add the given pass to a nested pass manager for the given operation kind OpT.
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.
std::unique_ptr< Pass > createCSEPass()
Creates a pass to perform common sub expression elimination.
std::unique_ptr< Pass > createCanonicalizerPass()
Creates an instance of the Canonicalizer pass, configured with default settings (which can be overrid...
std::unique_ptr< Pass > createConvertVectorToSCFPass(const VectorTransferToSCFOptions &options=VectorTransferToSCFOptions())
Create a pass to convert a subset of vector ops to SCF.
PassPipelineRegistration provides a global initializer that registers a Pass pipeline builder routine...
Options for the gpu to nvvm pipeline.