Skip to content

Commit 68b089f

Browse files
authored
[SYCL][HIP] Fix reported device name (#5508)
On AMD GPUs it seems that `hipDeviceGetName` returns an empty string, so when this is the case simply return the architecture instead, as this what AMD OpenCL devices return for the name. Before this patch: ``` Devices : 1 Device [#0]: Type : gpu Version : 0.0 Name : Vendor : AMD Corporation Driver : HIP 40421.43 ``` After this patch: ``` Devices : 1 Device [#0]: Type : gpu Version : 0.0 Name : gfx908:sramecc+:xnack- Vendor : AMD Corporation Driver : HIP 40421.43 ```
1 parent 661b2c9 commit 68b089f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sycl/plugins/hip/pi_hip.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,17 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
14541454
cl::sycl::detail::pi::assertion(
14551455
hipDeviceGetName(name, MAX_DEVICE_NAME_LENGTH, device->get()) ==
14561456
hipSuccess);
1457+
1458+
// On AMD GPUs hipDeviceGetName returns an empty string, so return the arch
1459+
// name instead, this is also what AMD OpenCL devices return.
1460+
if (strlen(name) == 0) {
1461+
hipDeviceProp_t props;
1462+
cl::sycl::detail::pi::assertion(
1463+
hipGetDeviceProperties(&props, device->get()) == hipSuccess);
1464+
1465+
return getInfoArray(strlen(props.gcnArchName) + 1, param_value_size,
1466+
param_value, param_value_size_ret, props.gcnArchName);
1467+
}
14571468
return getInfoArray(strlen(name) + 1, param_value_size, param_value,
14581469
param_value_size_ret, name);
14591470
}

0 commit comments

Comments
 (0)