41void 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 opt.allowPatternRollback =
options.allowPatternRollback;
76 pm.
addNestedPass<gpu::GPUModuleOp>(createConvertGpuOpsToNVVMOps(opt));
79 pm.
addNestedPass<gpu::GPUModuleOp>(createReconcileUnrealizedCastsPass());
87 GpuToLLVMConversionPassOptions opt;
88 opt.hostBarePtrCallConv =
options.hostUseBarePtrCallConv;
89 opt.kernelBarePtrCallConv =
options.kernelUseBarePtrCallConv;
90 pm.
addPass(createGpuToLLVMConversionPass(opt));
92 GpuModuleToBinaryPassOptions gpuModuleToBinaryPassOptions;
93 gpuModuleToBinaryPassOptions.compilationTarget =
options.cubinFormat;
94 pm.
addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions));
95 pm.
addPass(createConvertMathToLLVMPass());
98 pm.
addPass(createReconcileUnrealizedCastsPass());
106 buildCommonPassPipeline(pm,
options);
109 buildGpuPassPipeline(pm,
options);
112 buildHostPostPipeline(pm,
options);
117 "gpu-lower-to-nvvm-pipeline",
118 "The default pipeline lowers main dialects (arith, memref, scf, "
119 "vector, gpu, and nvgpu) to NVVM. It starts by lowering GPU code to the "
120 "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 pipelines 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.