42void buildCommonPassPipeline(
44 pm.
addPass(createConvertNVGPUToNVVMPass());
45 pm.
addPass(createGpuKernelOutliningPass());
47 pm.
addPass(createSCFToControlFlowPass());
48 pm.
addPass(createConvertNVVMToLLVMPass());
49 pm.
addPass(createConvertFuncToLLVMPass());
50 pm.
addPass(memref::createExpandStridedMetadataPass());
52 GpuNVVMAttachTargetOptions nvvmTargetOptions;
53 nvvmTargetOptions.triple =
options.cubinTriple;
54 nvvmTargetOptions.chip =
options.cubinChip;
55 nvvmTargetOptions.features =
options.cubinFeatures;
56 nvvmTargetOptions.optLevel =
options.optLevel;
57 nvvmTargetOptions.cmdOptions =
options.cmdOptions;
58 pm.
addPass(createGpuNVVMAttachTarget(nvvmTargetOptions));
59 pm.
addPass(createLowerAffinePass());
60 pm.
addPass(createArithToLLVMConversionPass());
61 ConvertIndexToLLVMPassOptions convertIndexToLLVMPassOpt;
62 convertIndexToLLVMPassOpt.indexBitwidth =
options.indexBitWidth;
63 pm.
addPass(createConvertIndexToLLVMPass(convertIndexToLLVMPassOpt));
73 ConvertGpuOpsToNVVMOpsOptions opt;
74 opt.useBarePtrCallConv =
options.kernelUseBarePtrCallConv;
75 opt.indexBitwidth =
options.indexBitWidth;
76 opt.allowPatternRollback =
options.allowPatternRollback;
77 pm.
addNestedPass<gpu::GPUModuleOp>(createConvertGpuOpsToNVVMOps(opt));
80 pm.
addNestedPass<gpu::GPUModuleOp>(createReconcileUnrealizedCastsPass());
88 GpuToLLVMConversionPassOptions opt;
89 opt.hostBarePtrCallConv =
options.hostUseBarePtrCallConv;
90 opt.kernelBarePtrCallConv =
options.kernelUseBarePtrCallConv;
91 pm.
addPass(createGpuToLLVMConversionPass(opt));
93 GpuAttachSelectObjectPassOptions gpuAttachSelectObjectPassOptions;
94 gpuAttachSelectObjectPassOptions.priority =
options.defaultCtorPriority;
95 pm.
addPass(createGpuAttachSelectObjectPass(gpuAttachSelectObjectPassOptions));
97 GpuModuleToBinaryPassOptions gpuModuleToBinaryPassOptions;
98 gpuModuleToBinaryPassOptions.compilationTarget =
options.cubinFormat;
99 pm.
addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions));
100 pm.
addPass(createConvertMathToLLVMPass());
103 pm.
addPass(createReconcileUnrealizedCastsPass());
111 buildCommonPassPipeline(pm,
options);
114 buildGpuPassPipeline(pm,
options);
117 buildHostPostPipeline(pm,
options);
122 "gpu-lower-to-nvvm-pipeline",
123 "The default pipeline lowers main dialects (arith, memref, scf, "
124 "vector, gpu, and nvgpu) to NVVM. It starts by lowering GPU code to the "
125 "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 > createCanonicalizerPass(const GreedyRewriteConfig &config, ArrayRef< std::string > disabledPatterns={}, ArrayRef< std::string > enabledPatterns={})
Creates an instance of the Canonicalizer pass with the specified config.
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.