load functions when registered if lazy load is disabled

Change-Id: I08c9684ca4ab86a6294ed9e670f3125c1a0cc6c4


[ROCm/clr commit: 161c14c1de]
This commit is contained in:
Laurent Morichetti
2020-05-15 16:47:26 -07:00
committed by Aaron En Ye Shi
parent 68b845519d
commit 39491f0ddc
+8 -1
View File
@@ -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<std::pair<hipModule_t,bool> >* modules,
const void* hostFunction,
@@ -606,7 +613,7 @@ extern "C" void __hipRegisterFunction(
{
PlatformState::DeviceFunction func{ std::string{deviceName}, modules, std::vector<hipFunction_t>{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);