P4 to Git Change 1307198 by lmoriche@lmoriche_opencl_dev on 2016/08/25 12:39:46
SWDEV-1306648 - Add OptimizeLLVMBitcode to the ROCm-OpenCL-Driver. Call the optimizer in roc::HSAILProgram::linkImpl, between linking with the bitcode built-in libraries and code generation. Use the default optimization level, with at a minimum -strip -instcombine -always-inline. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#13 edit
Этот коммит содержится в:
@@ -833,8 +833,32 @@ namespace roc {
|
||||
return false;
|
||||
}
|
||||
|
||||
// open the optimized output
|
||||
Data* opt_bc = C->NewBuffer(DT_LLVM_BC);
|
||||
|
||||
if (!opt_bc) {
|
||||
buildLog_ += "Error: Failed to open the optimized program.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ostringstream optLevel;
|
||||
optLevel << "-O" << options->oVariables->OptLevel;
|
||||
|
||||
std::vector<std::string> optOptions;
|
||||
optOptions.push_back(optLevel.str());
|
||||
optOptions.push_back("-strip");
|
||||
optOptions.push_back("-instcombine");
|
||||
optOptions.push_back("-always-inline");
|
||||
|
||||
ret = C->OptimizeLLVMBitcode(linked_bc, opt_bc, optOptions);
|
||||
buildLog_ += C->Output();
|
||||
if (!ret) {
|
||||
buildLog_ += "Error: Optimizing bitcode failed: linking source & IR libraries.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
inputs.clear();
|
||||
inputs.push_back(linked_bc);
|
||||
inputs.push_back(opt_bc);
|
||||
|
||||
Buffer* out_exec = C->NewBuffer(DT_EXECUTABLE);
|
||||
if (!out_exec) {
|
||||
@@ -848,9 +872,8 @@ namespace roc {
|
||||
optionsstr.append(" -mcpu=");
|
||||
optionsstr.append(dev().deviceInfo().machineTarget_);
|
||||
|
||||
std::ostringstream optLevel;
|
||||
optLevel << " -O" << options->oVariables->OptLevel;
|
||||
optionsstr.append(optLevel.str());
|
||||
// Set the -O#
|
||||
optionsstr.append(" ").append(optLevel.str());
|
||||
|
||||
// Tokenize the options string into a vector of strings
|
||||
std::istringstream strstr(optionsstr);
|
||||
|
||||
Ссылка в новой задаче
Block a user