66//
77// ===----------------------------------------------------------------------===//
88
9+ #include " detail/adapter.hpp"
910#include " detail/context_impl.hpp"
1011#include " detail/event_impl.hpp"
1112#include " detail/kernel_bundle_impl.hpp"
1213#include " detail/kernel_id_impl.hpp"
1314#include " detail/platform_impl.hpp"
14- #include " detail/plugin.hpp"
1515#include " detail/queue_impl.hpp"
1616#include " sycl/detail/impl_utils.hpp"
1717#include < sycl/backend.hpp>
@@ -29,20 +29,20 @@ namespace sycl {
2929inline namespace _V1 {
3030namespace detail {
3131
32- static const PluginPtr & getPlugin (backend Backend) {
32+ static const AdapterPtr & getAdapter (backend Backend) {
3333 switch (Backend) {
3434 case backend::opencl:
35- return ur::getPlugin <backend::opencl>();
35+ return ur::getAdapter <backend::opencl>();
3636 case backend::ext_oneapi_level_zero:
37- return ur::getPlugin <backend::ext_oneapi_level_zero>();
37+ return ur::getAdapter <backend::ext_oneapi_level_zero>();
3838 case backend::ext_oneapi_cuda:
39- return ur::getPlugin <backend::ext_oneapi_cuda>();
39+ return ur::getAdapter <backend::ext_oneapi_cuda>();
4040 case backend::ext_oneapi_hip:
41- return ur::getPlugin <backend::ext_oneapi_hip>();
41+ return ur::getAdapter <backend::ext_oneapi_hip>();
4242 default :
4343 throw sycl::exception (
4444 sycl::make_error_code (sycl::errc::runtime),
45- " getPlugin : Unsupported backend " +
45+ " getAdapter : Unsupported backend " +
4646 detail::codeToString (UR_RESULT_ERROR_INVALID_OPERATION));
4747 }
4848}
@@ -68,34 +68,34 @@ backend convertUrBackend(ur_platform_backend_t UrBackend) {
6868}
6969
7070platform make_platform (ur_native_handle_t NativeHandle, backend Backend) {
71- const auto &Plugin = getPlugin (Backend);
71+ const auto &Adapter = getAdapter (Backend);
7272
7373 // Create UR platform first.
7474 ur_platform_handle_t UrPlatform = nullptr ;
75- Plugin ->call <UrApiKind::urPlatformCreateWithNativeHandle>(
76- NativeHandle, Plugin ->getUrAdapter (), nullptr , &UrPlatform);
75+ Adapter ->call <UrApiKind::urPlatformCreateWithNativeHandle>(
76+ NativeHandle, Adapter ->getUrAdapter (), nullptr , &UrPlatform);
7777
7878 return detail::createSyclObjFromImpl<platform>(
79- platform_impl::getOrMakePlatformImpl (UrPlatform, Plugin ));
79+ platform_impl::getOrMakePlatformImpl (UrPlatform, Adapter ));
8080}
8181
8282__SYCL_EXPORT device make_device (ur_native_handle_t NativeHandle,
8383 backend Backend) {
84- const auto &Plugin = getPlugin (Backend);
84+ const auto &Adapter = getAdapter (Backend);
8585
8686 ur_device_handle_t UrDevice = nullptr ;
87- Plugin ->call <UrApiKind::urDeviceCreateWithNativeHandle>(
88- NativeHandle, Plugin ->getUrAdapter (), nullptr , &UrDevice);
87+ Adapter ->call <UrApiKind::urDeviceCreateWithNativeHandle>(
88+ NativeHandle, Adapter ->getUrAdapter (), nullptr , &UrDevice);
8989 // Construct the SYCL device from UR device.
9090 return detail::createSyclObjFromImpl<device>(
91- std::make_shared<device_impl>(UrDevice, Plugin ));
91+ std::make_shared<device_impl>(UrDevice, Adapter ));
9292}
9393
9494__SYCL_EXPORT context make_context (ur_native_handle_t NativeHandle,
9595 const async_handler &Handler,
9696 backend Backend, bool KeepOwnership,
9797 const std::vector<device> &DeviceList) {
98- const auto &Plugin = getPlugin (Backend);
98+ const auto &Adapter = getAdapter (Backend);
9999
100100 ur_context_handle_t UrContext = nullptr ;
101101 ur_context_native_properties_t Properties{};
@@ -105,12 +105,12 @@ __SYCL_EXPORT context make_context(ur_native_handle_t NativeHandle,
105105 for (const auto &Dev : DeviceList) {
106106 DeviceHandles.push_back (detail::getSyclObjImpl (Dev)->getHandleRef ());
107107 }
108- Plugin ->call <UrApiKind::urContextCreateWithNativeHandle>(
109- NativeHandle, Plugin ->getUrAdapter (), DeviceHandles.size (),
108+ Adapter ->call <UrApiKind::urContextCreateWithNativeHandle>(
109+ NativeHandle, Adapter ->getUrAdapter (), DeviceHandles.size (),
110110 DeviceHandles.data (), &Properties, &UrContext);
111111 // Construct the SYCL context from UR context.
112112 return detail::createSyclObjFromImpl<context>(std::make_shared<context_impl>(
113- UrContext, Handler, Plugin , DeviceList, !KeepOwnership));
113+ UrContext, Handler, Adapter , DeviceList, !KeepOwnership));
114114}
115115
116116__SYCL_EXPORT queue make_queue (ur_native_handle_t NativeHandle,
@@ -120,7 +120,7 @@ __SYCL_EXPORT queue make_queue(ur_native_handle_t NativeHandle,
120120 const async_handler &Handler, backend Backend) {
121121 ur_device_handle_t UrDevice =
122122 Device ? getSyclObjImpl (*Device)->getHandleRef () : nullptr ;
123- const auto &Plugin = getPlugin (Backend);
123+ const auto &Adapter = getAdapter (Backend);
124124 const auto &ContextImpl = getSyclObjImpl (Context);
125125
126126 if (PropList.has_property <ext::intel::property::queue::compute_index>()) {
@@ -150,7 +150,7 @@ __SYCL_EXPORT queue make_queue(ur_native_handle_t NativeHandle,
150150 // Create UR queue first.
151151 ur_queue_handle_t UrQueue = nullptr ;
152152
153- Plugin ->call <UrApiKind::urQueueCreateWithNativeHandle>(
153+ Adapter ->call <UrApiKind::urQueueCreateWithNativeHandle>(
154154 NativeHandle, ContextImpl->getHandleRef (), UrDevice, &NativeProperties,
155155 &UrQueue);
156156 // Construct the SYCL queue from UR queue.
@@ -166,82 +166,82 @@ __SYCL_EXPORT event make_event(ur_native_handle_t NativeHandle,
166166__SYCL_EXPORT event make_event (ur_native_handle_t NativeHandle,
167167 const context &Context, bool KeepOwnership,
168168 backend Backend) {
169- const auto &Plugin = getPlugin (Backend);
169+ const auto &Adapter = getAdapter (Backend);
170170 const auto &ContextImpl = getSyclObjImpl (Context);
171171
172172 ur_event_handle_t UrEvent = nullptr ;
173173 ur_event_native_properties_t Properties{};
174174 Properties.stype = UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES;
175175 Properties.isNativeHandleOwned = !KeepOwnership;
176176
177- Plugin ->call <UrApiKind::urEventCreateWithNativeHandle>(
177+ Adapter ->call <UrApiKind::urEventCreateWithNativeHandle>(
178178 NativeHandle, ContextImpl->getHandleRef (), &Properties, &UrEvent);
179179 event Event = detail::createSyclObjFromImpl<event>(
180180 std::make_shared<event_impl>(UrEvent, Context));
181181
182182 if (Backend == backend::opencl)
183- Plugin ->call <UrApiKind::urEventRetain>(UrEvent);
183+ Adapter ->call <UrApiKind::urEventRetain>(UrEvent);
184184 return Event;
185185}
186186
187187std::shared_ptr<detail::kernel_bundle_impl>
188188make_kernel_bundle (ur_native_handle_t NativeHandle,
189189 const context &TargetContext, bool KeepOwnership,
190190 bundle_state State, backend Backend) {
191- const auto &Plugin = getPlugin (Backend);
191+ const auto &Adapter = getAdapter (Backend);
192192 const auto &ContextImpl = getSyclObjImpl (TargetContext);
193193
194194 ur_program_handle_t UrProgram = nullptr ;
195195 ur_program_native_properties_t Properties{};
196196 Properties.stype = UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES;
197197 Properties.isNativeHandleOwned = !KeepOwnership;
198198
199- Plugin ->call <UrApiKind::urProgramCreateWithNativeHandle>(
199+ Adapter ->call <UrApiKind::urProgramCreateWithNativeHandle>(
200200 NativeHandle, ContextImpl->getHandleRef (), &Properties, &UrProgram);
201201 if (UrProgram == nullptr )
202202 throw sycl::exception (
203203 sycl::make_error_code (sycl::errc::invalid),
204204 " urProgramCreateWithNativeHandle resulted in a null program handle." );
205205
206206 if (ContextImpl->getBackend () == backend::opencl)
207- Plugin ->call <UrApiKind::urProgramRetain>(UrProgram);
207+ Adapter ->call <UrApiKind::urProgramRetain>(UrProgram);
208208
209209 std::vector<ur_device_handle_t > ProgramDevices;
210210 uint32_t NumDevices = 0 ;
211211
212- Plugin ->call <UrApiKind::urProgramGetInfo>(
212+ Adapter ->call <UrApiKind::urProgramGetInfo>(
213213 UrProgram, UR_PROGRAM_INFO_NUM_DEVICES, sizeof (NumDevices), &NumDevices,
214214 nullptr );
215215 ProgramDevices.resize (NumDevices);
216- Plugin ->call <UrApiKind::urProgramGetInfo>(
216+ Adapter ->call <UrApiKind::urProgramGetInfo>(
217217 UrProgram, UR_PROGRAM_INFO_DEVICES,
218218 sizeof (ur_device_handle_t ) * NumDevices, ProgramDevices.data (), nullptr );
219219
220220 for (auto &Dev : ProgramDevices) {
221221 ur_program_binary_type_t BinaryType;
222- Plugin ->call <UrApiKind::urProgramGetBuildInfo>(
222+ Adapter ->call <UrApiKind::urProgramGetBuildInfo>(
223223 UrProgram, Dev, UR_PROGRAM_BUILD_INFO_BINARY_TYPE,
224224 sizeof (ur_program_binary_type_t ), &BinaryType, nullptr );
225225 switch (BinaryType) {
226226 case (UR_PROGRAM_BINARY_TYPE_NONE):
227227 if (State == bundle_state::object) {
228- auto Res = Plugin ->call_nocheck <UrApiKind::urProgramCompileExp>(
228+ auto Res = Adapter ->call_nocheck <UrApiKind::urProgramCompileExp>(
229229 UrProgram, 1 , &Dev, nullptr );
230230 if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
231- Res = Plugin ->call_nocheck <UrApiKind::urProgramCompile>(
231+ Res = Adapter ->call_nocheck <UrApiKind::urProgramCompile>(
232232 ContextImpl->getHandleRef (), UrProgram, nullptr );
233233 }
234- Plugin ->checkUrResult <errc::build>(Res);
234+ Adapter ->checkUrResult <errc::build>(Res);
235235 }
236236
237237 else if (State == bundle_state::executable) {
238- auto Res = Plugin ->call_nocheck <UrApiKind::urProgramBuildExp>(
238+ auto Res = Adapter ->call_nocheck <UrApiKind::urProgramBuildExp>(
239239 UrProgram, 1 , &Dev, nullptr );
240240 if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
241- Res = Plugin ->call_nocheck <UrApiKind::urProgramBuild>(
241+ Res = Adapter ->call_nocheck <UrApiKind::urProgramBuild>(
242242 ContextImpl->getHandleRef (), UrProgram, nullptr );
243243 }
244- Plugin ->checkUrResult <errc::build>(Res);
244+ Adapter ->checkUrResult <errc::build>(Res);
245245 }
246246
247247 break ;
@@ -254,15 +254,15 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
254254 detail::codeToString (UR_RESULT_ERROR_INVALID_VALUE));
255255 if (State == bundle_state::executable) {
256256 ur_program_handle_t UrLinkedProgram = nullptr ;
257- auto Res = Plugin ->call_nocheck <UrApiKind::urProgramLinkExp>(
257+ auto Res = Adapter ->call_nocheck <UrApiKind::urProgramLinkExp>(
258258 ContextImpl->getHandleRef (), 1 , &Dev, 1 , &UrProgram, nullptr ,
259259 &UrLinkedProgram);
260260 if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
261- Res = Plugin ->call_nocheck <UrApiKind::urProgramLink>(
261+ Res = Adapter ->call_nocheck <UrApiKind::urProgramLink>(
262262 ContextImpl->getHandleRef (), 1 , &UrProgram, nullptr ,
263263 &UrLinkedProgram);
264264 }
265- Plugin ->checkUrResult <errc::build>(Res);
265+ Adapter ->checkUrResult <errc::build>(Res);
266266 if (UrLinkedProgram != nullptr ) {
267267 UrProgram = UrLinkedProgram;
268268 }
@@ -284,9 +284,9 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
284284 Devices.reserve (ProgramDevices.size ());
285285 std::transform (
286286 ProgramDevices.begin (), ProgramDevices.end (), std::back_inserter (Devices),
287- [&Plugin ](const auto &Dev) {
287+ [&Adapter ](const auto &Dev) {
288288 auto Platform =
289- detail::platform_impl::getPlatformFromUrDevice (Dev, Plugin );
289+ detail::platform_impl::getPlatformFromUrDevice (Dev, Adapter );
290290 auto DeviceImpl = Platform->getOrMakeDeviceImpl (Dev, Platform);
291291 return createSyclObjFromImpl<device>(DeviceImpl);
292292 });
@@ -316,7 +316,7 @@ kernel make_kernel(const context &TargetContext,
316316 const kernel_bundle<bundle_state::executable> &KernelBundle,
317317 ur_native_handle_t NativeHandle, bool KeepOwnership,
318318 backend Backend) {
319- const auto &Plugin = getPlugin (Backend);
319+ const auto &Adapter = getAdapter (Backend);
320320 const auto &ContextImpl = getSyclObjImpl (TargetContext);
321321 const auto KernelBundleImpl = getSyclObjImpl (KernelBundle);
322322
@@ -346,12 +346,12 @@ kernel make_kernel(const context &TargetContext,
346346 ur_kernel_native_properties_t Properties{};
347347 Properties.stype = UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES;
348348 Properties.isNativeHandleOwned = !KeepOwnership;
349- Plugin ->call <UrApiKind::urKernelCreateWithNativeHandle>(
349+ Adapter ->call <UrApiKind::urKernelCreateWithNativeHandle>(
350350 NativeHandle, ContextImpl->getHandleRef (), UrProgram, &Properties,
351351 &UrKernel);
352352
353353 if (Backend == backend::opencl)
354- Plugin ->call <UrApiKind::urKernelRetain>(UrKernel);
354+ Adapter ->call <UrApiKind::urKernelRetain>(UrKernel);
355355
356356 // Construct the SYCL queue from UR queue.
357357 return detail::createSyclObjFromImpl<kernel>(
0 commit comments