Merge pull request #636 from ROCm-Developer-Tools/db-fatbin

Add HIP_DB=fatbin for debugging fat binary issues

[ROCm/clr commit: a190b1ba01]
This commit is contained in:
Maneesh Gupta
2018-09-14 13:21:58 +05:30
zatwierdzone przez GitHub
3 zmienionych plików z 6 dodań i 2 usunięć
@@ -58,6 +58,7 @@ __hipRegisterFatBinary(const void* data)
{ {
HIP_INIT(); HIP_INIT();
tprintf(DB_FB, "Enter __hipRegisterFatBinary(%p)\n", data);
const __CudaFatBinaryWrapper* fbwrapper = reinterpret_cast<const __CudaFatBinaryWrapper*>(data); const __CudaFatBinaryWrapper* fbwrapper = reinterpret_cast<const __CudaFatBinaryWrapper*>(data);
if (fbwrapper->magic != __hipFatMAGIC2 || fbwrapper->version != 1) { if (fbwrapper->magic != __hipFatMAGIC2 || fbwrapper->version != 1) {
return nullptr; return nullptr;
@@ -113,6 +114,7 @@ __hipRegisterFatBinary(const void* data)
} }
} }
tprintf(DB_FB, "__hipRegisterFatBinary succeeds and returns %p\n", modules);
return modules; return modules;
} }
+1 -1
Wyświetl plik
@@ -1228,7 +1228,7 @@ void HipReadEnv() {
READ_ENV_C(release, HIP_DB, 0, READ_ENV_C(release, HIP_DB, 0,
"Print debug info. Bitmask (HIP_DB=0xff) or flags separated by '+' " "Print debug info. Bitmask (HIP_DB=0xff) or flags separated by '+' "
"(HIP_DB=api+sync+mem+copy)", "(HIP_DB=api+sync+mem+copy+fatbin)",
HIP_DB_callback); HIP_DB_callback);
if ((HIP_DB & (1 << DB_API)) && (HIP_TRACE_API == 0)) { if ((HIP_DB & (1 << DB_API)) && (HIP_TRACE_API == 0)) {
// Set HIP_TRACE_API default before we read it, so it is printed correctly. // Set HIP_TRACE_API default before we read it, so it is printed correctly.
@@ -223,7 +223,8 @@ extern const char* API_COLOR_END;
#define DB_MEM 2 /* 0x04 - trace memory allocation / deallocation */ #define DB_MEM 2 /* 0x04 - trace memory allocation / deallocation */
#define DB_COPY 3 /* 0x08 - trace memory copy and peer commands. . */ #define DB_COPY 3 /* 0x08 - trace memory copy and peer commands. . */
#define DB_WARN 4 /* 0x10 - warn about sub-optimal or shady behavior */ #define DB_WARN 4 /* 0x10 - warn about sub-optimal or shady behavior */
#define DB_MAX_FLAG 5 #define DB_FB 5 /* 0x20 - trace loading fat binary */
#define DB_MAX_FLAG 6
// When adding a new debug flag, also add to the char name table below. // When adding a new debug flag, also add to the char name table below.
// //
// //
@@ -237,6 +238,7 @@ struct DbName {
static const DbName dbName[] = { static const DbName dbName[] = {
{KGRN, "api"}, // not used, {KGRN, "api"}, // not used,
{KYEL, "sync"}, {KCYN, "mem"}, {KMAG, "copy"}, {KRED, "warn"}, {KYEL, "sync"}, {KCYN, "mem"}, {KMAG, "copy"}, {KRED, "warn"},
{KBLU, "fatbin"},
}; };