Skip to content

Commit e09ff58

Browse files
authored
[SYCL][HIP] Adds support for PCI device id and UUID (#8233)
Completes the extensions for HIP.
1 parent 519a8e2 commit e09ff58

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

sycl/plugins/hip/pi_hip.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1863,9 +1863,33 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
18631863
return getInfo(param_value_size, param_value, param_value_size_ret,
18641864
capabilities);
18651865
}
1866+
1867+
case PI_DEVICE_INFO_DEVICE_ID: {
1868+
int value = 0;
1869+
sycl::detail::pi::assertion(
1870+
hipDeviceGetAttribute(&value, hipDeviceAttributePciDeviceId,
1871+
device->get()) == hipSuccess);
1872+
sycl::detail::pi::assertion(value >= 0);
1873+
return getInfo(param_value_size, param_value, param_value_size_ret, value);
1874+
}
1875+
1876+
case PI_DEVICE_INFO_UUID: {
1877+
#if ((HIP_VERSION_MAJOR == 5 && HIP_VERSION_MINOR >= 2) || \
1878+
HIP_VERSION_MAJOR > 5)
1879+
hipUUID uuid = {};
1880+
// Supported since 5.2+
1881+
sycl::detail::pi::assertion(hipDeviceGetUuid(&uuid, device->get()) ==
1882+
hipSuccess);
1883+
std::array<unsigned char, 16> name;
1884+
std::copy(uuid.bytes, uuid.bytes + 16, name.begin());
1885+
return getInfoArray(16, param_value_size, param_value, param_value_size_ret,
1886+
name.data());
1887+
#endif
1888+
return PI_ERROR_INVALID_VALUE;
1889+
}
1890+
18661891
// TODO: Investigate if this information is available on HIP.
18671892
case PI_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
1868-
case PI_DEVICE_INFO_DEVICE_ID:
18691893
case PI_DEVICE_INFO_PCI_ADDRESS:
18701894
case PI_DEVICE_INFO_GPU_EU_COUNT:
18711895
case PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH:

0 commit comments

Comments
 (0)