diff --git a/include/hip/hcc_detail/hip_runtime_api.h b/include/hip/hcc_detail/hip_runtime_api.h index 7b7ffb0638..72cfbf7d3b 100644 --- a/include/hip/hcc_detail/hip_runtime_api.h +++ b/include/hip/hcc_detail/hip_runtime_api.h @@ -2518,7 +2518,7 @@ struct Agent_global { namespace hip_impl { hsa_executable_t executable_for(hipModule_t); -const std::string& hash_for(hipModule_t); +const char* hash_for(hipModule_t); template std::pair read_global_description( @@ -2543,7 +2543,8 @@ hipError_t read_agent_global_from_module(hipDeviceptr_t* dptr, size_t* bytes, // hipModule_t instance static std::unordered_map< std::string, std::vector> agent_globals; - auto key = hash_for(hmod); + const char* hash = hash_for(hmod); + std::string key(hash); if (agent_globals.count(key) == 0) { static std::mutex mtx; diff --git a/src/hip_module.cpp b/src/hip_module.cpp index 52d1fb38bd..178b0c9471 100644 --- a/src/hip_module.cpp +++ b/src/hip_module.cpp @@ -287,8 +287,8 @@ namespace hip_impl { return hmod->executable; } - const std::string& hash_for(hipModule_t hmod) { - return hmod->hash; + const char* hash_for(hipModule_t hmod) { + return hmod->hash.c_str(); } hsa_agent_t this_agent() {