fix bug where HIP_DB=1 seg faults at startup (#1388)

[ROCm/clr commit: 3d7c146296]
This commit is contained in:
Jeff Daily
2019-09-05 03:04:19 -07:00
committed by Maneesh Gupta
parent b55c3dba08
commit 42c49b6ba9
+11 -2
View File
@@ -220,8 +220,17 @@ TidInfo::TidInfo() : _apiSeqNum(0) {
tid_ss_num << std::this_thread::get_id();
tid_ss << std::hex << std::stoull(tid_ss_num.str());
tprintf(DB_API, "HIP initialized short_tid#%d (maps to full_tid: 0x%s)\n", _shortTid,
tid_ss.str().c_str());
// cannot use tprintf here since it will recurse back into TlsData constructor
#if COMPILE_HIP_DB
if (HIP_DB & (1 << DB_API)) {
char msgStr[1000];
snprintf(msgStr, sizeof(msgStr),
"HIP initialized short_tid#%d (maps to full_tid: 0x%s)\n",
tid(), tid_ss.str().c_str());
fprintf(stderr, " %ship-%s pid:%d tid:%d:%s%s", dbName[DB_API]._color,
dbName[DB_API]._shortName, pid(), tid(), msgStr, KNRM);
}
#endif
};
}