Fix Agent_global variables failing hipTestDeviceSymbol
Issue: Header uses std::vector<Agent_global> agent_globals which is created by hip_module.cpp - Move iterator fails to copy Agent_global from library source into header version - Due to different versions of std::string name in struct Agent_global Fix: Change Agent_global to use char* name instead of std::string name
This commit is contained in:
@@ -2506,7 +2506,7 @@ hipError_t hipModuleGetFunction(hipFunction_t* function, hipModule_t module, con
|
||||
hipError_t hipFuncGetAttributes(hipFuncAttributes* attr, const void* func);
|
||||
|
||||
struct Agent_global {
|
||||
std::string name;
|
||||
char* name;
|
||||
hipDeviceptr_t address;
|
||||
uint32_t byte_cnt;
|
||||
};
|
||||
@@ -2524,7 +2524,7 @@ template<typename ForwardIterator>
|
||||
std::pair<hipDeviceptr_t, std::size_t> read_global_description(
|
||||
ForwardIterator f, ForwardIterator l, const char* name) {
|
||||
const auto it = std::find_if(f, l, [=](const Agent_global& x) {
|
||||
return x.name == name;
|
||||
return strcmp(x.name, name) == 0;
|
||||
});
|
||||
|
||||
return it == l ?
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace hip_impl {
|
||||
|
||||
namespace {
|
||||
inline void track(const Agent_global& x, hsa_agent_t agent) {
|
||||
tprintf(DB_MEM, " add variable '%s' with ptr=%p size=%u to tracker\n", x.name.c_str(),
|
||||
tprintf(DB_MEM, " add variable '%s' with ptr=%p size=%u to tracker\n", x.name,
|
||||
x.address, x.byte_cnt);
|
||||
|
||||
int deviceIndex =0;
|
||||
@@ -341,7 +341,10 @@ inline hsa_status_t copy_agent_global_variables(hsa_executable_t, hsa_agent_t ag
|
||||
hsa_executable_symbol_get_info(x, HSA_EXECUTABLE_SYMBOL_INFO_TYPE, &t);
|
||||
|
||||
if (t == HSA_SYMBOL_KIND_VARIABLE) {
|
||||
static_cast<Container*>(out)->push_back(Agent_global{name(x), address(x), size(x)});
|
||||
Agent_global tmp = {nullptr, address(x), size(x)};
|
||||
tmp.name = (char *) malloc(sizeof(name(x).c_str()));
|
||||
strcpy(tmp.name, name(x).c_str());
|
||||
static_cast<Container*>(out)->push_back(tmp);
|
||||
|
||||
track(static_cast<Container*>(out)->back(),agent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user