@@ -65,6 +65,18 @@ struct TestLowerToNVVMOptions
65
65
*this , " opt-level" ,
66
66
llvm::cl::desc (" Optimization level for NVVM compilation" ),
67
67
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 )};
68
80
};
69
81
70
82
// ===----------------------------------------------------------------------===//
@@ -105,7 +117,10 @@ void buildCommonPassPipeline(OpPassManager &pm,
105
117
void buildGpuPassPipeline (OpPassManager &pm,
106
118
const TestLowerToNVVMOptions &options) {
107
119
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));
109
124
pm.addNestedPass <gpu::GPUModuleOp>(createCanonicalizerPass ());
110
125
pm.addNestedPass <gpu::GPUModuleOp>(createCSEPass ());
111
126
pm.addNestedPass <gpu::GPUModuleOp>(createReconcileUnrealizedCastsPass ());
@@ -116,7 +131,10 @@ void buildGpuPassPipeline(OpPassManager &pm,
116
131
// ===----------------------------------------------------------------------===//
117
132
void buildHostPostPipeline (OpPassManager &pm,
118
133
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));
120
138
121
139
GpuModuleToBinaryPassOptions gpuModuleToBinaryPassOptions;
122
140
gpuModuleToBinaryPassOptions.compilationTarget = options.cubinFormat ;
0 commit comments