rocr/driver: add GetDeviceHandle to driver interface

This commit introduces a new GetDeviceHandle API to the driver
interface, allowing retrieval of the device handle for a
specific node.

- Implemented GetDeviceHandle in KfdDriver to fetch the AMD GPU
  device handle using hsaKmtGetAMDGPUDeviceHandle.
- Added a stub implementation of GetDeviceHandle in XdnaDriver
  that returns HSA_STATUS_ERROR.
- Modified GpuAgent::InitLibDrm to use driver().GetDeviceHandle
  instead of directly calling hsaKmtGetAMDGPUDeviceHandle.

Signed-off-by: Honglei Huang <Honglei1.Huang@amd.com>


[ROCm/ROCR-Runtime commit: 05b83e72d9]
This commit is contained in:
Honglei Huang
2025-07-01 14:00:37 +08:00
committed by Huang, Honglei1
parent d675a9e3a0
commit bacf61dde9
6 changed files with 26 additions and 4 deletions
@@ -601,12 +601,12 @@ void GpuAgent::InitCacheList() {
}
void GpuAgent::InitLibDrm() {
HSAKMT_STATUS status;
hsa_status_t status;
HsaAMDGPUDeviceHandle device_handle;
status = HSAKMT_CALL(hsaKmtGetAMDGPUDeviceHandle(node_id(), &device_handle));
if (status != HSAKMT_STATUS_SUCCESS)
throw AMD::hsa_exception(HSA_STATUS_ERROR,
status = driver().GetDeviceHandle(node_id(), &device_handle);
if (status != HSA_STATUS_SUCCESS)
throw AMD::hsa_exception(status,
"Agent creation failed.\nlibdrm get device handle failed.\n");
ldrm_dev_ = (amdgpu_device_handle)device_handle;