@@ -65,6 +65,18 @@ struct TestLowerToNVVMOptions
6565 *this , " opt-level" ,
6666 llvm::cl::desc (" Optimization level for NVVM compilation" ),
6767 llvm::cl::init (2 )};
68+ PassOptions::Option<bool > kernelUseBarePtrCallConv{
69+ *this , " kernel-bare-ptr-calling-convention" ,
70+ llvm::cl::desc (
71+ " Whether to use the bareptr calling convention on the kernel "
72+ " (warning this should be false until the GPU layering is fixed)" ),
73+ llvm::cl::init (false )};
74+ PassOptions::Option<bool > hostUseBarePtrCallConv{
75+ *this , " host-bare-ptr-calling-convention" ,
76+ llvm::cl::desc (
77+ " Whether to use the bareptr calling convention on the host (warning "
78+ " this should be false until the GPU layering is fixed)" ),
79+ llvm::cl::init (false )};
6880};
6981
7082// ===----------------------------------------------------------------------===//
@@ -105,7 +117,10 @@ void buildCommonPassPipeline(OpPassManager &pm,
105117void buildGpuPassPipeline (OpPassManager &pm,
106118 const TestLowerToNVVMOptions &options) {
107119 pm.addNestedPass <gpu::GPUModuleOp>(createStripDebugInfoPass ());
108- pm.addNestedPass <gpu::GPUModuleOp>(createConvertGpuOpsToNVVMOps ());
120+ ConvertGpuOpsToNVVMOpsOptions opt;
121+ opt.useBarePtrCallConv = options.kernelUseBarePtrCallConv ;
122+ opt.indexBitwidth = options.indexBitWidth ;
123+ pm.addNestedPass <gpu::GPUModuleOp>(createConvertGpuOpsToNVVMOps (opt));
109124 pm.addNestedPass <gpu::GPUModuleOp>(createCanonicalizerPass ());
110125 pm.addNestedPass <gpu::GPUModuleOp>(createCSEPass ());
111126 pm.addNestedPass <gpu::GPUModuleOp>(createReconcileUnrealizedCastsPass ());
@@ -116,7 +131,10 @@ void buildGpuPassPipeline(OpPassManager &pm,
116131// ===----------------------------------------------------------------------===//
117132void buildHostPostPipeline (OpPassManager &pm,
118133 const TestLowerToNVVMOptions &options) {
119- pm.addPass (createGpuToLLVMConversionPass ());
134+ GpuToLLVMConversionPassOptions opt;
135+ opt.hostBarePtrCallConv = options.hostUseBarePtrCallConv ;
136+ opt.kernelBarePtrCallConv = options.kernelUseBarePtrCallConv ;
137+ pm.addPass (createGpuToLLVMConversionPass (opt));
120138
121139 GpuModuleToBinaryPassOptions gpuModuleToBinaryPassOptions;
122140 gpuModuleToBinaryPassOptions.compilationTarget = options.cubinFormat ;
0 commit comments