Implement HIP_ENABLE_DEFERRED_LOADING in right way

Change-Id: Ia28dbdea5cde93b3ca69f44c6a3c18ec8a730d42


[ROCm/hip commit: 66fca8be23]
Este commit está contenido en:
Tao Sang
2020-07-11 18:14:03 -04:00
padre 314b48f10a
commit 05300c8fe3
+7 -5
Ver fichero
@@ -29,7 +29,6 @@
#include "elfio.hpp"
constexpr unsigned __hipFatMAGIC2 = 0x48495046; // "HIPF"
int HIP_ENABLE_DEFERRED_LOADING = 1; // Will check later
thread_local std::stack<ihipExec_t> execStack_;
PlatformState* PlatformState::platform_; // Initiaized as nullptr by default
@@ -114,9 +113,15 @@ extern "C" void __hipRegisterFunction(
dim3* blockDim,
dim3* gridDim,
int* wSize) {
static int enable_deferred_loading { []() {
char *var = getenv("HIP_ENABLE_DEFERRED_LOADING");
return var ? atoi(var) : 1;
}() };
hip::Function* func = new hip::Function(std::string(deviceName), modules);
PlatformState::instance().registerStatFunction(hostFunction, func);
if (!HIP_ENABLE_DEFERRED_LOADING) {
if (!enable_deferred_loading) {
HIP_INIT();
hipFunction_t hfunc = nullptr;
hipError_t hip_error = hipSuccess;
@@ -876,9 +881,6 @@ void PlatformState::init()
}
initialized_ = true;
char *var = getenv("HIP_ENABLE_DEFERRED_LOADING");
HIP_ENABLE_DEFERRED_LOADING = var ? atoi(var) : 1;
for (auto& it : statCO_.modules_) {
digestFatBinary(it.first, it.second);
}