load functions when registered if lazy load is disabled

Change-Id: I08c9684ca4ab86a6294ed9e670f3125c1a0cc6c4
Этот коммит содержится в:
Laurent Morichetti
2020-05-15 16:47:26 -07:00
коммит произвёл Aaron En Ye Shi
родитель 06a0de3567
Коммит 161c14c1de
+8 -1
Просмотреть файл
@@ -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);