Skip to content

Commit 57b8401

Browse files
[SYCL] Update error handling for sycl_ext_oneapi_device_architecture in SYCL RT (#14190)
The file in this patch was accidentally missing during commit and push for #14077, adding it here.
1 parent 2620292 commit 57b8401

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

sycl/source/detail/device_info.hpp

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,7 @@ struct get_device_info_impl<
674674
if (Item.first == arch)
675675
return Item.second;
676676
}
677-
throw sycl::exception(
678-
make_error_code(errc::runtime),
679-
"The current device architecture is not supported by "
680-
"sycl_ext_oneapi_device_architecture.");
677+
return ext::oneapi::experimental::architecture::unknown;
681678
};
682679
uint32_t DeviceIp;
683680
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
@@ -693,10 +690,7 @@ struct get_device_info_impl<
693690
if (std::string_view(Item.first) == arch)
694691
return Item.second;
695692
}
696-
throw sycl::exception(
697-
make_error_code(errc::runtime),
698-
"The current device architecture is not supported by "
699-
"sycl_ext_oneapi_device_architecture.");
693+
return ext::oneapi::experimental::architecture::unknown;
700694
};
701695
size_t ResultSize = 0;
702696
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
@@ -727,21 +721,7 @@ struct get_device_info_impl<
727721
return MapArchIDToArchName(DeviceIp);
728722
} // else is not needed
729723
// TODO: add support of other architectures by extending with else if
730-
// Generating a user-friendly error message
731-
std::string DeviceStr;
732-
if (Dev->is_gpu())
733-
DeviceStr = "GPU";
734-
else if (Dev->is_cpu())
735-
DeviceStr = "CPU";
736-
else if (Dev->is_accelerator())
737-
DeviceStr = "accelerator";
738-
// else if not needed
739-
std::stringstream ErrorMessage;
740-
ErrorMessage
741-
<< "sycl_ext_oneapi_device_architecture feature is not supported on "
742-
<< DeviceStr << " device with sycl::backend::" << CurrentBackend
743-
<< " backend.";
744-
throw sycl::exception(make_error_code(errc::runtime), ErrorMessage.str());
724+
return ext::oneapi::experimental::architecture::unknown;
745725
}
746726
};
747727

0 commit comments

Comments
 (0)