From d623a6de1963750dfe2d745581b38631d0b4c9d1 Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Mon, 30 Aug 2021 18:28:33 -0400 Subject: [PATCH] SWDEV-294768 - Fix PCMark10 performance drop PCMark10 counts the time spent in clCreateKernel as part of execution time, so as workaround for the PAL path, move code object loading back to clBuildProgram. Change-Id: I3b9cf1879ece08ab59f447ec165b0525bc8593a4 [ROCm/clr commit: 1d0364e59034dac713d426a5f146f8763f682c3a] --- projects/clr/rocclr/device/comgrctx.cpp | 1 + projects/clr/rocclr/device/pal/palprogram.cpp | 28 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) 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);