Skip to content

Commit

Permalink
Merge pull request #1452 from IntelPython/improve-exception-parent-de…
Browse files Browse the repository at this point in the history
…vice

Use partition_type_property descriptor in DPCTLDevice_GetParentDevice
  • Loading branch information
oleksandr-pavlyk authored Oct 24, 2023
2 parents 26b9c92 + 4ac53fd commit 386bd8b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libsyclinterface/source/dpctl_sycl_device_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,18 @@ DPCTLDevice_GetParentDevice(__dpctl_keep const DPCTLSyclDeviceRef DRef)
{
auto D = unwrap<device>(DRef);
if (D) {
bool is_unpartitioned = false;
try {
auto pp =
D->get_info<sycl::info::device::partition_type_property>();
is_unpartitioned =
(pp == sycl::info::partition_property::no_partition);
} catch (std::exception const &e) {
error_handler(e, __FILE__, __func__, __LINE__);
return nullptr;
}
if (is_unpartitioned)
return nullptr;
try {
const auto &parent_D = D->get_info<info::device::parent_device>();
return wrap<device>(new device(parent_D));
Expand Down

0 comments on commit 386bd8b

Please sign in to comment.