P4 to Git Change 1313945 by wchau@wchau_OCL_boltzmann on 2016/09/13 15:57:45

SWDEV-94605 - [OCL-LC-ROCm] ability to load offline (and online) generated binaries using the HSA code object format

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#203 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#17 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#35 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#14 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#83 edit


[ROCm/clr commit: 0495f895a2]
This commit is contained in:
foreman
2016-09-13 16:16:35 -04:00
parent 89175ce61b
commit 75f80ffbfb
5 changed files with 128 additions and 55 deletions
@@ -78,11 +78,8 @@ Program::addDeviceProgram(Device& device, const void* image, size_t length,
options = &emptyOpts;
emptyOptions = true;
}
#if defined(WITH_LIGHTNING_COMPILER)
if (image != NULL && length != 0 && amd::isElfMagic((const char *) image)) {
// TODO: Wilkin: extract compiler options from the .comment section
}
#else // !defined(WITH_LIGHTNING_COMPILER)
#if !defined(WITH_LIGHTNING_COMPILER)
if (image != NULL && length != 0 && aclValidateBinaryImage(image, length, BINARY_TYPE_ELF)) {
acl_error errorCode;
aclBinary *binary = aclReadFromMem(image, length, &errorCode);
@@ -133,6 +130,18 @@ Program::addDeviceProgram(Device& device, const void* image, size_t length,
delete program;
return CL_INVALID_BINARY;
}
#if defined(WITH_LIGHTNING_COMPILER)
// load the compiler options from the binary if it is not provided
std::string sBinOptions = program->compileOptions();
if (!sBinOptions.empty() && emptyOptions) {
if (!amd::option::parseAllOptions(sBinOptions, *options)) {
programLog_ = options->optionsLog();
LogError("Parsing compilation options from binary failed.");
return CL_INVALID_COMPILER_OPTIONS;
}
}
#endif
}
devicePrograms_[&rootDev] = program;