GitOrigin-RevId: 628afbf3cf
dev-support-lite-fork-debug-mode
@@ -111,7 +111,7 @@ static void* resolve_library_func(void* handle, const char* func) { | |||||
} | } | ||||
auto ret = dlsym(handle, func); | auto ret = dlsym(handle, func); | ||||
if (!ret) { | if (!ret) { | ||||
LOGD("failed to load %s func: %s", g_default_api_name, func); | |||||
LOGD("failed to load %s func: %s.(It seems that the currently used version of the library containing the function is too old.)", g_default_api_name, func); | |||||
} | } | ||||
return ret; | return ret; | ||||
} | } |
@@ -3829,6 +3829,7 @@ static void load_library() { | |||||
return; | return; | ||||
void* handle = get_library_handle(); | void* handle = get_library_handle(); | ||||
int num = 0; | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | for (size_t i = 0; i < NR_FUNC; ++i) { | ||||
void* func; | void* func; | ||||
if (!handle) { | if (!handle) { | ||||
@@ -3837,10 +3838,17 @@ static void load_library() { | |||||
func = resolve_library_func(handle, g_func_name[i]); | func = resolve_library_func(handle, g_func_name[i]); | ||||
} | } | ||||
if (!func) { | if (!func) { | ||||
func = g_func_table_error[i]; | |||||
break; | |||||
} | } | ||||
num++; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | __atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | ||||
} | } | ||||
if (num != NR_FUNC) { | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | |||||
void* func = g_func_table_error[i]; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | |||||
} | |||||
} | |||||
done = true; | done = true; | ||||
} | } | ||||
@@ -3999,6 +3999,7 @@ static void load_library() { | |||||
return; | return; | ||||
void* handle = get_library_handle(); | void* handle = get_library_handle(); | ||||
int num = 0; | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | for (size_t i = 0; i < NR_FUNC; ++i) { | ||||
void* func; | void* func; | ||||
if (!handle) { | if (!handle) { | ||||
@@ -4007,10 +4008,17 @@ static void load_library() { | |||||
func = resolve_library_func(handle, g_func_name[i]); | func = resolve_library_func(handle, g_func_name[i]); | ||||
} | } | ||||
if (!func) { | if (!func) { | ||||
func = g_func_table_error[i]; | |||||
break; | |||||
} | } | ||||
num++; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | __atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | ||||
} | } | ||||
if (num != NR_FUNC) { | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | |||||
void* func = g_func_table_error[i]; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | |||||
} | |||||
} | |||||
done = true; | done = true; | ||||
} | } | ||||
@@ -4369,6 +4369,7 @@ static void load_library() { | |||||
return; | return; | ||||
void* handle = get_library_handle(); | void* handle = get_library_handle(); | ||||
int num = 0; | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | for (size_t i = 0; i < NR_FUNC; ++i) { | ||||
void* func; | void* func; | ||||
if (!handle) { | if (!handle) { | ||||
@@ -4377,10 +4378,17 @@ static void load_library() { | |||||
func = resolve_library_func(handle, g_func_name[i]); | func = resolve_library_func(handle, g_func_name[i]); | ||||
} | } | ||||
if (!func) { | if (!func) { | ||||
func = g_func_table_error[i]; | |||||
break; | |||||
} | } | ||||
num++; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | __atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | ||||
} | } | ||||
if (num != NR_FUNC) { | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | |||||
void* func = g_func_table_error[i]; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | |||||
} | |||||
} | |||||
done = true; | done = true; | ||||
} | } | ||||
@@ -4659,6 +4659,7 @@ static void load_library() { | |||||
return; | return; | ||||
void* handle = get_library_handle(); | void* handle = get_library_handle(); | ||||
int num = 0; | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | for (size_t i = 0; i < NR_FUNC; ++i) { | ||||
void* func; | void* func; | ||||
if (!handle) { | if (!handle) { | ||||
@@ -4667,10 +4668,17 @@ static void load_library() { | |||||
func = resolve_library_func(handle, g_func_name[i]); | func = resolve_library_func(handle, g_func_name[i]); | ||||
} | } | ||||
if (!func) { | if (!func) { | ||||
func = g_func_table_error[i]; | |||||
break; | |||||
} | } | ||||
num++; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | __atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | ||||
} | } | ||||
if (num != NR_FUNC) { | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | |||||
void* func = g_func_table_error[i]; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | |||||
} | |||||
} | |||||
done = true; | done = true; | ||||
} | } | ||||
@@ -4899,6 +4899,7 @@ static void load_library() { | |||||
return; | return; | ||||
void* handle = get_library_handle(); | void* handle = get_library_handle(); | ||||
int num = 0; | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | for (size_t i = 0; i < NR_FUNC; ++i) { | ||||
void* func; | void* func; | ||||
if (!handle) { | if (!handle) { | ||||
@@ -4907,10 +4908,17 @@ static void load_library() { | |||||
func = resolve_library_func(handle, g_func_name[i]); | func = resolve_library_func(handle, g_func_name[i]); | ||||
} | } | ||||
if (!func) { | if (!func) { | ||||
func = g_func_table_error[i]; | |||||
break; | |||||
} | } | ||||
num++; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | __atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | ||||
} | } | ||||
if (num != NR_FUNC) { | |||||
for (size_t i = 0; i < NR_FUNC; ++i) { | |||||
void* func = g_func_table_error[i]; | |||||
__atomic_store_n(g_func_table + i, func, __ATOMIC_RELAXED); | |||||
} | |||||
} | |||||
done = true; | done = true; | ||||
} | } | ||||
@@ -3,8 +3,8 @@ | |||||
#pragma GCC visibility push(default) | #pragma GCC visibility push(default) | ||||
#include <cstdio> | #include <cstdio> | ||||
#define LOGI(fmt, v...) fprintf(stdout, "info: " fmt "\n", ##v) | |||||
#define LOGD(fmt, v...) fprintf(stdout, "debug: " fmt "\n", ##v) | |||||
#define LOGI(fmt, v...) fprintf(stderr, "info: " fmt "\n", ##v) | |||||
#define LOGD(fmt, v...) fprintf(stderr, "debug: " fmt "\n", ##v) | |||||
extern "C" { | extern "C" { | ||||
#include "cuda.h" | #include "cuda.h" | ||||