From 9261a35be9aaec65e302dfbf855a59303d8f5464 Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Mon, 1 Jun 2020 18:42:20 -0400 Subject: [PATCH] SWDEV-234295 - Pass flag to ROCclr to not clear device programs during program::build() Change-Id: I50b9fa1a96da6895f73fdf4a7c0d3f096b1188da --- hipamd/rocclr/hip_internal.hpp | 4 ++++ hipamd/rocclr/hip_module.cpp | 3 ++- hipamd/rocclr/hip_platform.cpp | 8 +++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hipamd/rocclr/hip_internal.hpp b/hipamd/rocclr/hip_internal.hpp index 6ab19a396e..a07eebed7e 100755 --- a/hipamd/rocclr/hip_internal.hpp +++ b/hipamd/rocclr/hip_internal.hpp @@ -336,6 +336,9 @@ public: void popExec(ihipExec_t& exec); }; +constexpr bool kOptionChangeable = true; +constexpr bool kNewDevProg = false; + /// Wait all active streams on the blocking queue. The method enqueues a wait command and /// doesn't stall the current thread extern void iHipWaitActiveStreams(amd::HostQueue* blocking_queue, bool wait_null_stream = false); @@ -348,4 +351,5 @@ extern amd::Memory* getMemoryObject(const void* ptr, size_t& offset); extern bool CL_CALLBACK getSvarInfo(cl_program program, std::string var_name, void** var_addr, size_t* var_size); + #endif // HIP_SRC_HIP_INTERNAL_H diff --git a/hipamd/rocclr/hip_module.cpp b/hipamd/rocclr/hip_module.cpp index a29ad9a962..f618254599 100755 --- a/hipamd/rocclr/hip_module.cpp +++ b/hipamd/rocclr/hip_module.cpp @@ -261,7 +261,8 @@ hipError_t ihipModuleLoadData(hipModule_t* module, const void* mmap_ptr, size_t return hipErrorSharedObjectSymbolNotFound; } - if(CL_SUCCESS != program->build(hip::getCurrentDevice()->devices(), nullptr, nullptr, nullptr)) { + if (CL_SUCCESS != program->build(hip::getCurrentDevice()->devices(), nullptr, nullptr, nullptr, + kOptionChangeable, kNewDevProg)) { return hipErrorSharedObjectInitFailed; } diff --git a/hipamd/rocclr/hip_platform.cpp b/hipamd/rocclr/hip_platform.cpp index 55bc3e8e7b..1074bece4f 100755 --- a/hipamd/rocclr/hip_platform.cpp +++ b/hipamd/rocclr/hip_platform.cpp @@ -133,7 +133,7 @@ hipError_t __hipExtractCodeObjectFromFatBinary(const void* data, if (num_code_objs == devices.size()) { return hipSuccess; } else { - fatal("hipErrorNoBinaryForGpu: Coudn't find binary for current devices!"); + ("hipErrorNoBinaryForGpu: Coudn't find binary for current devices!"); return hipErrorNoBinaryForGpu; } } @@ -440,7 +440,8 @@ hipFunction_t PlatformState::getFunc(const void* hostFunction, int deviceId) { if (!(*devFunc.modules)[deviceId].second) { amd::Program* program = as_amd(reinterpret_cast(module)); program->setVarInfoCallBack(&getSvarInfo); - if (CL_SUCCESS != program->build(g_devices[deviceId]->devices(), nullptr, nullptr, nullptr)) { + if (CL_SUCCESS != program->build(g_devices[deviceId]->devices(), nullptr, nullptr, nullptr, + kOptionChangeable, kNewDevProg)) { DevLogPrintfError("Build error for module: 0x%x at device: %u \n", module, deviceId); return nullptr; } @@ -541,7 +542,8 @@ bool PlatformState::getGlobalVar(const char* hostVar, int deviceId, hipModule_t if (!(*dvar->modules)[deviceId].second) { amd::Program* program = as_amd(reinterpret_cast((*dvar->modules)[deviceId].first)); program->setVarInfoCallBack(&getSvarInfo); - if (CL_SUCCESS != program->build(g_devices[deviceId]->devices(), nullptr, nullptr, nullptr)) { + if (CL_SUCCESS != program->build(g_devices[deviceId]->devices(), nullptr, nullptr, nullptr, + kOptionChangeable, kNewDevProg)) { DevLogPrintfError("Build Failure for module: 0x%x \n", hmod); return false; }