Fixed host allocated globals address lookup for host usage
Fixed texture driver APIs failure
[ROCm/hip commit: 24ab820a11]
This commit is contained in:
@@ -69,15 +69,13 @@ namespace hip_impl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using RAII_global = std::unique_ptr<void, decltype(hsa_amd_memory_unlock)*>;
|
|
||||||
|
|
||||||
const std::unordered_map<
|
const std::unordered_map<
|
||||||
hsa_agent_t, std::vector<hsa_executable_t>>& executables();
|
hsa_agent_t, std::vector<hsa_executable_t>>& executables();
|
||||||
const std::unordered_map<
|
const std::unordered_map<
|
||||||
std::uintptr_t,
|
std::uintptr_t,
|
||||||
std::vector<std::pair<hsa_agent_t, Kernel_descriptor>>>& functions();
|
std::vector<std::pair<hsa_agent_t, Kernel_descriptor>>>& functions();
|
||||||
const std::unordered_map<std::uintptr_t, std::string>& function_names();
|
const std::unordered_map<std::uintptr_t, std::string>& function_names();
|
||||||
std::unordered_map<std::string, RAII_global>& globals();
|
std::unordered_map<std::string, void*>& globals();
|
||||||
|
|
||||||
hsa_executable_t load_executable(
|
hsa_executable_t load_executable(
|
||||||
const std::string& file,
|
const std::string& file,
|
||||||
|
|||||||
@@ -453,6 +453,7 @@ hipError_t hipArrayCreate ( hipArray** array, const HIP_ARRAY_DESCRIPTOR* pAlloc
|
|||||||
array[0]->width = pAllocateArray->width;
|
array[0]->width = pAllocateArray->width;
|
||||||
array[0]->height = pAllocateArray->height;
|
array[0]->height = pAllocateArray->height;
|
||||||
array[0]->isDrv = true;
|
array[0]->isDrv = true;
|
||||||
|
array[0]->textureType = hipTextureType2D;
|
||||||
void ** ptr = &array[0]->data;
|
void ** ptr = &array[0]->data;
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
const unsigned am_flags = 0;
|
const unsigned am_flags = 0;
|
||||||
|
|||||||
@@ -568,7 +568,6 @@ hipError_t hipModuleGetTexRef(
|
|||||||
const auto it = globals().find(name);
|
const auto it = globals().find(name);
|
||||||
if (it == globals().end()) return ihipLogStatus(hipErrorInvalidValue);
|
if (it == globals().end()) return ihipLogStatus(hipErrorInvalidValue);
|
||||||
|
|
||||||
*texRef = static_cast<textureReference*>(it->second.get());
|
*texRef = reinterpret_cast<textureReference*>(it->second);
|
||||||
|
|
||||||
return ihipLogStatus(hipSuccess);
|
return ihipLogStatus(hipSuccess);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ namespace
|
|||||||
lock_guard<mutex> lck{mtx};
|
lock_guard<mutex> lck{mtx};
|
||||||
|
|
||||||
if (globals().find(x) != globals().cend()) return;
|
if (globals().find(x) != globals().cend()) return;
|
||||||
|
globals().emplace(x, (void*)(it1->second.first));
|
||||||
void* p = nullptr;
|
void* p = nullptr;
|
||||||
hsa_amd_memory_lock(
|
hsa_amd_memory_lock(
|
||||||
reinterpret_cast<void*>(it1->second.first),
|
reinterpret_cast<void*>(it1->second.first),
|
||||||
@@ -181,7 +181,6 @@ namespace
|
|||||||
hsa_executable_agent_global_variable_define(
|
hsa_executable_agent_global_variable_define(
|
||||||
executable, agent, x.c_str(), p);
|
executable, agent, x.c_str(), p);
|
||||||
|
|
||||||
globals().emplace(x, RAII_global{p, hsa_amd_memory_unlock});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,9 +461,9 @@ namespace hip_impl
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
unordered_map<string, RAII_global>& globals()
|
unordered_map<string, void*>& globals()
|
||||||
{
|
{
|
||||||
static unordered_map<string, RAII_global> r;
|
static unordered_map<string, void*> r;
|
||||||
static once_flag f;
|
static once_flag f;
|
||||||
call_once(f, []() { r.reserve(symbol_addresses().size()); });
|
call_once(f, []() { r.reserve(symbol_addresses().size()); });
|
||||||
|
|
||||||
|
|||||||
مرجع در شماره جدید
Block a user