-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Remove deprecated interop interfaces #13306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aelovikov-intel
merged 1 commit into
intel:sycl
from
aelovikov-intel:remove-deprecated-interop
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -41,88 +41,27 @@ | |||||||
|
||||||||
namespace sycl { | ||||||||
inline namespace _V1 { | ||||||||
namespace ext::oneapi::level_zero { | ||||||||
// Implementation of various "make" functions resides in libsycl.so and thus | ||||||||
// their interface needs to be backend agnostic. | ||||||||
// TODO: remove/merge with similar functions in sycl::detail | ||||||||
__SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle); | ||||||||
namespace ext::oneapi::level_zero::detail { | ||||||||
__SYCL_EXPORT device make_device(const platform &Platform, | ||||||||
pi_native_handle NativeHandle); | ||||||||
__SYCL_EXPORT context make_context(const std::vector<device> &DeviceList, | ||||||||
pi_native_handle NativeHandle, | ||||||||
bool keep_ownership = false); | ||||||||
__SYCL_EXPORT queue make_queue(const context &Context, const device &Device, | ||||||||
pi_native_handle InteropHandle, | ||||||||
bool IsImmCmdList, bool keep_ownership, | ||||||||
const property_list &Properties); | ||||||||
__SYCL_EXPORT event make_event(const context &Context, | ||||||||
pi_native_handle InteropHandle, | ||||||||
bool keep_ownership = false); | ||||||||
|
||||||||
// Construction of SYCL platform. | ||||||||
template <typename T, | ||||||||
typename std::enable_if_t<std::is_same_v<T, platform>> * = nullptr> | ||||||||
__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_platform free function") | ||||||||
T make(typename sycl::detail::interop<backend::ext_oneapi_level_zero, T>::type | ||||||||
Interop) { | ||||||||
return make_platform(reinterpret_cast<pi_native_handle>(Interop)); | ||||||||
} | ||||||||
|
||||||||
// Construction of SYCL device. | ||||||||
template <typename T, | ||||||||
typename std::enable_if_t<std::is_same_v<T, device>> * = nullptr> | ||||||||
__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_device free function") | ||||||||
T make(const platform &Platform, | ||||||||
typename sycl::detail::interop<backend::ext_oneapi_level_zero, T>::type | ||||||||
Interop) { | ||||||||
return make_device(Platform, reinterpret_cast<pi_native_handle>(Interop)); | ||||||||
} | ||||||||
|
||||||||
/// Construction of SYCL context. | ||||||||
/// \param DeviceList is a vector of devices which must be encapsulated by | ||||||||
/// created SYCL context. Provided devices and native context handle must | ||||||||
/// be associated with the same platform. | ||||||||
/// \param Interop is a Level Zero native context handle. | ||||||||
/// \param Ownership (optional) specifies who will assume ownership of the | ||||||||
/// native context handle. Default is that SYCL RT does, so it destroys | ||||||||
/// the native handle when the created SYCL object goes out of life. | ||||||||
/// | ||||||||
template <typename T, std::enable_if_t<std::is_same_v<T, context>> * = nullptr> | ||||||||
__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_context free function") | ||||||||
T make(const std::vector<device> &DeviceList, | ||||||||
typename sycl::detail::interop<backend::ext_oneapi_level_zero, T>::type | ||||||||
Interop, | ||||||||
ownership Ownership = ownership::transfer) { | ||||||||
return make_context(DeviceList, | ||||||||
sycl::detail::pi::cast<pi_native_handle>(Interop), | ||||||||
Ownership == ownership::keep); | ||||||||
} | ||||||||
|
||||||||
// Construction of SYCL event. | ||||||||
template <typename T, | ||||||||
typename std::enable_if_t<std::is_same_v<T, event>> * = nullptr> | ||||||||
__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_event free function") | ||||||||
T make(const context &Context, | ||||||||
typename sycl::detail::interop<backend::ext_oneapi_level_zero, T>::type | ||||||||
Interop, | ||||||||
ownership Ownership = ownership::transfer) { | ||||||||
return make_event(Context, reinterpret_cast<pi_native_handle>(Interop), | ||||||||
Ownership == ownership::keep); | ||||||||
} | ||||||||
|
||||||||
} // namespace ext::oneapi::level_zero | ||||||||
} // namespace ext::oneapi::level_zero::detail | ||||||||
|
||||||||
// Specialization of sycl::make_context for Level-Zero backend. | ||||||||
template <> | ||||||||
inline context make_context<backend::ext_oneapi_level_zero>( | ||||||||
const backend_input_t<backend::ext_oneapi_level_zero, context> | ||||||||
&BackendObject, | ||||||||
const async_handler &Handler) { | ||||||||
(void)Handler; | ||||||||
return ext::oneapi::level_zero::make_context( | ||||||||
BackendObject.DeviceList, | ||||||||
detail::pi::cast<pi_native_handle>(BackendObject.NativeHandle), | ||||||||
BackendObject.Ownership == ext::oneapi::level_zero::ownership::keep); | ||||||||
|
||||||||
const std::vector<device> &DeviceList = BackendObject.DeviceList; | ||||||||
pi_native_handle NativeHandle = | ||||||||
detail::pi::cast<pi_native_handle>(BackendObject.NativeHandle); | ||||||||
bool KeepOwnership = | ||||||||
BackendObject.Ownership == ext::oneapi::level_zero::ownership::keep; | ||||||||
|
||||||||
return sycl::detail::make_context(NativeHandle, Handler, | ||||||||
backend::ext_oneapi_level_zero, | ||||||||
KeepOwnership, DeviceList); | ||||||||
} | ||||||||
|
||||||||
namespace detail { | ||||||||
|
@@ -191,7 +130,6 @@ template <> | |||||||
inline queue make_queue<backend::ext_oneapi_level_zero>( | ||||||||
const backend_input_t<backend::ext_oneapi_level_zero, queue> &BackendObject, | ||||||||
const context &TargetContext, const async_handler Handler) { | ||||||||
(void)Handler; | ||||||||
const device Device = device{BackendObject.Device}; | ||||||||
bool IsImmCmdList = std::holds_alternative<ze_command_list_handle_t>( | ||||||||
BackendObject.NativeHandle); | ||||||||
|
@@ -202,10 +140,11 @@ inline queue make_queue<backend::ext_oneapi_level_zero>( | |||||||
: reinterpret_cast<pi_native_handle>( | ||||||||
*(std::get_if<ze_command_queue_handle_t>( | ||||||||
&BackendObject.NativeHandle))); | ||||||||
return ext::oneapi::level_zero::make_queue( | ||||||||
TargetContext, Device, Handle, IsImmCmdList, | ||||||||
|
||||||||
return sycl::detail::make_queue( | ||||||||
Handle, IsImmCmdList, TargetContext, &Device, | ||||||||
BackendObject.Ownership == ext::oneapi::level_zero::ownership::keep, | ||||||||
BackendObject.Properties); | ||||||||
BackendObject.Properties, Handler, backend::ext_oneapi_level_zero); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before this change, we were using llvm/sycl/source/backend/level_zero.cpp Lines 70 to 72 in 3ea29b2
Handler , although I'm not sure about the consequences of that change. Regardless, using provided Handler instead of doing something completely different looks like a right thing to do for this interface.
|
||||||||
} | ||||||||
|
||||||||
// Specialization of sycl::get_native for Level-Zero backend. | ||||||||
|
@@ -227,10 +166,11 @@ template <> | |||||||
inline event make_event<backend::ext_oneapi_level_zero>( | ||||||||
const backend_input_t<backend::ext_oneapi_level_zero, event> &BackendObject, | ||||||||
const context &TargetContext) { | ||||||||
return ext::oneapi::level_zero::make_event( | ||||||||
TargetContext, | ||||||||
return sycl::detail::make_event( | ||||||||
detail::pi::cast<pi_native_handle>(BackendObject.NativeHandle), | ||||||||
BackendObject.Ownership == ext::oneapi::level_zero::ownership::keep); | ||||||||
TargetContext, | ||||||||
BackendObject.Ownership == ext::oneapi::level_zero::ownership::keep, | ||||||||
backend::ext_oneapi_level_zero); | ||||||||
} | ||||||||
|
||||||||
// Specialization of sycl::make_kernel_bundle for Level-Zero backend. | ||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously
Handler
was ignored - seellvm/sycl/source/backend/level_zero.cpp
Lines 58 to 60 in 3ea29b2
defaultAsyncHandler
.