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.