16 #include <string_view>
19 inline namespace _V1 {
21 using namespace detail;
26 const std::string &Extension) {
27 if (SyclPlatform.
get_backend() != sycl::backend::opencl) {
30 "has_extension can only be used with an OpenCL backend");
33 std::shared_ptr<sycl::detail::platform_impl> PlatformImpl =
35 ur_platform_handle_t PluginPlatform = PlatformImpl->getHandleRef();
36 const PluginPtr &Plugin = PlatformImpl->getPlugin();
40 size_t ResultSize = 0;
41 Plugin->call(urPlatformGetInfo, PluginPlatform, UR_PLATFORM_INFO_EXTENSIONS,
43 nullptr, &ResultSize);
47 std::unique_ptr<char[]> Result(
new char[ResultSize]);
48 Plugin->call(urPlatformGetInfo, PluginPlatform, UR_PLATFORM_INFO_EXTENSIONS,
49 ResultSize, Result.get(),
nullptr);
51 std::string_view ExtensionsString(Result.get());
52 return ExtensionsString.find(Extension) != std::string::npos;
56 const std::string &Extension) {
57 if (SyclDevice.
get_backend() != sycl::backend::opencl) {
60 "has_extension can only be used with an OpenCL backend");
63 std::shared_ptr<sycl::detail::device_impl> DeviceImpl =
65 ur_device_handle_t PluginDevice = DeviceImpl->getHandleRef();
66 const PluginPtr &Plugin = DeviceImpl->getPlugin();
70 size_t ResultSize = 0;
71 Plugin->call(urDeviceGetInfo, PluginDevice, UR_DEVICE_INFO_EXTENSIONS,
73 nullptr, &ResultSize);
77 std::unique_ptr<char[]> Result(
new char[ResultSize]);
78 Plugin->call(urDeviceGetInfo, PluginDevice, UR_DEVICE_INFO_EXTENSIONS,
79 ResultSize, Result.get(),
nullptr);
81 std::string_view ExtensionsString(Result.get());
82 return ExtensionsString.find(Extension) != std::string::npos;
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
backend get_backend() const noexcept
Returns the backend associated with this device.
decltype(Obj::impl) const & getSyclObjImpl(const Obj &SyclObject)
std::shared_ptr< plugin > PluginPtr
bool has_extension(const sycl::platform &SyclPlatform, const std::string &Extension)