diff --git a/projects/rocr-runtime/src/debug.c b/projects/rocr-runtime/src/debug.c index 0b73c6ce8f..d225e0cc9a 100644 --- a/projects/rocr-runtime/src/debug.c +++ b/projects/rocr-runtime/src/debug.c @@ -33,8 +33,6 @@ static bool *is_device_debugged; -int debug_get_reg_status(uint32_t node_id, bool *is_debugged); - HSAKMT_STATUS init_device_debugging_memory(unsigned int NumNodes) { unsigned int i; @@ -57,6 +55,11 @@ void destroy_device_debugging_memory(void) } } +bool debug_get_reg_status(uint32_t node_id) +{ + return is_device_debugged[node_id]; +} + HSAKMT_STATUS HSAKMTAPI hsaKmtDbgRegister(HSAuint32 NodeId) { HSAKMT_STATUS result; @@ -262,16 +265,6 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtDbgAddressWatch(HSAuint32 NodeId, return HSAKMT_STATUS_SUCCESS; } -int debug_get_reg_status(uint32_t node_id, bool *is_debugged) -{ - *is_debugged = NULL; - if (!is_device_debugged) - return -1; - - *is_debugged = is_device_debugged[node_id]; - return 0; -} - /* Get the major and minor version of the kernel debugger support. */ HSAKMT_STATUS HSAKMTAPI diff --git a/projects/rocr-runtime/src/fmm.c b/projects/rocr-runtime/src/fmm.c index 67d0d0bb09..847bd0ecfa 100644 --- a/projects/rocr-runtime/src/fmm.c +++ b/projects/rocr-runtime/src/fmm.c @@ -296,7 +296,6 @@ static inline HsaSharedMemoryHandle *to_hsa_shared_memory_handle( return (HsaSharedMemoryHandle *)SharedMemoryStruct; } -extern int debug_get_reg_status(uint32_t node_id, bool *is_debugged); static int __fmm_release(vm_object_t *object, manageable_aperture_t *aperture); static int _fmm_unmap_from_gpu_scratch(uint32_t gpu_id, manageable_aperture_t *aperture, @@ -2841,9 +2840,9 @@ static int _fmm_map_to_gpu_scratch(uint32_t gpu_id, manageable_aperture_t *apert VOID_PTR_ADD(address, size - 1) > aperture->limit) return -1; - ret = debug_get_reg_status(gpu_mem[gpu_mem_id].node_id, &is_debugger); + is_debugger = debug_get_reg_status(gpu_mem[gpu_mem_id].node_id); /* allocate object within the scratch backing aperture */ - if (!ret && !is_debugger) { + if (!is_debugger) { obj = fmm_allocate_memory_object( gpu_id, address, size, aperture, &mmap_offset, KFD_IOC_ALLOC_MEM_FLAGS_VRAM | diff --git a/projects/rocr-runtime/src/libhsakmt.h b/projects/rocr-runtime/src/libhsakmt.h index c9d6fcf46b..2e4b455cbf 100644 --- a/projects/rocr-runtime/src/libhsakmt.h +++ b/projects/rocr-runtime/src/libhsakmt.h @@ -191,6 +191,7 @@ HSAKMT_STATUS init_process_doorbells(unsigned int NumNodes); void destroy_process_doorbells(void); HSAKMT_STATUS init_device_debugging_memory(unsigned int NumNodes); void destroy_device_debugging_memory(void); +bool debug_get_reg_status(uint32_t node_id); HSAKMT_STATUS init_counter_props(unsigned int NumNodes); void destroy_counter_props(void); uint32_t *convert_queue_ids(HSAuint32 NumQueues, HSA_QUEUEID *Queues);