diff --git a/projects/clr/rocclr/device/comgrctx.cpp b/projects/clr/rocclr/device/comgrctx.cpp index 5a2406738d..1ade6f88ad 100644 --- a/projects/clr/rocclr/device/comgrctx.cpp +++ b/projects/clr/rocclr/device/comgrctx.cpp @@ -36,6 +36,7 @@ bool Comgr::LoadLib() { WINDOWS_SWITCH("amd_comgr.dll", "libamd_comgr.so.2")); cep_.handle = Os::loadLibrary(ComgrLibName); if (nullptr == cep_.handle) { + ClPrint(amd::LOG_ERROR, amd::LOG_CODE, "Failed to load COMGR library."); return false; } #endif diff --git a/projects/clr/rocclr/device/pal/palprogram.cpp b/projects/clr/rocclr/device/pal/palprogram.cpp index f6e319b9b0..6fb737d9d7 100644 --- a/projects/clr/rocclr/device/pal/palprogram.cpp +++ b/projects/clr/rocclr/device/pal/palprogram.cpp @@ -744,6 +744,12 @@ bool LightningProgram::createBinary(amd::option::Options* options) { bool LightningProgram::createKernels(void* binary, size_t binSize, bool useUniformWorkGroupSize, bool internalKernel) { #if defined(USE_COMGR_LIBRARY) + // Stop compilation if it is an offline device - PAL runtime does not + // support ISA compiled offline + if (!device().isOnline()) { + return true; + } + // Find the size of global variables from the binary if (!FindGlobalVarSize(binary, binSize)) { buildLog_ += "Error: Cannot Find Global Var Sizes\n"; @@ -764,18 +770,6 @@ bool LightningProgram::createKernels(void* binary, size_t binSize, bool useUnifo kernel->setUniformWorkGroupSize(useUniformWorkGroupSize); } -#endif - return true; -} - -bool LightningProgram::setKernels(void* binary, size_t binSize, - amd::Os::FileDesc fdesc, size_t foffset, std::string uri) { -#if defined(USE_COMGR_LIBRARY) - // Stop compilation if it is an offline device - PAL runtime does not - // support ISA compiled offline - if (!device().isOnline()) { - return true; - } executable_ = loader_->CreateExecutable(HSA_PROFILE_FULL, nullptr); if (executable_ == nullptr) { @@ -799,6 +793,16 @@ bool LightningProgram::setKernels(void* binary, size_t binSize, LogError("Error: Freezing the executable failed."); return false; } +#endif + return true; +} + +bool LightningProgram::setKernels(void* binary, size_t binSize, + amd::Os::FileDesc fdesc, size_t foffset, std::string uri) { +#if defined(USE_COMGR_LIBRARY) + if (!device().isOnline()) { + return true; + } for (auto& kit : kernels()) { LightningKernel* kernel = static_cast(kit.second);