wsl/hsakmt: Standardize error logging with pr_err
Signed-off-by: Horatio Zhang <Hongkun.Zhang@amd.com> Reviewed-by: Flora Cui <flora.cui@amd.com> Reviewed-by: Shane Xiao <shane.xiao@amd.com> Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/40>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "hsa-runtime/inc/amd_hsa_kernel_code.h"
|
||||
#include "inc/pm4_cmds.h"
|
||||
#include "util/utils.h"
|
||||
#include "libhsakmt.h"
|
||||
|
||||
namespace wsl {
|
||||
namespace thunk {
|
||||
|
||||
+3
-3
@@ -484,7 +484,7 @@ static HSAKMT_STATUS topology_parse_cpuinfo(struct proc_cpuinfo *cpuinfo,
|
||||
p += 2; /* remove ": " */
|
||||
proc = atoi(p);
|
||||
if (proc >= num_procs) {
|
||||
pr_warn("cpuinfo contains processor %d larger than %u\n", proc,
|
||||
pr_err("cpuinfo contains processor %d larger than %u\n", proc,
|
||||
num_procs);
|
||||
ret = HSAKMT_STATUS_NO_MEMORY;
|
||||
goto exit;
|
||||
@@ -527,7 +527,7 @@ static HSAKMT_STATUS topology_parse_cpuinfo(struct proc_cpuinfo *cpuinfo,
|
||||
p += 2; /* remove ": " */
|
||||
proc = atoi(p);
|
||||
if (proc >= num_procs) {
|
||||
pr_warn("cpuinfo contains processor %d larger than %u\n", proc,
|
||||
pr_err("cpuinfo contains processor %d larger than %u\n", proc,
|
||||
num_procs);
|
||||
ret = HSAKMT_STATUS_NO_MEMORY;
|
||||
goto exit;
|
||||
@@ -584,7 +584,7 @@ static HSAKMT_STATUS topology_get_cpu_maxfreq(uint32_t *max_freq) {
|
||||
if (!cpuinfo_max_freq) {
|
||||
std::ifstream cpuinfo("/proc/cpuinfo");
|
||||
if (!cpuinfo) {
|
||||
std::cerr << "Failed to open /proc/cpuinfo\n";
|
||||
pr_err("Failed to open /proc/cpuinfo\n");
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
}
|
||||
|
||||
|
||||
+20
-22
@@ -98,7 +98,7 @@ class os_thread {
|
||||
pthread_attr_t attrib;
|
||||
err = pthread_attr_init(&attrib);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "pthread_attr_init failed: %s\n", strerror(err));
|
||||
pr_err("pthread_attr_init failed: %s\n", strerror(err));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,10 +107,10 @@ class os_thread {
|
||||
stackSize = AlignUp(stackSize, 4096);
|
||||
err = pthread_attr_setstacksize(&attrib, stackSize);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "pthread_attr_setstacksize failed: %s\n", strerror(err));
|
||||
pr_err("pthread_attr_setstacksize failed: %s\n", strerror(err));
|
||||
err = pthread_attr_destroy(&attrib);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "pthread_attr_destroy failed: %s\n", strerror(err));
|
||||
pr_err("pthread_attr_destroy failed: %s\n", strerror(err));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class os_thread {
|
||||
cores = get_nprocs_conf();
|
||||
cpuset = CPU_ALLOC(cores);
|
||||
if (cpuset == nullptr) {
|
||||
fprintf(stderr, "CPU_ALLOC failed: %s\n", strerror(errno));
|
||||
pr_err("CPU_ALLOC failed: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
CPU_ZERO_S(CPU_ALLOC_SIZE(cores), cpuset);
|
||||
@@ -133,7 +133,7 @@ class os_thread {
|
||||
err = pthread_attr_setaffinity_np(&attrib, CPU_ALLOC_SIZE(cores), cpuset);
|
||||
CPU_FREE(cpuset);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "pthread_setaffinity_np failed: %s\n", strerror(err));
|
||||
pr_err("pthread_setaffinity_np failed: %s\n", strerror(err));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class os_thread {
|
||||
stackSize *= 2;
|
||||
err = pthread_attr_setstacksize(&attrib, stackSize);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "pthread_attr_setstacksize failed: %s\n", strerror(err));
|
||||
pr_err("pthread_attr_setstacksize failed: %s\n", strerror(err));
|
||||
return;
|
||||
}
|
||||
err = pthread_create(&thread, &attrib, ThreadTrampoline, args.get());
|
||||
@@ -163,7 +163,7 @@ class os_thread {
|
||||
|
||||
err = pthread_attr_destroy(&attrib);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "pthread_attr_destroy failed: %s\n", strerror(err));
|
||||
pr_err("pthread_attr_destroy failed: %s\n", strerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class os_thread {
|
||||
if (lock != nullptr) DestroyMutex(lock);
|
||||
if ((state == RUNNING) && (thread != 0)) {
|
||||
int err = pthread_detach(thread);
|
||||
if (err != 0) fprintf(stderr, "pthread_detach failed: %s\n", strerror(err));
|
||||
if (err != 0) pr_err("pthread_detach failed: %s\n", strerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ static_assert(sizeof(Thread) == sizeof(os_thread*), "OS abstraction size mismatc
|
||||
|
||||
LibHandle LoadLib(std::string filename) {
|
||||
void* ret = dlopen(filename.c_str(), RTLD_LAZY);
|
||||
if (ret == nullptr) debug_print("LoadLib(%s) failed: %s\n", filename.c_str(), dlerror());
|
||||
if (ret == nullptr) pr_err("LoadLib(%s) failed: %s\n", filename.c_str(), dlerror());
|
||||
return *(LibHandle*)&ret;
|
||||
}
|
||||
|
||||
@@ -231,14 +231,14 @@ void* GetExportAddress(LibHandle lib, std::string export_name) {
|
||||
link_map* map;
|
||||
int err = dlinfo(*(void**)&lib, RTLD_DI_LINKMAP, &map);
|
||||
if (err == -1) {
|
||||
fprintf(stderr, "dlinfo failed: %s\n", dlerror());
|
||||
pr_err("dlinfo failed: %s\n", dlerror());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Dl_info info;
|
||||
err = dladdr(ret, &info);
|
||||
if (err == 0) {
|
||||
fprintf(stderr, "dladdr failed.\n");
|
||||
pr_err("dladdr failed.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ uint64_t ReadAccurateClock() {
|
||||
timespec time;
|
||||
int err = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
|
||||
if (err != 0) {
|
||||
perror("clock_gettime(CLOCK_MONOTONIC_RAW,...) failed");
|
||||
pr_err("clock_gettime(CLOCK_MONOTONIC_RAW,...) failed %s\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
return (uint64_t(time.tv_sec) * 1000000000ull + uint64_t(time.tv_nsec)) * invPeriod;
|
||||
@@ -633,13 +633,11 @@ uint64_t AccurateClockFrequency() {
|
||||
timespec time;
|
||||
int err = clock_getres(clock, &time);
|
||||
if (err != 0) {
|
||||
perror("clock_getres failed");
|
||||
pr_err("clock_getres failed %s\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
if (time.tv_sec != 0 || time.tv_nsec >= 0xFFFFFFFF) {
|
||||
fprintf(stderr,
|
||||
"clock_getres(CLOCK_MONOTONIC(_RAW),...) returned very low "
|
||||
"frequency (<1Hz).\n");
|
||||
pr_err("clock_getres(CLOCK_MONOTONIC(_RAW),...) returned very low frequency (<1Hz).\n");
|
||||
abort();
|
||||
}
|
||||
if (invPeriod == 0.0) invPeriod = 1.0 / double(time.tv_nsec);
|
||||
@@ -650,20 +648,20 @@ SharedMutex CreateSharedMutex() {
|
||||
pthread_rwlockattr_t attrib;
|
||||
int err = pthread_rwlockattr_init(&attrib);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "rw lock attribute init failed: %s\n", strerror(err));
|
||||
pr_err("rw lock attribute init failed: %s\n", strerror(err));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef __GLIBC__
|
||||
err = pthread_rwlockattr_setkind_np(&attrib, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "Set rw lock attribute failure: %s\n", strerror(err));
|
||||
pr_err("Set rw lock attribute failure: %s\n", strerror(err));
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
err = pthread_rwlockattr_setkind(&attrib, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "Set rw lock attribute failure: %s\n", strerror(err));
|
||||
pr_err("Set rw lock attribute failure: %s\n", strerror(err));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -671,7 +669,7 @@ SharedMutex CreateSharedMutex() {
|
||||
pthread_rwlock_t* lock = new pthread_rwlock_t;
|
||||
err = pthread_rwlock_init(lock, &attrib);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "rw lock init failed: %s\n", strerror(err));
|
||||
pr_err("rw lock init failed: %s\n", strerror(err));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -692,7 +690,7 @@ bool AcquireSharedMutex(SharedMutex lock) {
|
||||
void ReleaseSharedMutex(SharedMutex lock) {
|
||||
int err = pthread_rwlock_unlock(*(pthread_rwlock_t**)&lock);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "SharedMutex unlock failed: %s\n", strerror(err));
|
||||
pr_err("SharedMutex unlock failed: %s\n", strerror(err));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
@@ -710,7 +708,7 @@ bool SharedAcquireSharedMutex(SharedMutex lock) {
|
||||
void SharedReleaseSharedMutex(SharedMutex lock) {
|
||||
int err = pthread_rwlock_unlock(*(pthread_rwlock_t**)&lock);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "SharedMutex unlock failed: %s\n", strerror(err));
|
||||
pr_err("SharedMutex unlock failed: %s\n", strerror(err));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
+28
-36
@@ -138,7 +138,7 @@ bool WDDMDevice::CreateDevice(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ bool WDDMDevice::DestroyDevice(void) {
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return true;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ bool WDDMDevice::CreatePagingQueue(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ bool WDDMDevice::DestroyPagingQueue(void) {
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return true;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -192,8 +192,7 @@ bool WDDMDevice::CommitSystemHeapSpace(void* addr, int64_t size, bool lock) {
|
||||
mapFlags |= MAP_LOCKED;
|
||||
void* paddr = mmap(addr, size, protFlags, mapFlags, -1, 0);
|
||||
if (paddr == MAP_FAILED) {
|
||||
fprintf(stderr, "%s fail to commit %s addr = %p, paddr = %p\n",
|
||||
__FUNCTION__, (lock ? "locked" : ""), addr, paddr);
|
||||
pr_err("fail to commit %s addr = %p, paddr = %p\n", (lock ? "locked" : ""), addr, paddr);
|
||||
return false;
|
||||
}
|
||||
assert(addr == paddr);
|
||||
@@ -212,8 +211,7 @@ bool WDDMDevice::CommitSystemHeapSpace(void* addr, int64_t size, bool lock) {
|
||||
* https://man7.org/linux/man-pages/man2/madvise.2.html
|
||||
*/
|
||||
if (madvise(addr, size, MADV_DONTFORK))
|
||||
fprintf(stderr, "%s fail to set MADV_DONTFORK for addr = %p\n",
|
||||
__FUNCTION__, addr);
|
||||
pr_err("fail to set MADV_DONTFORK for addr = %p\n", addr);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -224,8 +222,7 @@ bool WDDMDevice::DecommitSystemHeapSpace(void* addr, int64_t size) {
|
||||
MAP_NORESERVE|MAP_UNINITIALIZED;
|
||||
void* paddr = mmap(addr, size, protFlags, mapFlags, -1, 0);
|
||||
if (paddr == MAP_FAILED) {
|
||||
fprintf(stderr, "%s fail to decommit addr = %p, paddr = %p\n",
|
||||
__FUNCTION__, addr, paddr);
|
||||
pr_err("fail to decommit addr = %p, paddr = %p\n", addr, paddr);
|
||||
return false;
|
||||
}
|
||||
assert(addr == paddr);
|
||||
@@ -245,8 +242,7 @@ bool WDDMDevice::ReserveSystemHeapSpace() {
|
||||
void* cpu = mmap(NULL, system_heap_space_size_, protFlags,
|
||||
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
if (cpu == MAP_FAILED) {
|
||||
fprintf(stderr, "%s fail to reserve system_heap_space_size_ = %lx \n",
|
||||
__FUNCTION__, system_heap_space_size_);
|
||||
pr_err("fail to reserve system_heap_space_size_ = %lx \n", system_heap_space_size_);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -257,7 +253,7 @@ bool WDDMDevice::ReserveSystemHeapSpace() {
|
||||
bool WDDMDevice::FreeSystemHeapSpace(void) {
|
||||
void *cpu = (void *)system_heap_space_start_;
|
||||
if (munmap(cpu, system_heap_space_size_ != 0)) {
|
||||
fprintf(stderr, "%s fail to unmap = %p \n", __FUNCTION__, cpu);
|
||||
pr_err("fail to unmap = %p \n", cpu);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -287,8 +283,7 @@ bool WDDMDevice::ReserveLocalHeapSpace(void) {
|
||||
local_va = 0;
|
||||
ptr = mmap(NULL, sys_va_size , PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
if (ptr == MAP_FAILED) {
|
||||
fprintf(stderr, "%s fail to reserve cpu va in %d time!\n",
|
||||
__FUNCTION__, i);
|
||||
pr_err("fail to reserve cpu va in %d time!\n", i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -305,7 +300,7 @@ bool WDDMDevice::ReserveLocalHeapSpace(void) {
|
||||
local_va, ptr, i);
|
||||
break;
|
||||
} else {
|
||||
debug_print("%s fail to reserve gpu va for cpu va %p in %d time!\n",
|
||||
pr_err("%s fail to reserve gpu va for cpu va %p in %d time!\n",
|
||||
__FUNCTION__, ptr, i);
|
||||
}
|
||||
}
|
||||
@@ -315,21 +310,18 @@ bool WDDMDevice::ReserveLocalHeapSpace(void) {
|
||||
uint64_t left_size = local_va - sys_va[match_index];
|
||||
uint64_t right_size = align - left_size;
|
||||
if ((left_size > 0) && munmap((void*)sys_va[match_index], left_size))
|
||||
fprintf(stderr, "%s fail to unmap left %lx with size %lx\n",
|
||||
__FUNCTION__, sys_va[match_index], left_size);
|
||||
pr_err("fail to unmap left %lx with size %lx\n", sys_va[match_index], left_size);
|
||||
if ((right_size > 0) && munmap((void*)(local_va + local_heap_space_size_), right_size))
|
||||
fprintf(stderr, "%s fail to unmap right %lx with size %lx\n",
|
||||
__FUNCTION__, (local_va + local_heap_space_size_), right_size);
|
||||
pr_err("fail to unmap right %lx with size %lx\n", (local_va + local_heap_space_size_), right_size);
|
||||
} else {
|
||||
fprintf(stderr, "%s fail to reserve Local Heap Space !\n",
|
||||
__FUNCTION__);
|
||||
pr_err("fail to reserve Local Heap Space!\n");
|
||||
}
|
||||
|
||||
/* free match fail address for cpu va */
|
||||
int free = match_index >= 0 ? match_index : 16;
|
||||
for (int j = 0; j < free; j++) {
|
||||
if (sys_va[j] != 0 && munmap((void*)sys_va[j], sys_va_size)) {
|
||||
fprintf(stderr, "%s fail to unmap %d %lx\n", __FUNCTION__, j, sys_va[j]);
|
||||
pr_err("fail to unmap %d %lx\n", j, sys_va[j]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +452,7 @@ void *WDDMDevice::Lock(D3DKMT_HANDLE handle) {
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return args.pData;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -473,7 +465,7 @@ bool WDDMDevice::Unlock(D3DKMT_HANDLE handle) {
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return true;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -510,7 +502,7 @@ bool WDDMDevice::CreateContext(int engine, D3DKMT_HANDLE *handle) {
|
||||
|
||||
thunk_proxy::DestroyPrivData(priv_data);
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -522,7 +514,7 @@ bool WDDMDevice::DestroyContext(D3DKMT_HANDLE handle) {
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return true;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -539,7 +531,7 @@ bool WDDMDevice::GpuWait(WDDMQueue *queue, const D3DKMT_HANDLE *syncobjs,
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return true;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -555,7 +547,7 @@ bool WDDMDevice::GpuSignal(D3DKMT_HANDLE context, const D3DKMT_HANDLE *syncobjs,
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return true;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -572,7 +564,7 @@ bool WDDMDevice::CpuWait(const D3DKMT_HANDLE *syncobjs, uint64_t *value,
|
||||
if (ret == STATUS_SUCCESS)
|
||||
return true;
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -603,7 +595,7 @@ bool WDDMDevice::CreateSyncobj(D3DKMT_HANDLE *handle, uint64_t **addr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -613,7 +605,7 @@ void WDDMDevice::DestroySyncobj(D3DKMT_HANDLE handle) {
|
||||
|
||||
NTSTATUS ret = D3DKMTDestroySynchronizationObject(&args);
|
||||
if (ret != STATUS_SUCCESS)
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
}
|
||||
|
||||
void WDDMDevice::InitCmdbufInfo(void) {
|
||||
@@ -796,7 +788,7 @@ bool WDDMDevice::SubmitToSwQueue(WDDMQueue *queue, uint64_t command_addr,
|
||||
|
||||
NTSTATUS ret = D3DKMTSubmitCommand(&args);
|
||||
if (ret != STATUS_SUCCESS) {
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
thunk_proxy::DestroyPrivData(priv_data);
|
||||
return false;
|
||||
}
|
||||
@@ -825,7 +817,7 @@ bool WDDMDevice::CreateHwQueue(WDDMQueue *queue) {
|
||||
|
||||
NTSTATUS ret = D3DKMTCreateHwQueue(&createHwQueue);
|
||||
if (ret != STATUS_SUCCESS) {
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
thunk_proxy::DestroyPrivData(priv_data);
|
||||
return false;
|
||||
}
|
||||
@@ -846,7 +838,7 @@ bool WDDMDevice::DestroyHwQueue(WDDMQueue *queue) {
|
||||
|
||||
NTSTATUS ret = D3DKMTDestroyHwQueue(&DestroyHwQueue);
|
||||
if (ret != STATUS_SUCCESS) {
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -870,7 +862,7 @@ bool WDDMDevice::SubmitToHwQueue(WDDMQueue *queue, uint64_t command_addr,
|
||||
|
||||
NTSTATUS ret = D3DKMTSubmitCommandToHwQueue(&args);
|
||||
if (ret != STATUS_SUCCESS) {
|
||||
fprintf(stderr, "%s fail %x\n", __FUNCTION__, ret);
|
||||
pr_err("fail %x\n", ret);
|
||||
thunk_proxy::DestroyPrivData(priv_data);
|
||||
return false;
|
||||
}
|
||||
|
||||
+6
-6
@@ -388,7 +388,7 @@ ErrorCode GpuMemory::ImportPhysicalHandle(int dmabuf_fd) {
|
||||
query_args.hNtHandle = reinterpret_cast<HANDLE>(dmabuf_fd);
|
||||
auto ret = d3dthunk::QueryResourceInfoFromNtHandle(&query_args);
|
||||
if (ret != ErrorCode::Success) {
|
||||
debug_print("%s query resource info from nt handle failed %d\n", __FUNCTION__, static_cast<int>(ret));
|
||||
pr_err("query resource info from nt handle failed %d\n", static_cast<int>(ret));
|
||||
return ErrorCode::InvalidateParams;
|
||||
}
|
||||
pr_debug("wsl-thunk: import from nt handle %d, get allocation number %d,"
|
||||
@@ -401,8 +401,8 @@ ErrorCode GpuMemory::ImportPhysicalHandle(int dmabuf_fd) {
|
||||
|
||||
SharedHandleInfo shared_info;
|
||||
if(sizeof(shared_info) != query_args.PrivateRuntimeDataSize) {
|
||||
debug_print("%s shared hanle info size mismatch:%d vs %ld\n",
|
||||
__FUNCTION__, query_args.PrivateRuntimeDataSize, sizeof(shared_info));
|
||||
pr_err("shared hanle info size mismatch:%d vs %ld\n",
|
||||
query_args.PrivateRuntimeDataSize, sizeof(shared_info));
|
||||
return ErrorCode::UnSupported;
|
||||
}
|
||||
|
||||
@@ -412,8 +412,8 @@ ErrorCode GpuMemory::ImportPhysicalHandle(int dmabuf_fd) {
|
||||
D3DDDI_OPENALLOCATIONINFO2 *open_info =
|
||||
reinterpret_cast<D3DDDI_OPENALLOCATIONINFO2*> (calloc(1, total_size));
|
||||
if (!open_info) {
|
||||
debug_print("%s alloc open_info failed, NumAllocations:%d\n",
|
||||
__FUNCTION__, query_args.NumAllocations);
|
||||
pr_err("alloc open_info failed, NumAllocations:%d\n",
|
||||
query_args.NumAllocations);
|
||||
return ErrorCode::OutOfMemory;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ ErrorCode GpuMemory::ImportPhysicalHandle(int dmabuf_fd) {
|
||||
ret = d3dthunk::OpenResourceFromNtHandle(&open_args);
|
||||
if (ret != ErrorCode::Success) {
|
||||
ret = ErrorCode::InvalidateParams;
|
||||
debug_print("%s open resource failed %d\n", __FUNCTION__, static_cast<int>(ret));
|
||||
pr_err("open resource failed %d\n", static_cast<int>(ret));
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -165,7 +165,7 @@ void ComputeQueue::HandleError(hsa_status_t status) {
|
||||
for (std::size_t i = 0; i < sizeof(QueueErrors) / sizeof(QueueErrors[0]); ++i) {
|
||||
if (QueueErrors[i].status == status) {
|
||||
val = QueueErrors[i].code;
|
||||
debug_print("error %d, sig_val %ld\n", status, val);
|
||||
pr_err("error %d, sig_val %ld\n", status, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ void ComputeQueue::AqlToPm4Thread(ComputeQueue *queue) {
|
||||
if (!queue->IsInvalidPacket()) {
|
||||
hsa_status_t status = queue->Process();
|
||||
if (status != HSA_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "process compute queue fail status = %08x\n", status);
|
||||
pr_err("process compute queue fail status = %08x\n", status);
|
||||
queue->HandleError(status);
|
||||
break;
|
||||
}
|
||||
|
||||
+3
-2
@@ -2,6 +2,7 @@
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include "inc/wddm/va_mgr.h"
|
||||
#include "libhsakmt.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -17,9 +18,9 @@ VaMgr::VaMgr(uint64_t start, uint64_t size, uint64_t min_align) {
|
||||
VaMgr::~VaMgr() {
|
||||
|
||||
if (free_list_.size() != 1)
|
||||
std::cerr << "Warning: free_list_ size is not 1." << std::endl;
|
||||
pr_err("free_list_ size is not 1.\n");
|
||||
if (frag_map_.size() != 1)
|
||||
std::cerr << "Warning: frag_map_ size is not 1." << std::endl;
|
||||
pr_err("frag_map_ size is not 1.\n");
|
||||
|
||||
free_list_.clear();
|
||||
frag_map_.clear();
|
||||
|
||||
Reference in New Issue
Block a user