Skip to content

Commit 0ed0037

Browse files
committed
[SYCL][NFC] Pass adapter by reference in backend[_impl]
1 parent 156429e commit 0ed0037

File tree

11 files changed

+60
-65
lines changed

11 files changed

+60
-65
lines changed

sycl/source/backend.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ namespace sycl {
3030
inline namespace _V1 {
3131
namespace detail {
3232

33-
static const AdapterPtr &getAdapter(backend Backend) {
33+
static const adapter_impl &getAdapter(backend Backend) {
3434
switch (Backend) {
3535
case backend::opencl:
36-
return ur::getAdapter<backend::opencl>();
36+
return *ur::getAdapter<backend::opencl>();
3737
case backend::ext_oneapi_level_zero:
38-
return ur::getAdapter<backend::ext_oneapi_level_zero>();
38+
return *ur::getAdapter<backend::ext_oneapi_level_zero>();
3939
case backend::ext_oneapi_cuda:
40-
return ur::getAdapter<backend::ext_oneapi_cuda>();
40+
return *ur::getAdapter<backend::ext_oneapi_cuda>();
4141
case backend::ext_oneapi_hip:
42-
return ur::getAdapter<backend::ext_oneapi_hip>();
42+
return *ur::getAdapter<backend::ext_oneapi_hip>();
4343
default:
4444
throw sycl::exception(
4545
sycl::make_error_code(sycl::errc::runtime),
@@ -71,24 +71,24 @@ backend convertUrBackend(ur_backend_t UrBackend) {
7171
}
7272

7373
platform make_platform(ur_native_handle_t NativeHandle, backend Backend) {
74-
const auto &Adapter = getAdapter(Backend);
74+
const adapter_impl &Adapter = getAdapter(Backend);
7575

7676
// Create UR platform first.
7777
ur_platform_handle_t UrPlatform = nullptr;
78-
Adapter->call<UrApiKind::urPlatformCreateWithNativeHandle>(
79-
NativeHandle, Adapter->getUrAdapter(), nullptr, &UrPlatform);
78+
Adapter.call<UrApiKind::urPlatformCreateWithNativeHandle>(
79+
NativeHandle, Adapter.getUrAdapter(), nullptr, &UrPlatform);
8080

8181
return detail::createSyclObjFromImpl<platform>(
8282
platform_impl::getOrMakePlatformImpl(UrPlatform, Adapter));
8383
}
8484

8585
__SYCL_EXPORT device make_device(ur_native_handle_t NativeHandle,
8686
backend Backend) {
87-
const auto &Adapter = getAdapter(Backend);
87+
const adapter_impl &Adapter = getAdapter(Backend);
8888

8989
ur_device_handle_t UrDevice = nullptr;
90-
Adapter->call<UrApiKind::urDeviceCreateWithNativeHandle>(
91-
NativeHandle, Adapter->getUrAdapter(), nullptr, &UrDevice);
90+
Adapter.call<UrApiKind::urDeviceCreateWithNativeHandle>(
91+
NativeHandle, Adapter.getUrAdapter(), nullptr, &UrDevice);
9292

9393
// Construct the SYCL device from UR device.
9494
return detail::createSyclObjFromImpl<device>(
@@ -100,7 +100,7 @@ __SYCL_EXPORT context make_context(ur_native_handle_t NativeHandle,
100100
const async_handler &Handler,
101101
backend Backend, bool KeepOwnership,
102102
const std::vector<device> &DeviceList) {
103-
const auto &Adapter = getAdapter(Backend);
103+
const adapter_impl &Adapter = getAdapter(Backend);
104104

105105
ur_context_handle_t UrContext = nullptr;
106106
ur_context_native_properties_t Properties{};
@@ -110,8 +110,8 @@ __SYCL_EXPORT context make_context(ur_native_handle_t NativeHandle,
110110
for (const auto &Dev : DeviceList) {
111111
DeviceHandles.push_back(detail::getSyclObjImpl(Dev)->getHandleRef());
112112
}
113-
Adapter->call<UrApiKind::urContextCreateWithNativeHandle>(
114-
NativeHandle, Adapter->getUrAdapter(), DeviceHandles.size(),
113+
Adapter.call<UrApiKind::urContextCreateWithNativeHandle>(
114+
NativeHandle, Adapter.getUrAdapter(), DeviceHandles.size(),
115115
DeviceHandles.data(), &Properties, &UrContext);
116116
// Construct the SYCL context from UR context.
117117
return detail::createSyclObjFromImpl<context>(context_impl::create(
@@ -125,7 +125,7 @@ __SYCL_EXPORT queue make_queue(ur_native_handle_t NativeHandle,
125125
const async_handler &Handler, backend Backend) {
126126
ur_device_handle_t UrDevice =
127127
Device ? getSyclObjImpl(*Device)->getHandleRef() : nullptr;
128-
const auto &Adapter = getAdapter(Backend);
128+
const adapter_impl &Adapter = getAdapter(Backend);
129129
context_impl &ContextImpl = *getSyclObjImpl(Context);
130130

131131
if (PropList.has_property<ext::intel::property::queue::compute_index>()) {
@@ -155,7 +155,7 @@ __SYCL_EXPORT queue make_queue(ur_native_handle_t NativeHandle,
155155
// Create UR queue first.
156156
ur_queue_handle_t UrQueue = nullptr;
157157

158-
Adapter->call<UrApiKind::urQueueCreateWithNativeHandle>(
158+
Adapter.call<UrApiKind::urQueueCreateWithNativeHandle>(
159159
NativeHandle, ContextImpl.getHandleRef(), UrDevice, &NativeProperties,
160160
&UrQueue);
161161
// Construct the SYCL queue from UR queue.
@@ -171,15 +171,15 @@ __SYCL_EXPORT event make_event(ur_native_handle_t NativeHandle,
171171
__SYCL_EXPORT event make_event(ur_native_handle_t NativeHandle,
172172
const context &Context, bool KeepOwnership,
173173
backend Backend) {
174-
const auto &Adapter = getAdapter(Backend);
174+
const adapter_impl &Adapter = getAdapter(Backend);
175175
const auto &ContextImpl = getSyclObjImpl(Context);
176176

177177
ur_event_handle_t UrEvent = nullptr;
178178
ur_event_native_properties_t Properties{};
179179
Properties.stype = UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES;
180180
Properties.isNativeHandleOwned = !KeepOwnership;
181181

182-
Adapter->call<UrApiKind::urEventCreateWithNativeHandle>(
182+
Adapter.call<UrApiKind::urEventCreateWithNativeHandle>(
183183
NativeHandle, ContextImpl->getHandleRef(), &Properties, &UrEvent);
184184
event Event = detail::createSyclObjFromImpl<event>(
185185
event_impl::create_from_handle(UrEvent, Context));
@@ -193,15 +193,15 @@ std::shared_ptr<detail::kernel_bundle_impl>
193193
make_kernel_bundle(ur_native_handle_t NativeHandle,
194194
const context &TargetContext, bool KeepOwnership,
195195
bundle_state State, backend Backend) {
196-
const auto &Adapter = getAdapter(Backend);
196+
const adapter_impl &Adapter = getAdapter(Backend);
197197
const auto &ContextImpl = getSyclObjImpl(TargetContext);
198198

199199
ur_program_handle_t UrProgram = nullptr;
200200
ur_program_native_properties_t Properties{};
201201
Properties.stype = UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES;
202202
Properties.isNativeHandleOwned = !KeepOwnership;
203203

204-
Adapter->call<UrApiKind::urProgramCreateWithNativeHandle>(
204+
Adapter.call<UrApiKind::urProgramCreateWithNativeHandle>(
205205
NativeHandle, ContextImpl->getHandleRef(), &Properties, &UrProgram);
206206
if (UrProgram == nullptr)
207207
throw sycl::exception(
@@ -214,39 +214,39 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
214214
std::vector<ur_device_handle_t> ProgramDevices;
215215
uint32_t NumDevices = 0;
216216

217-
Adapter->call<UrApiKind::urProgramGetInfo>(
217+
Adapter.call<UrApiKind::urProgramGetInfo>(
218218
UrProgram, UR_PROGRAM_INFO_NUM_DEVICES, sizeof(NumDevices), &NumDevices,
219219
nullptr);
220220
ProgramDevices.resize(NumDevices);
221-
Adapter->call<UrApiKind::urProgramGetInfo>(
221+
Adapter.call<UrApiKind::urProgramGetInfo>(
222222
UrProgram, UR_PROGRAM_INFO_DEVICES,
223223
sizeof(ur_device_handle_t) * NumDevices, ProgramDevices.data(), nullptr);
224224

225225
for (auto &Dev : ProgramDevices) {
226226
ur_program_binary_type_t BinaryType;
227-
Adapter->call<UrApiKind::urProgramGetBuildInfo>(
227+
Adapter.call<UrApiKind::urProgramGetBuildInfo>(
228228
UrProgram, Dev, UR_PROGRAM_BUILD_INFO_BINARY_TYPE,
229229
sizeof(ur_program_binary_type_t), &BinaryType, nullptr);
230230
switch (BinaryType) {
231231
case (UR_PROGRAM_BINARY_TYPE_NONE):
232232
if (State == bundle_state::object) {
233-
auto Res = Adapter->call_nocheck<UrApiKind::urProgramCompileExp>(
233+
auto Res = Adapter.call_nocheck<UrApiKind::urProgramCompileExp>(
234234
UrProgram, 1, &Dev, nullptr);
235235
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
236-
Res = Adapter->call_nocheck<UrApiKind::urProgramCompile>(
236+
Res = Adapter.call_nocheck<UrApiKind::urProgramCompile>(
237237
ContextImpl->getHandleRef(), UrProgram, nullptr);
238238
}
239-
Adapter->checkUrResult<errc::build>(Res);
239+
Adapter.checkUrResult<errc::build>(Res);
240240
}
241241

242242
else if (State == bundle_state::executable) {
243-
auto Res = Adapter->call_nocheck<UrApiKind::urProgramBuildExp>(
243+
auto Res = Adapter.call_nocheck<UrApiKind::urProgramBuildExp>(
244244
UrProgram, 1, &Dev, nullptr);
245245
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
246-
Res = Adapter->call_nocheck<UrApiKind::urProgramBuild>(
246+
Res = Adapter.call_nocheck<UrApiKind::urProgramBuild>(
247247
ContextImpl->getHandleRef(), UrProgram, nullptr);
248248
}
249-
Adapter->checkUrResult<errc::build>(Res);
249+
Adapter.checkUrResult<errc::build>(Res);
250250
}
251251

252252
break;
@@ -259,15 +259,15 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
259259
detail::codeToString(UR_RESULT_ERROR_INVALID_VALUE));
260260
if (State == bundle_state::executable) {
261261
ur_program_handle_t UrLinkedProgram = nullptr;
262-
auto Res = Adapter->call_nocheck<UrApiKind::urProgramLinkExp>(
262+
auto Res = Adapter.call_nocheck<UrApiKind::urProgramLinkExp>(
263263
ContextImpl->getHandleRef(), 1, &Dev, 1, &UrProgram, nullptr,
264264
&UrLinkedProgram);
265265
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
266-
Res = Adapter->call_nocheck<UrApiKind::urProgramLink>(
266+
Res = Adapter.call_nocheck<UrApiKind::urProgramLink>(
267267
ContextImpl->getHandleRef(), 1, &UrProgram, nullptr,
268268
&UrLinkedProgram);
269269
}
270-
Adapter->checkUrResult<errc::build>(Res);
270+
Adapter.checkUrResult<errc::build>(Res);
271271
if (UrLinkedProgram != nullptr) {
272272
UrProgram = UrLinkedProgram;
273273
}
@@ -351,7 +351,7 @@ kernel make_kernel(const context &TargetContext,
351351
ur_kernel_native_properties_t Properties{};
352352
Properties.stype = UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES;
353353
Properties.isNativeHandleOwned = !KeepOwnership;
354-
Adapter->call<UrApiKind::urKernelCreateWithNativeHandle>(
354+
Adapter.call<UrApiKind::urKernelCreateWithNativeHandle>(
355355
NativeHandle, ContextImpl->getHandleRef(), UrProgram, &Properties,
356356
&UrKernel);
357357

sycl/source/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ context::context(cl_context ClContext, async_handler AsyncHandler) {
8080
Adapter->call<detail::UrApiKind::urContextCreateWithNativeHandle>(
8181
nativeHandle, Adapter->getUrAdapter(), 0, nullptr, nullptr, &hContext);
8282

83-
impl = detail::context_impl::create(hContext, AsyncHandler, Adapter);
83+
impl = detail::context_impl::create(hContext, AsyncHandler, *Adapter);
8484
}
8585

8686
template <typename Param>

sycl/source/detail/adapter_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class adapter_impl {
107107
return UrPlatforms;
108108
}
109109

110-
ur_adapter_handle_t getUrAdapter() { return MAdapter; }
110+
ur_adapter_handle_t getUrAdapter() const { return MAdapter; }
111111

112112
/// Calls the UR Api, traces the call, and returns the result.
113113
///

sycl/source/detail/allowlist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void applyAllowList(std::vector<ur_device_handle_t> &UrDevices,
375375
// Get platform's backend and put it to DeviceDesc
376376
DeviceDescT DeviceDesc;
377377
platform_impl &PlatformImpl =
378-
platform_impl::getOrMakePlatformImpl(UrPlatform, Adapter);
378+
platform_impl::getOrMakePlatformImpl(UrPlatform, *Adapter);
379379
backend Backend = PlatformImpl.getBackend();
380380

381381
for (const auto &SyclBe : getSyclBeMap()) {

sycl/source/detail/context_impl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
6262

6363
context_impl::context_impl(ur_context_handle_t UrContext,
6464
async_handler AsyncHandler,
65-
const AdapterPtr &Adapter,
65+
const adapter_impl &Adapter,
6666
const std::vector<sycl::device> &DeviceList,
6767
bool OwnedByRuntime, private_tag)
6868
: MOwnedByRuntime(OwnedByRuntime), MAsyncHandler(AsyncHandler),
@@ -74,12 +74,12 @@ context_impl::context_impl(ur_context_handle_t UrContext,
7474
std::vector<ur_device_handle_t> DeviceIds;
7575
uint32_t DevicesNum = 0;
7676
// TODO catch an exception and put it to list of asynchronous exceptions
77-
Adapter->call<UrApiKind::urContextGetInfo>(
77+
Adapter.call<UrApiKind::urContextGetInfo>(
7878
MContext, UR_CONTEXT_INFO_NUM_DEVICES, sizeof(DevicesNum), &DevicesNum,
7979
nullptr);
8080
DeviceIds.resize(DevicesNum);
8181
// TODO catch an exception and put it to list of asynchronous exceptions
82-
Adapter->call<UrApiKind::urContextGetInfo>(
82+
Adapter.call<UrApiKind::urContextGetInfo>(
8383
MContext, UR_CONTEXT_INFO_DEVICES,
8484
sizeof(ur_device_handle_t) * DevicesNum, &DeviceIds[0], nullptr);
8585

sycl/source/detail/context_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ class context_impl : public std::enable_shared_from_this<context_impl> {
6262
/// \param OwnedByRuntime is the flag if ownership is kept by user or
6363
/// transferred to runtime
6464
context_impl(ur_context_handle_t UrContext, async_handler AsyncHandler,
65-
const AdapterPtr &Adapter,
65+
const adapter_impl &Adapter,
6666
const std::vector<sycl::device> &DeviceList, bool OwnedByRuntime,
6767
private_tag);
6868

6969
context_impl(ur_context_handle_t UrContext, async_handler AsyncHandler,
70-
const AdapterPtr &Adapter, private_tag tag)
70+
const adapter_impl &Adapter, private_tag tag)
7171
: context_impl(UrContext, AsyncHandler, Adapter,
7272
std::vector<sycl::device>{},
7373
/*OwnedByRuntime*/ true, tag) {}

sycl/source/detail/device_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
724724
CASE(info::device::platform) {
725725
return createSyclObjFromImpl<platform>(
726726
platform_impl::getOrMakePlatformImpl(
727-
get_info_impl<UR_DEVICE_INFO_PLATFORM>(), getAdapter()));
727+
get_info_impl<UR_DEVICE_INFO_PLATFORM>(), *getAdapter()));
728728
}
729729

730730
CASE(info::device::profile) {

sycl/source/detail/platform_impl.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace detail {
3232

3333
platform_impl &
3434
platform_impl::getOrMakePlatformImpl(ur_platform_handle_t UrPlatform,
35-
const AdapterPtr &Adapter) {
35+
const adapter_impl &Adapter) {
3636
std::shared_ptr<platform_impl> Result;
3737
{
3838
const std::lock_guard<std::mutex> Guard(
@@ -50,8 +50,8 @@ platform_impl::getOrMakePlatformImpl(ur_platform_handle_t UrPlatform,
5050
// Otherwise make the impl. Our ctor/dtor are private, so std::make_shared
5151
// needs a bit of help...
5252
struct creator : platform_impl {
53-
creator(ur_platform_handle_t APlatform, const AdapterPtr &AAdapter)
54-
: platform_impl(APlatform, AAdapter) {}
53+
creator(ur_platform_handle_t APlatform, const adapter_impl &AAdapter)
54+
: platform_impl(APlatform, &AAdapter) {}
5555
};
5656
Result = std::make_shared<creator>(UrPlatform, Adapter);
5757
PlatformCache.emplace_back(Result);
@@ -62,12 +62,12 @@ platform_impl::getOrMakePlatformImpl(ur_platform_handle_t UrPlatform,
6262

6363
platform_impl &
6464
platform_impl::getPlatformFromUrDevice(ur_device_handle_t UrDevice,
65-
const AdapterPtr &Adapter) {
65+
const adapter_impl &Adapter) {
6666
ur_platform_handle_t Plt =
6767
nullptr; // TODO catch an exception and put it to list
6868
// of asynchronous exceptions
69-
Adapter->call<UrApiKind::urDeviceGetInfo>(UrDevice, UR_DEVICE_INFO_PLATFORM,
70-
sizeof(Plt), &Plt, nullptr);
69+
Adapter.call<UrApiKind::urDeviceGetInfo>(UrDevice, UR_DEVICE_INFO_PLATFORM,
70+
sizeof(Plt), &Plt, nullptr);
7171
return getOrMakePlatformImpl(Plt, Adapter);
7272
}
7373

@@ -131,7 +131,7 @@ std::vector<platform> platform_impl::getAdapterPlatforms(AdapterPtr &Adapter,
131131

132132
for (const auto &UrPlatform : UrPlatforms) {
133133
platform Platform = detail::createSyclObjFromImpl<platform>(
134-
getOrMakePlatformImpl(UrPlatform, Adapter));
134+
getOrMakePlatformImpl(UrPlatform, *Adapter));
135135
const bool IsBanned = IsBannedPlatform(Platform);
136136
bool HasAnyDevices = false;
137137

@@ -543,7 +543,7 @@ platform_impl::get_devices(info::device_type DeviceType) const {
543543

544544
// The next step is to inflate the filtered UrDevices into SYCL Device
545545
// objects.
546-
platform_impl &PlatformImpl = getOrMakePlatformImpl(MPlatform, MAdapter);
546+
platform_impl &PlatformImpl = getOrMakePlatformImpl(MPlatform, *MAdapter);
547547
std::transform(UrDevices.begin(), UrDevices.end(), std::back_inserter(Res),
548548
[&PlatformImpl](const ur_device_handle_t UrDevice) -> device {
549549
return detail::createSyclObjFromImpl<device>(

sycl/source/detail/platform_impl.hpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ class platform_impl : public std::enable_shared_from_this<platform_impl> {
3939
//
4040
// Platforms can only be created under `GlobalHandler`'s ownership via
4141
// `platform_impl::getOrMakePlatformImpl` method.
42-
explicit platform_impl(ur_platform_handle_t APlatform, adapter_impl *AAdapter)
43-
: MPlatform(APlatform), MAdapter(AAdapter) {
42+
explicit platform_impl(ur_platform_handle_t APlatform,
43+
const adapter_impl *AAdapter)
44+
: MPlatform(APlatform) {
45+
46+
MAdapter = const_cast<AdapterPtr>(AAdapter);
47+
4448
// Find out backend of the platform
4549
ur_backend_t UrBackend = UR_BACKEND_UNKNOWN;
4650
AAdapter->call_nocheck<UrApiKind::urPlatformGetInfo>(
@@ -137,15 +141,6 @@ class platform_impl : public std::enable_shared_from_this<platform_impl> {
137141
// \return the Adapter associated with this platform.
138142
const AdapterPtr &getAdapter() const { return MAdapter; }
139143

140-
/// Sets the platform implementation to use another adapter.
141-
///
142-
/// \param AdapterPtr is a pointer to a adapter instance
143-
/// \param Backend is the backend that we want this platform to use
144-
void setAdapter(AdapterPtr &AdapterPtr, backend Backend) {
145-
MAdapter = AdapterPtr;
146-
MBackend = Backend;
147-
}
148-
149144
/// Gets the native handle of the SYCL platform.
150145
///
151146
/// \return a native handle.
@@ -188,7 +183,7 @@ class platform_impl : public std::enable_shared_from_this<platform_impl> {
188183
/// \param Adapter is the UR adapter providing the backend for the platform
189184
/// \return the platform_impl representing the UR platform
190185
static platform_impl &getOrMakePlatformImpl(ur_platform_handle_t UrPlatform,
191-
const AdapterPtr &Adapter);
186+
const adapter_impl &Adapter);
192187

193188
/// Queries the cache for the specified platform based on an input device.
194189
/// If found, returns the the cached platform_impl, otherwise creates a new
@@ -200,7 +195,7 @@ class platform_impl : public std::enable_shared_from_this<platform_impl> {
200195
/// platform
201196
/// \return the platform_impl that contains the input device
202197
static platform_impl &getPlatformFromUrDevice(ur_device_handle_t UrDevice,
203-
const AdapterPtr &Adapter);
198+
const adapter_impl &Adapter);
204199

205200
context_impl &khr_get_default_context();
206201

sycl/source/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ device::device(cl_device_id DeviceId) {
4040
Adapter->call<detail::UrApiKind::urDeviceCreateWithNativeHandle>(
4141
detail::ur::cast<ur_native_handle_t>(DeviceId), Adapter->getUrAdapter(),
4242
nullptr, &Device);
43-
impl = detail::platform_impl::getPlatformFromUrDevice(Device, Adapter)
43+
impl = detail::platform_impl::getPlatformFromUrDevice(Device, *Adapter)
4444
.getOrMakeDeviceImpl(Device)
4545
.shared_from_this();
4646
__SYCL_OCL_CALL(clRetainDevice, DeviceId);

sycl/source/platform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ platform::platform(cl_platform_id PlatformId) {
3030
Adapter->call<detail::UrApiKind::urPlatformCreateWithNativeHandle>(
3131
detail::ur::cast<ur_native_handle_t>(PlatformId), Adapter->getUrAdapter(),
3232
/* pProperties = */ nullptr, &UrPlatform);
33-
impl = detail::platform_impl::getOrMakePlatformImpl(UrPlatform, Adapter)
33+
impl = detail::platform_impl::getOrMakePlatformImpl(UrPlatform, *Adapter)
3434
.shared_from_this();
3535
}
3636

0 commit comments

Comments
 (0)