41 void buildCommonPassPipeline(
43 pm.
addPass(createConvertNVGPUToNVVMPass());
44 pm.
addPass(createGpuKernelOutliningPass());
46 pm.
addPass(createSCFToControlFlowPass());
47 pm.
addPass(createConvertNVVMToLLVMPass());
48 pm.
addPass(createConvertFuncToLLVMPass());
49 pm.
addPass(memref::createExpandStridedMetadataPass());
51 GpuNVVMAttachTargetOptions nvvmTargetOptions;
52 nvvmTargetOptions.triple =
options.cubinTriple;
53 nvvmTargetOptions.chip =
options.cubinChip;
54 nvvmTargetOptions.features =
options.cubinFeatures;
55 nvvmTargetOptions.optLevel =
options.optLevel;
56 nvvmTargetOptions.cmdOptions =
options.cmdOptions;
57 pm.
addPass(createGpuNVVMAttachTarget(nvvmTargetOptions));
58 pm.
addPass(createLowerAffinePass());
59 pm.
addPass(createArithToLLVMConversionPass());
60 ConvertIndexToLLVMPassOptions convertIndexToLLVMPassOpt;
61 convertIndexToLLVMPassOpt.indexBitwidth =
options.indexBitWidth;
62 pm.
addPass(createConvertIndexToLLVMPass(convertIndexToLLVMPassOpt));
72 ConvertGpuOpsToNVVMOpsOptions opt;
73 opt.useBarePtrCallConv =
options.kernelUseBarePtrCallConv;
74 opt.indexBitwidth =
options.indexBitWidth;
75 pm.
addNestedPass<gpu::GPUModuleOp>(createConvertGpuOpsToNVVMOps(opt));
78 pm.
addNestedPass<gpu::GPUModuleOp>(createReconcileUnrealizedCastsPass());
86 GpuToLLVMConversionPassOptions opt;
87 opt.hostBarePtrCallConv =
options.hostUseBarePtrCallConv;
88 opt.kernelBarePtrCallConv =
options.kernelUseBarePtrCallConv;
89 pm.
addPass(createGpuToLLVMConversionPass(opt));
91 GpuModuleToBinaryPassOptions gpuModuleToBinaryPassOptions;
92 gpuModuleToBinaryPassOptions.compilationTarget =
options.cubinFormat;
93 pm.
addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions));
94 pm.
addPass(createConvertMathToLLVMPass());
97 pm.
addPass(createReconcileUnrealizedCastsPass());
105 buildCommonPassPipeline(pm,
options);
108 buildGpuPassPipeline(pm,
options);
111 buildHostPostPipeline(pm,
options);
116 "gpu-lower-to-nvvm-pipeline",
117 "The default pipeline lowers main dialects (arith, memref, scf, "
118 "vector, gpu, and nvgpu) to NVVM. It starts by lowering GPU code to the "
119 "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.