Skip to content

[SYCL] Native event for default-ctored sycl::event has to be in COMPLETE state #7148

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 3 commits into from
Oct 25, 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
10 changes: 8 additions & 2 deletions sycl/include/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
// 10.13 Added new PI_EXT_ONEAPI_QUEUE_DISCARD_EVENTS queue property.
// 10.14 Add PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY as an extension for
// piDeviceGetInfo.
// 11.15 piEventCreate creates even in the signalled state now.

#define _PI_H_VERSION_MAJOR 10
#define _PI_H_VERSION_MINOR 14
#define _PI_H_VERSION_MAJOR 11
#define _PI_H_VERSION_MINOR 15

#define _PI_STRING_HELPER(a) #a
#define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b)
Expand Down Expand Up @@ -1397,6 +1398,11 @@ piextKernelGetNativeHandle(pi_kernel kernel, pi_native_handle *nativeHandle);
//
// Events
//

/// Create PI event object in a signalled/completed state.
///
/// \param context is the PI context of the event.
/// \param ret_event is the PI even created.
__SYCL_EXPORT pi_result piEventCreate(pi_context context, pi_event *ret_event);

__SYCL_EXPORT pi_result piEventGetInfo(pi_event event, pi_event_info param_name,
Expand Down
5 changes: 4 additions & 1 deletion sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5650,7 +5650,10 @@ static pi_result EventCreate(pi_context Context, pi_queue Queue,
pi_result piEventCreate(pi_context Context, pi_event *RetEvent) {
pi_result Result = EventCreate(Context, nullptr, true, RetEvent);
(*RetEvent)->RefCountExternal++;
return Result;
if (Result != PI_SUCCESS)
return Result;
ZE_CALL(zeEventHostSignal, ((*RetEvent)->ZeEvent));
return PI_SUCCESS;
}

pi_result piEventGetInfo(pi_event Event, pi_event_info ParamName,
Expand Down
9 changes: 7 additions & 2 deletions sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,13 @@ pi_result piKernelGetSubGroupInfo(pi_kernel kernel, pi_device device,
pi_result piEventCreate(pi_context context, pi_event *ret_event) {

pi_result ret_err = PI_ERROR_INVALID_OPERATION;
*ret_event = cast<pi_event>(
clCreateUserEvent(cast<cl_context>(context), cast<cl_int *>(&ret_err)));
auto *cl_err = cast<cl_int *>(&ret_err);

cl_event e = clCreateUserEvent(cast<cl_context>(context), cl_err);
*ret_event = cast<pi_event>(e);
if (*cl_err != CL_SUCCESS)
return ret_err;
*cl_err = clSetUserEventStatus(e, CL_COMPLETE);
return ret_err;
}

Expand Down