Skip to content

[SYCL][HIP] Adds support for PCI device id and UUID #8233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1863,9 +1863,33 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
return getInfo(param_value_size, param_value, param_value_size_ret,
capabilities);
}

case PI_DEVICE_INFO_DEVICE_ID: {
int value = 0;
sycl::detail::pi::assertion(
hipDeviceGetAttribute(&value, hipDeviceAttributePciDeviceId,
device->get()) == hipSuccess);
sycl::detail::pi::assertion(value >= 0);
return getInfo(param_value_size, param_value, param_value_size_ret, value);
}

case PI_DEVICE_INFO_UUID: {
#if ((HIP_VERSION_MAJOR == 5 && HIP_VERSION_MINOR >= 2) || \
HIP_VERSION_MAJOR > 5)
hipUUID uuid = {};
// Supported since 5.2+
sycl::detail::pi::assertion(hipDeviceGetUuid(&uuid, device->get()) ==
hipSuccess);
std::array<unsigned char, 16> name;
std::copy(uuid.bytes, uuid.bytes + 16, name.begin());
return getInfoArray(16, param_value_size, param_value, param_value_size_ret,
name.data());
#endif
return PI_ERROR_INVALID_VALUE;
}

// TODO: Investigate if this information is available on HIP.
case PI_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
case PI_DEVICE_INFO_DEVICE_ID:
case PI_DEVICE_INFO_PCI_ADDRESS:
case PI_DEVICE_INFO_GPU_EU_COUNT:
case PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH:
Expand Down