From 02d5a7c4b9fd75f3b6eb6b02005fd02206a28abd 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/hip commit: 22edde84d541c38c10024d6c21cd78ac68f6e9c1] --- projects/hip/rocclr/hip_platform.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/hip/rocclr/hip_platform.cpp b/projects/hip/rocclr/hip_platform.cpp index debe33b6f3..0be928f9a4 100755 --- a/projects/hip/rocclr/hip_platform.cpp +++ b/projects/hip/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);