@@ -58,7 +58,8 @@ struct Options {
5858 llvm::cl::MiscFlags::CommaSeparated, llvm::cl::desc (" <lib1,lib2,...>" ),
5959 llvm::cl::cat (runnerCategory)};
6060 llvm::cl::opt<bool > printIr{
61- " print-ir" , llvm::cl::desc (" Print the IR before the execution." ),
61+ " print-ir" ,
62+ llvm::cl::desc (" Print the resulting IR before the execution." ),
6263 llvm::cl::init (false ), llvm::cl::cat (runnerCategory)};
6364 llvm::cl::opt<std::string> objDumpFile{
6465 " obj-dump-file" ,
@@ -121,13 +122,6 @@ void findFunc(Options &opts, ModuleOp mod) {
121122 }
122123}
123124
124- void pipeline (OpPassManager &pm) {
125- gc::GPUPipelineOptions pipelineOpts;
126- pipelineOpts.isUsmArgs = false ;
127- pipelineOpts.callFinish = true ;
128- populateGPUPipeline (pm, pipelineOpts);
129- }
130-
131125int main (int argc, char **argv) {
132126 Options opts;
133127 llvm::cl::ParseCommandLineOptions (argc, argv, " GraphCompiler GPU runner\n " );
@@ -148,19 +142,16 @@ int main(int argc, char **argv) {
148142 SmallVector<StringRef, 4 > sharedLibs (opts.sharedLibs .begin (),
149143 opts.sharedLibs .end ());
150144 builderOpts.funcName = opts.mainFuncName ;
145+ builderOpts.printIr = opts.printIr ;
151146 builderOpts.enableObjectDump = !opts.objDumpFile .getValue ().empty ();
152147 builderOpts.sharedLibPaths = sharedLibs;
153- if (opts.skipPipeline ) {
154- builderOpts.pipeline =
155- opts.printIr
156- ? [](OpPassManager &pm) { pm.addPass (createPrintIRPass ()); }
157- : [](OpPassManager &) {};
158- } else {
159- builderOpts.pipeline = opts.printIr ? [](OpPassManager &pm) {
160- pipeline (pm);
161- pm.addPass (createPrintIRPass ());
162- } : pipeline;
163- }
148+ builderOpts.pipeline =
149+ opts.skipPipeline ? [](OpPassManager &) {} : [](OpPassManager &pm) {
150+ gc::GPUPipelineOptions pipelineOpts;
151+ pipelineOpts.isUsmArgs = false ;
152+ pipelineOpts.callFinish = true ;
153+ populateGPUPipeline (pm, pipelineOpts);
154+ };
164155
165156 gc::gpu::OclModuleBuilder builder{mlirMod, builderOpts};
166157 auto runtime = gcGetOrReport (gc::gpu::OclRuntime::get ());
0 commit comments