From 39491f0ddc97c25222ab0cd80c1dae4ce735a510 Mon Sep 17 00:00:00 2001 From: Laurent Morichetti Date: Fri, 15 May 2020 16:47:26 -0700 Subject: [PATCH] load functions when registered if lazy load is disabled Change-Id: I08c9684ca4ab86a6294ed9e670f3125c1a0cc6c4 [ROCm/clr commit: 161c14c1de5a4e754a113f9b054c8b01d4ecc833] --- projects/clr/hipamd/rocclr/hip_platform.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/rocclr/hip_platform.cpp b/projects/clr/hipamd/rocclr/hip_platform.cpp index debe33b6f3..0be928f9a4 100755 --- a/projects/clr/hipamd/rocclr/hip_platform.cpp +++ b/projects/clr/hipamd/rocclr/hip_platform.cpp @@ -592,6 +592,13 @@ void PlatformState::popExec(ihipExec_t& exec) { execStack_.pop(); } +namespace { +const int HIP_ENABLE_DEFERRED_LOADING{[] () { + char *var = getenv("HIP_ENABLE_DEFERRED_LOADING"); + return var ? atoi(var) : 1; +}()}; +} /* namespace */ + extern "C" void __hipRegisterFunction( std::vector >* modules, const void* hostFunction, @@ -606,7 +613,7 @@ extern "C" void __hipRegisterFunction( { PlatformState::DeviceFunction func{ std::string{deviceName}, modules, std::vector{g_devices.size()}}; PlatformState::instance().registerFunction(hostFunction, func); - if (!HIP_ENABLE_LAZY_KERNEL_LOADING) { + if (!HIP_ENABLE_DEFERRED_LOADING) { HIP_INIT(); for (size_t i = 0; i < g_devices.size(); ++i) { PlatformState::instance().getFunc(hostFunction, i);