Skip to content

Commit 26b7762

Browse files
authored
[SYCL][ABI-Break] Remove deprecated OptionalDevice input type of make_queue and remove deprecated make_queue ABIs (#6628)
We introduced a tentative OptionalDevice input type of make_queue API to support the SYCL 2020 API as well as the legacy API which did not require Device to be passed as a parameter. This PR intends to remove this tentative input type. Extended: Now this PR also removed deprecated make_queue ABIs and make the make_queue to take a pointer to pi_device, which becomes back to optional. Signed-off-by: Byoungro So <byoungro.so@intel.com>
1 parent 77dd693 commit 26b7762

File tree

10 files changed

+20
-90
lines changed

10 files changed

+20
-90
lines changed

sycl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ set(SYCL_MINOR_VERSION 7)
3030
set(SYCL_PATCH_VERSION 0)
3131
# Don't forget to re-enable sycl_symbols_windows.dump once we leave ABI-breaking
3232
# window!
33-
set(SYCL_DEV_ABI_VERSION 14)
33+
set(SYCL_DEV_ABI_VERSION 15)
3434
if (SYCL_ADD_DEV_VERSION_POSTFIX)
3535
set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}")
3636
endif()

sycl/include/sycl/backend.hpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,7 @@ __SYCL_EXPORT context make_context(pi_native_handle NativeHandle,
208208
backend Backend);
209209
__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle,
210210
const context &TargetContext,
211-
const device &TargetDevice, bool KeepOwnership,
212-
const async_handler &Handler, backend Backend);
213-
// TODO: Unused. Remove when allowed.
214-
__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle,
215-
const context &TargetContext, bool KeepOwnership,
216-
const async_handler &Handler, backend Backend);
217-
__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle,
218-
const context &TargetContext,
211+
const device *TargetDevice, bool KeepOwnership,
219212
const async_handler &Handler, backend Backend);
220213
__SYCL_EXPORT event make_event(pi_native_handle NativeHandle,
221214
const context &TargetContext, backend Backend);
@@ -270,27 +263,14 @@ make_context(
270263
Handler, Backend);
271264
}
272265

273-
template <backend Backend>
274-
__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_queue free function")
275-
typename std::enable_if<
276-
detail::InteropFeatureSupportMap<Backend>::MakeQueue == true, queue>::type
277-
make_queue(
278-
const typename backend_traits<Backend>::template input_type<queue>
279-
&BackendObject,
280-
const context &TargetContext, bool KeepOwnership,
281-
const async_handler Handler = {}) {
282-
return detail::make_queue(detail::pi::cast<pi_native_handle>(BackendObject),
283-
TargetContext, KeepOwnership, Handler, Backend);
284-
}
285-
286266
template <backend Backend>
287267
typename std::enable_if<
288268
detail::InteropFeatureSupportMap<Backend>::MakeQueue == true, queue>::type
289269
make_queue(const typename backend_traits<Backend>::template input_type<queue>
290270
&BackendObject,
291271
const context &TargetContext, const async_handler Handler = {}) {
292272
return detail::make_queue(detail::pi::cast<pi_native_handle>(BackendObject),
293-
TargetContext, false, Handler, Backend);
273+
TargetContext, nullptr, false, Handler, Backend);
294274
}
295275

296276
template <backend Backend>

sycl/include/sycl/detail/backend_traits_level_zero.hpp

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -128,45 +128,12 @@ template <> struct BackendReturn<backend::ext_oneapi_level_zero, event> {
128128
using type = ze_event_handle_t;
129129
};
130130

131-
struct OptionalDevice {
132-
OptionalDevice() : DeviceImpl(nullptr) {}
133-
OptionalDevice(device dev) : DeviceImpl(getSyclObjImpl(dev)) {}
134-
135-
operator device() const {
136-
if (!DeviceImpl)
137-
throw runtime_error("No device has been set.", PI_ERROR_INVALID_DEVICE);
138-
return createSyclObjFromImpl<device>(DeviceImpl);
139-
}
140-
141-
OptionalDevice &operator=(OptionalDevice &Other) {
142-
DeviceImpl = Other.DeviceImpl;
143-
return *this;
144-
}
145-
OptionalDevice &operator=(device &Other) {
146-
DeviceImpl = getSyclObjImpl(Other);
147-
return *this;
148-
}
149-
150-
private:
151-
std::shared_ptr<device_impl> DeviceImpl;
152-
153-
friend bool OptionalDeviceHasDevice(const OptionalDevice &Dev);
154-
};
155-
156-
// Inspector function in the detail namespace to avoid exposing
157-
// OptionalDevice::hasDevice to user-space.
158-
inline bool OptionalDeviceHasDevice(const OptionalDevice &Dev) {
159-
return Dev.DeviceImpl != nullptr;
160-
}
161-
162131
template <> struct BackendInput<backend::ext_oneapi_level_zero, queue> {
163132
struct type {
164133
interop<backend::ext_oneapi_level_zero, queue>::type NativeHandle;
165134
ext::oneapi::level_zero::ownership Ownership;
166135

167-
// TODO: Change this to be device when the deprecated constructor is
168-
// removed.
169-
OptionalDevice Device;
136+
device Device;
170137

171138
type()
172139
: Ownership(ext::oneapi::level_zero::ownership::transfer), Device() {}

sycl/include/sycl/ext/oneapi/backend/level_zero.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ inline queue make_queue<backend::ext_oneapi_level_zero>(
123123
const backend_input_t<backend::ext_oneapi_level_zero, queue> &BackendObject,
124124
const context &TargetContext, const async_handler Handler) {
125125
(void)Handler;
126-
const device Device = detail::OptionalDeviceHasDevice(BackendObject.Device)
127-
? device{BackendObject.Device}
128-
: TargetContext.get_devices()[0];
126+
const device Device = device{BackendObject.Device};
129127
return ext::oneapi::level_zero::make_queue(
130128
TargetContext, Device,
131129
detail::pi::cast<pi_native_handle>(BackendObject.NativeHandle),

sycl/include/sycl/ext/oneapi/experimental/backend/cuda.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ inline queue make_queue<backend::ext_oneapi_cuda>(
8989
const backend_input_t<backend::ext_oneapi_cuda, queue> &BackendObject,
9090
const context &TargetContext, const async_handler Handler) {
9191
return detail::make_queue(detail::pi::cast<pi_native_handle>(BackendObject),
92-
TargetContext, true, Handler,
92+
TargetContext, nullptr, true, Handler,
9393
/*Backend*/ backend::ext_oneapi_cuda);
9494
}
9595

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,16 +3811,12 @@ pi_result piextQueueCreateWithNativeHandle(pi_native_handle NativeHandle,
38113811
PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
38123812
PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
38133813
PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3814+
PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
38143815

38153816
auto ZeQueue = pi_cast<ze_command_queue_handle_t>(NativeHandle);
38163817
// Assume this is the "0" index queue in the compute command-group.
38173818
std::vector<ze_command_queue_handle_t> ZeQueues{ZeQueue};
38183819

3819-
// For compatibility with older implementations we allow the device to be
3820-
// optional for now. Once the deprecated interop API is removed this can be
3821-
// changed to an assert(Device).
3822-
if (!Device)
3823-
Device = Context->Devices[0];
38243820
// TODO: see what we can do to correctly initialize PI queue for
38253821
// compute vs. copy Level-Zero queue. Currently we will send
38263822
// all commands to the "ZeQueue".

sycl/source/backend.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,17 @@ queue make_queue_impl(pi_native_handle NativeHandle, const context &Context,
9696
}
9797

9898
__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle,
99-
const context &Context,
100-
const async_handler &Handler, backend Backend) {
101-
return make_queue_impl(NativeHandle, Context, nullptr, false, Handler,
102-
Backend);
103-
}
104-
105-
__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle,
106-
const context &Context, bool KeepOwnership,
107-
const async_handler &Handler, backend Backend) {
108-
return make_queue_impl(NativeHandle, Context, nullptr, KeepOwnership, Handler,
109-
Backend);
110-
}
111-
112-
__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle,
113-
const context &Context, const device &Device,
99+
const context &Context, const device *Device,
114100
bool KeepOwnership, const async_handler &Handler,
115101
backend Backend) {
116-
const auto &DeviceImpl = getSyclObjImpl(Device);
117-
return make_queue_impl(NativeHandle, Context, DeviceImpl->getHandleRef(),
118-
KeepOwnership, Handler, Backend);
102+
if (Device) {
103+
const auto &DeviceImpl = getSyclObjImpl(*Device);
104+
return make_queue_impl(NativeHandle, Context, DeviceImpl->getHandleRef(),
105+
KeepOwnership, Handler, Backend);
106+
} else {
107+
return make_queue_impl(NativeHandle, Context, nullptr, KeepOwnership,
108+
Handler, Backend);
109+
}
119110
}
120111

121112
__SYCL_EXPORT event make_event(pi_native_handle NativeHandle,

sycl/source/backend/level_zero.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ __SYCL_EXPORT queue make_queue(const context &Context,
6767
pi_native_handle NativeHandle,
6868
bool KeepOwnership) {
6969
const auto &ContextImpl = getSyclObjImpl(Context);
70-
return detail::make_queue(NativeHandle, Context, KeepOwnership,
70+
return detail::make_queue(NativeHandle, Context, nullptr, KeepOwnership,
7171
ContextImpl->get_async_handler(),
7272
backend::ext_oneapi_level_zero);
7373
}
@@ -76,7 +76,7 @@ __SYCL_EXPORT queue make_queue(const context &Context, const device &Device,
7676
pi_native_handle NativeHandle,
7777
bool KeepOwnership) {
7878
const auto &ContextImpl = getSyclObjImpl(Context);
79-
return detail::make_queue(NativeHandle, Context, Device, KeepOwnership,
79+
return detail::make_queue(NativeHandle, Context, &Device, KeepOwnership,
8080
ContextImpl->get_async_handler(),
8181
backend::ext_oneapi_level_zero);
8282
}

sycl/source/backend/opencl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ __SYCL_EXPORT context make_context(pi_native_handle NativeHandle) {
4141
__SYCL_EXPORT queue make_queue(const context &Context,
4242
pi_native_handle NativeHandle) {
4343
const auto &ContextImpl = getSyclObjImpl(Context);
44-
return detail::make_queue(NativeHandle, Context, false,
44+
return detail::make_queue(NativeHandle, Context, nullptr, false,
4545
ContextImpl->get_async_handler(), backend::opencl);
4646
}
4747
} // namespace opencl

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3716,9 +3716,7 @@ _ZN4sycl3_V16detail10image_implC1EP7_cl_memRKNS0_7contextENS0_5eventESt10unique_
37163716
_ZN4sycl3_V16detail10image_implC2EP7_cl_memRKNS0_7contextENS0_5eventESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISA_EEh
37173717
_ZN4sycl3_V16detail10make_eventEmRKNS0_7contextENS0_7backendE
37183718
_ZN4sycl3_V16detail10make_eventEmRKNS0_7contextEbNS0_7backendE
3719-
_ZN4sycl3_V16detail10make_queueEmRKNS0_7contextERKNS0_6deviceEbRKSt8functionIFvNS0_14exception_listEEENS0_7backendE
3720-
_ZN4sycl3_V16detail10make_queueEmRKNS0_7contextERKSt8functionIFvNS0_14exception_listEEENS0_7backendE
3721-
_ZN4sycl3_V16detail10make_queueEmRKNS0_7contextEbRKSt8functionIFvNS0_14exception_listEEENS0_7backendE
3719+
_ZN4sycl3_V16detail10make_queueEmRKNS0_7contextEPKNS0_6deviceEbRKSt8functionIFvNS0_14exception_listEEENS0_7backendE
37223720
_ZN4sycl3_V16detail10waitEventsESt6vectorINS0_5eventESaIS3_EE
37233721
_ZN4sycl3_V16detail11SYCLMemObjT10releaseMemESt10shared_ptrINS1_12context_implEEPv
37243722
_ZN4sycl3_V16detail11SYCLMemObjT16determineHostPtrERKSt10shared_ptrINS1_12context_implEEbRPvRb

0 commit comments

Comments
 (0)