@@ -32,27 +32,9 @@ __SYCL_EXPORT bool has_extension(const sycl::platform &SyclPlatform,
32
32
" has_extension can only be used with an OpenCL backend" );
33
33
}
34
34
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);
39
37
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 ());
56
38
return ExtensionsString.find (std::string_view{Extension.data ()}) !=
57
39
std::string::npos;
58
40
}
@@ -65,26 +47,9 @@ __SYCL_EXPORT bool has_extension(const sycl::device &SyclDevice,
65
47
" has_extension can only be used with an OpenCL backend" );
66
48
}
67
49
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);
86
52
87
- std::string_view ExtensionsString (Result.get ());
88
53
return ExtensionsString.find (std::string_view{Extension.data ()}) !=
89
54
std::string::npos;
90
55
}
0 commit comments