Skip to content

[SYCL] Follow-up for #7599 - return PI_ERROR_INVALID_VALUE after assert #7764

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
Dec 13, 2022
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
4 changes: 4 additions & 0 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2534,9 +2534,13 @@ pi_result cuda_piextQueueCreate(pi_context Context, pi_device Device,
assert(Properties);
// Expect flags mask to be passed first.
assert(Properties[0] == PI_QUEUE_FLAGS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to keep these asserts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've seen the same pattern in another place in one of those. Also, I'd rather have it abort in debug to speed up any potential analysis.

if (Properties[0] != PI_QUEUE_FLAGS)
return PI_ERROR_INVALID_VALUE;
pi_queue_properties Flags = Properties[1];
// Extra data isn't supported yet.
assert(Properties[2] == 0);
if (Properties[2] != 0)
return PI_ERROR_INVALID_VALUE;
return cuda_piQueueCreate(Context, Device, Flags, Queue);
}

Expand Down
4 changes: 4 additions & 0 deletions sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,9 +930,13 @@ pi_result piextQueueCreate(pi_context Context, pi_device Device,
assert(Properties);
// Expect flags mask to be passed first.
assert(Properties[0] == PI_QUEUE_FLAGS);
if (Properties[0] != PI_QUEUE_FLAGS)
return PI_ERROR_INVALID_VALUE;
pi_queue_properties Flags = Properties[1];
// Extra data isn't supported yet.
assert(Properties[2] == 0);
if (Properties[2] != 0)
return PI_ERROR_INVALID_VALUE;
return piQueueCreate(Context, Device, Flags, Queue);
}
pi_result piQueueCreate(pi_context Context, pi_device Device,
Expand Down
4 changes: 4 additions & 0 deletions sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2411,9 +2411,13 @@ pi_result hip_piextQueueCreate(pi_context Context, pi_device Device,
assert(Properties);
// Expect flags mask to be passed first.
assert(Properties[0] == PI_QUEUE_FLAGS);
if (Properties[0] != PI_QUEUE_FLAGS)
return PI_ERROR_INVALID_VALUE;
pi_queue_properties Flags = Properties[1];
// Extra data isn't supported yet.
assert(Properties[2] == 0);
if (Properties[2] != 0)
return PI_ERROR_INVALID_VALUE;
return hip_piQueueCreate(Context, Device, Flags, Queue);
}

Expand Down
4 changes: 4 additions & 0 deletions sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,13 @@ pi_result piextQueueCreate(pi_context Context, pi_device Device,
assert(Properties);
// Expect flags mask to be passed first.
assert(Properties[0] == PI_QUEUE_FLAGS);
if (Properties[0] != PI_QUEUE_FLAGS)
return PI_ERROR_INVALID_VALUE;
pi_queue_properties Flags = Properties[1];
// Extra data isn't supported yet.
assert(Properties[2] == 0);
if (Properties[2] != 0)
return PI_ERROR_INVALID_VALUE;
return piQueueCreate(Context, Device, Flags, Queue);
}
pi_result piQueueCreate(pi_context context, pi_device device,
Expand Down