Skip to content

[SYCL] logical revert of the patch: "Fix get() method for non-opencl backends" #3356

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 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ context_impl::context_impl(RT::PiContext PiContext, async_handler AsyncHandler,
}

cl_context context_impl::get() const {
if (MHostContext || getPlugin().getBackend() != cl::sycl::backend::opencl) {
if (MHostContext) {
throw invalid_object_error(
"This instance of context doesn't support OpenCL interoperability.",
PI_INVALID_CONTEXT);
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool device_impl::is_affinity_supported(
}

cl_device_id device_impl::get() const {
if (MIsHostDevice || getPlugin().getBackend() != cl::sycl::backend::opencl) {
if (MIsHostDevice) {
throw invalid_object_error(
"This instance of device doesn't support OpenCL interoperability.",
PI_INVALID_DEVICE);
Expand Down
3 changes: 1 addition & 2 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ extern xpti::trace_event_data_t *GSYCLGraphEvent;
bool event_impl::is_host() const { return MHostEvent || !MOpenCLInterop; }

cl_event event_impl::get() const {
if (!MOpenCLInterop ||
getPlugin().getBackend() != cl::sycl::backend::opencl) {
if (!MOpenCLInterop) {
throw invalid_object_error(
"This instance of event doesn't support OpenCL interoperability.",
PI_INVALID_EVENT);
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/kernel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class kernel_impl {
///
/// \return a valid cl_kernel instance
cl_kernel get() const {
if (is_host() || getPlugin().getBackend() != cl::sycl::backend::opencl) {
if (is_host()) {
throw invalid_object_error(
"This instance of kernel doesn't support OpenCL interoperability.",
PI_INVALID_KERNEL);
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/platform_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class platform_impl {

/// \return an instance of OpenCL cl_platform_id.
cl_platform_id get() const {
if (is_host() || getPlugin().getBackend() != cl::sycl::backend::opencl) {
if (is_host()) {
throw invalid_object_error(
"This instance of platform doesn't support OpenCL interoperability.",
PI_INVALID_PLATFORM);
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/program_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ program_impl::~program_impl() {

cl_program program_impl::get() const {
throw_if_state_is(program_state::none);
if (is_host() || getPlugin().getBackend() != cl::sycl::backend::opencl) {
if (is_host()) {
throw invalid_object_error(
"This instance of program doesn't support OpenCL interoperability.",
PI_INVALID_PROGRAM);
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class queue_impl {

/// \return an OpenCL interoperability queue handle.
cl_command_queue get() {
if (MHostQueue || getPlugin().getBackend() != cl::sycl::backend::opencl) {
if (MHostQueue) {
throw invalid_object_error(
"This instance of queue doesn't support OpenCL interoperability",
PI_INVALID_QUEUE);
Expand Down