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
Этот коммит содержится в:
Aaron Enye Shi
2019-03-06 18:33:43 +00:00
родитель 23e9968752
Коммит 00d24d254d
2 изменённых файлов: 7 добавлений и 4 удалений
+5 -2
Просмотреть файл
@@ -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);
}