Hi Ruiling, But that would require sending dumpLLVMFileName as an aurgument to buildModuleFromSources().
Regards Manasi -----Original Message----- From: Song, Ruiling Sent: Thursday, August 13, 2015 7:18 PM To: Navare, Manasi D; [email protected] Subject: RE: [PATCH] backend/src/backend: Handle -dump-opt-llvm=[PATH] in clCompileProgram OpenCL API > -----Original Message----- > From: Navare, Manasi D > Sent: Thursday, August 13, 2015 8:59 PM > To: [email protected]; Song, Ruiling > Cc: Navare, Manasi D > Subject: [PATCH] backend/src/backend: Handle -dump-opt-llvm=[PATH] in > clCompileProgram OpenCL API > > Allows the user to request a dump of the LLVM-generated IR to the file > specified in [PATH] through clCompileProgram options > > Signed-off-by: Manasi Navare <[email protected]> > --- > backend/src/backend/program.cpp | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/backend/src/backend/program.cpp > b/backend/src/backend/program.cpp index 6d539a9..1b3fc82 100644 > --- a/backend/src/backend/program.cpp > +++ b/backend/src/backend/program.cpp > @@ -894,6 +894,27 @@ namespace gbe { > err += *errSize; > } Both clBuildProgram() and clCompileProgram() will call into buildModuleFromSource() So, what about putting the dumpLLVM logic into buildModuleFromSource()? so that you don't need to copy the code. And Yejun has a fix for llvm 3.3, please also base on his change. Thanks! Ruiling > + // Dump the LLVM if requested. > + #if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR < 6) > + if (!dumpLLVMFileName.empty()) { > + std::string err; > + llvm::raw_fd_ostream ostream (dumpLLVMFileName.c_str(), > + err, llvm::sys::fs::F_RW); > + if (err.empty()) { > + out_module->print(ostream, 0); > + } //Otherwise, you'll have to make do without the dump. > + } > + #else > + if (!dumpLLVMFileName.empty()) { > + std::error_code err; > + llvm::raw_fd_ostream ostream (dumpLLVMFileName.c_str(), > + err, llvm::sys::fs::F_RW); > + if (!err) { > + out_module->print(ostream, 0); > + } //Otherwise, you'll have to make do without the dump. > + } > + #endif > + > p = gbe_program_new_gen_program(deviceID, out_module, NULL); > > if (OCL_OUTPUT_BUILD_LOG && options) > -- > 1.9.1 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
