P4 to Git Change 1753035 by wchau@wchau_OCL_Linux on 2019/03/07 15:02:39

SWDEV-182054 - Allow building OpenCL-Runtime with COMGR enabled without OpenCL-Driver being present

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/build/Makefile.hip#12 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#184 edit
... //depot/stg/opencl/drivers/opencl/compiler/Makefile#71 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#242 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#335 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#30 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.hpp#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#126 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#87 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#120 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#51 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#100 edit
This commit is contained in:
foreman
2019-03-07 15:48:33 -05:00
parent 2df067619f
commit e51a27e182
9 changed files with 32 additions and 23 deletions
+4 -5
View File
@@ -148,7 +148,7 @@ bool Device::init() {
// GPU stack. The order of initialization is signiicant and if changed
// amd::Device::registerDevice() must be accordingly modified.
#if defined(WITH_HSA_DEVICE)
// @todo remove IS_LIGHTNING check when PAL-LC builds will be deprecated
// @todo remove IS_LIGHTNING check when PAL-LC builds will be deprecated
if ((GPU_ENABLE_PAL != 1) || IS_LIGHTNING) {
// Return value of roc::Device::init()
// If returned false, error initializing HSA stack.
@@ -229,6 +229,7 @@ bool Device::ValidateComgr() {
#if defined(USE_COMGR_LIBRARY)
// Check if Lightning compiler was requested
if (settings_->useLightning_) {
LogInfo("Loading COMGR library.");
std::call_once(amd::Comgr::initialized, amd::Comgr::LoadLib);
// Use Lightning only if it's available
settings_->useLightning_ = amd::Comgr::IsReady();
@@ -413,7 +414,7 @@ char* Device::getExtensionString() {
return result;
}
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
#if defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY)
CacheCompilation::CacheCompilation(std::string targetStr, std::string postfix, bool enableCache,
bool resetCache)
: codeCache_(targetStr, 0, AMD_PLATFORM_BUILD_NUMBER, postfix),
@@ -498,13 +499,11 @@ bool CacheCompilation::compileToLLVMBitcode(amd::opencl_driver::Compiler* C,
StringCache::CachedData cachedData = {bc->Ptr(), bc->Size()};
bcSet.push_back(cachedData);
} else if (input->Type() == DT_CL_HEADER) {
#if !defined(USE_COMGR_LIBRARY)
FileReference* bcFile = reinterpret_cast<FileReference*>(input);
std::string bc;
bcFile->ReadToString(bc);
StringCache::CachedData cachedData = {bc.c_str(), bc.size()};
bcSet.push_back(cachedData);
#endif // !defined(USE_COMGR_LIBRARY)
} else {
buildLog += "Error: unsupported bitcode type for checking cache.\n";
checkCache = false;
@@ -582,7 +581,7 @@ bool CacheCompilation::compileAndLinkExecutable(amd::opencl_driver::Compiler* C,
return true;
}
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
#endif // defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY)
} // namespace amd