From bfde2ce8f82ed69829b597ab39b22fefb8aa835d Mon Sep 17 00:00:00 2001 From: Payam Date: Thu, 14 May 2020 00:18:32 -0400 Subject: [PATCH] load functions when registered if lazy load is disabled Change-Id: I6f10a72f7643e476407af03b04ef52e59741be45 [ROCm/clr commit: 0a9d550d9bfb5726bb2653b5a683930df576ceaf] --- projects/clr/hipamd/rocclr/hip_platform.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/projects/clr/hipamd/rocclr/hip_platform.cpp b/projects/clr/hipamd/rocclr/hip_platform.cpp index b67c6ac90a..debe33b6f3 100755 --- a/projects/clr/hipamd/rocclr/hip_platform.cpp +++ b/projects/clr/hipamd/rocclr/hip_platform.cpp @@ -191,13 +191,6 @@ void PlatformState::init() for (auto& it : vars_) { it.second.rvars.resize(g_devices.size()); } - if (!HIP_ENABLE_LAZY_KERNEL_LOADING) { - for (size_t i = 0; i < g_devices.size(); ++i) { - for (auto& it: functions_) { - getFunc(it.first, i); - } - } - } } bool PlatformState::unregisterFunc(hipModule_t hmod) { @@ -613,9 +606,12 @@ extern "C" void __hipRegisterFunction( { PlatformState::DeviceFunction func{ std::string{deviceName}, modules, std::vector{g_devices.size()}}; PlatformState::instance().registerFunction(hostFunction, func); -// for (size_t i = 0; i < g_devices.size(); ++i) { -// PlatformState::instance().getFunc(hostFunction, i); -// } + if (!HIP_ENABLE_LAZY_KERNEL_LOADING) { + HIP_INIT(); + for (size_t i = 0; i < g_devices.size(); ++i) { + PlatformState::instance().getFunc(hostFunction, i); + } + } } // Registers a device-side global variable.