Skip to content

[SYCL] Change return of get_native for opencl backend to vector #4952

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
merged 17 commits into from
Jan 26, 2022

Conversation

denis-kabanov
Copy link
Contributor

Change return of get_nativesycl::backend::opencl(event) from cl_event to vector<cl_event>

Change return of get_native<sycl::backend::opencl>(event) from cl_event to vector<cl_event>
@denis-kabanov denis-kabanov requested a review from a team as a code owner November 12, 2021 11:04
Comment on lines 135 to 152
detail::enable_if_t<(BackendName != backend::opencl),
typename interop<BackendName, event>::type> get_native()
const {
return reinterpret_cast<typename interop<BackendName, event>::type>(
getNative());
}
///
template <backend BackendName>
detail::enable_if_t<(BackendName == backend::opencl), std::vector<cl_event>>
get_native() const {
backend_return_t<BackendName, event> ReturnValue;
for (auto const &element : getNativeVector()) {
ReturnValue.push_back(
reinterpret_cast<typename interop<BackendName, event>::value_type>(
element));
}
return ReturnValue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this function at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to SYCL 2020 specification (revision 3) get_nativesycl::backend::opencl(event) should return vector<cl_event>, whereas for others backends it is not specified. Because C++14 has no "if constexpr", I chose to change SFINAE.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event::get_native is deprecated. We should not change it in any way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this moment, sycl::get_native free function calls a deprecated function with backend=opencl, so to change the free function we need to work with deprecated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Alex is right - I'm not even sure where this public function event::get_native() came from.

Regardless, since it's an existing function with different behavior, we should leave it as-is to avoid the breaking change.

I think we need to change the impl of our free function to not use this deprecated method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbrodman is it ok that with any changes API will break, because backend_return_t for opencl event will return std::vector<cl_event> instead of cl_event?

@denis-kabanov denis-kabanov marked this pull request as draft November 12, 2021 12:47
Copy link
Contributor

@pvchupin pvchupin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like breaking change. We should hold this until discuss options.

alexbatashev
alexbatashev previously approved these changes Dec 23, 2021
Copy link
Contributor

@alexbatashev alexbatashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

alexbatashev
alexbatashev previously approved these changes Dec 23, 2021
@denis-kabanov
Copy link
Contributor Author

/verify with intel/llvm-test-suite#682

@denis-kabanov
Copy link
Contributor Author

buildbot/Lit_With_Cuda crash is a known issue (report exists).

alexbatashev
alexbatashev previously approved these changes Jan 13, 2022
@s-kanaev
Copy link
Contributor

@pvchupin , a friendly ping

@pvchupin
Copy link
Contributor

Please update PreprocessorMacros.md

@denis-kabanov
Copy link
Contributor Author

@pvchupin, @intel/llvm-reviewers-runtime, can review this pull request?

Copy link
Contributor

@pvchupin pvchupin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc ok

@bader bader requested a review from alexbatashev January 26, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants