@@ -32,27 +32,9 @@ __SYCL_EXPORT bool has_extension(const sycl::platform &SyclPlatform,
3232 " has_extension can only be used with an OpenCL backend" );
3333 }
3434
35- std::shared_ptr<sycl::detail::platform_impl> PlatformImpl =
36- getSyclObjImpl (SyclPlatform);
37- ur_platform_handle_t AdapterPlatform = PlatformImpl->getHandleRef ();
38- const AdapterPtr &Adapter = PlatformImpl->getAdapter ();
35+ std::string ExtensionsString = urGetInfoString<UrApiKind::urPlatformGetInfo>(
36+ *getSyclObjImpl (SyclPlatform), UR_PLATFORM_INFO_EXTENSIONS);
3937
40- // Manual invocation of UR API to avoid using deprecated
41- // info::platform::extensions call.
42- size_t ResultSize = 0 ;
43- Adapter->call <UrApiKind::urPlatformGetInfo>(
44- AdapterPlatform, UR_PLATFORM_INFO_EXTENSIONS,
45- /* propSize=*/ 0 ,
46- /* pPropValue=*/ nullptr , &ResultSize);
47- if (ResultSize == 0 )
48- return false ;
49-
50- std::unique_ptr<char []> Result (new char [ResultSize]);
51- Adapter->call <UrApiKind::urPlatformGetInfo>(
52- AdapterPlatform, UR_PLATFORM_INFO_EXTENSIONS, ResultSize, Result.get (),
53- nullptr );
54-
55- std::string_view ExtensionsString (Result.get ());
5638 return ExtensionsString.find (std::string_view{Extension.data ()}) !=
5739 std::string::npos;
5840}
@@ -65,26 +47,9 @@ __SYCL_EXPORT bool has_extension(const sycl::device &SyclDevice,
6547 " has_extension can only be used with an OpenCL backend" );
6648 }
6749
68- detail::device_impl &DeviceImpl = *getSyclObjImpl (SyclDevice);
69- ur_device_handle_t AdapterDevice = DeviceImpl.getHandleRef ();
70- const AdapterPtr &Adapter = DeviceImpl.getAdapter ();
71-
72- // Manual invocation of UR API to avoid using deprecated
73- // info::device::extensions call.
74- size_t ResultSize = 0 ;
75- Adapter->call <UrApiKind::urDeviceGetInfo>(
76- AdapterDevice, UR_DEVICE_INFO_EXTENSIONS,
77- /* propSize=*/ 0 ,
78- /* pPropValue=*/ nullptr , &ResultSize);
79- if (ResultSize == 0 )
80- return false ;
81-
82- std::unique_ptr<char []> Result (new char [ResultSize]);
83- Adapter->call <UrApiKind::urDeviceGetInfo>(AdapterDevice,
84- UR_DEVICE_INFO_EXTENSIONS,
85- ResultSize, Result.get (), nullptr );
50+ std::string ExtensionsString = urGetInfoString<UrApiKind::urDeviceGetInfo>(
51+ *getSyclObjImpl (SyclDevice), UR_DEVICE_INFO_EXTENSIONS);
8652
87- std::string_view ExtensionsString (Result.get ());
8853 return ExtensionsString.find (std::string_view{Extension.data ()}) !=
8954 std::string::npos;
9055}
0 commit comments