Skip to content

Commit 5a91df9

Browse files
authored
[SYCL][PI] Map CL_QUEUED to CL_SUBMITTED (#9944)
Change the result of `CL_EVENT_COMMAND_EXECUTION_STATUS` from `CL_QUEUED` to `CL_SUBMITTED` since SYCL doesn't have an equivalent to `CL_QUEUED`. This commit adds the `piEventGetInfo` symbol to the OpenCL PI plugin, which is a non-breaking ABI change. Fixes #9099. Signed-off-by: Michael Aziz <[email protected]>
1 parent a3a9dd0 commit 5a91df9

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2331,6 +2331,24 @@ pi_result piGetDeviceAndHostTimer(pi_device Device, uint64_t *DeviceTime,
23312331
return PI_SUCCESS;
23322332
}
23332333

2334+
pi_result piEventGetInfo(pi_event event, pi_event_info param_name,
2335+
size_t param_value_size, void *param_value,
2336+
size_t *param_value_size_ret) {
2337+
cl_int result =
2338+
clGetEventInfo(reinterpret_cast<cl_event>(event), param_name,
2339+
param_value_size, param_value, param_value_size_ret);
2340+
if (result == CL_SUCCESS && param_name == CL_EVENT_COMMAND_EXECUTION_STATUS) {
2341+
// If the CL_EVENT_COMMAND_EXECUTION_STATUS info value is CL_QUEUED, change
2342+
// it to CL_SUBMITTED. This change is needed since
2343+
// sycl::info::event::event_command_status has no equivalent to CL_QUEUED.
2344+
const auto param_value_int = static_cast<cl_int *>(param_value);
2345+
if (*param_value_int == CL_QUEUED) {
2346+
*param_value_int = CL_SUBMITTED;
2347+
}
2348+
}
2349+
return static_cast<pi_result>(result);
2350+
}
2351+
23342352
const char SupportedVersion[] = _PI_OPENCL_PLUGIN_VERSION_STRING;
23352353

23362354
pi_result piPluginInit(pi_plugin *PluginInit) {
@@ -2418,7 +2436,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
24182436
_PI_CL(piextKernelGetNativeHandle, piextKernelGetNativeHandle)
24192437
// Event
24202438
_PI_CL(piEventCreate, piEventCreate)
2421-
_PI_CL(piEventGetInfo, clGetEventInfo)
2439+
_PI_CL(piEventGetInfo, piEventGetInfo)
24222440
_PI_CL(piEventGetProfilingInfo, clGetEventProfilingInfo)
24232441
_PI_CL(piEventsWait, clWaitForEvents)
24242442
_PI_CL(piEventSetCallback, clSetEventCallback)

sycl/test/abi/pi_opencl_symbol_check.dump

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ piDeviceGetInfo
1313
piDevicesGet
1414
piEnqueueMemBufferMap
1515
piEventCreate
16+
piEventGetInfo
1617
piGetDeviceAndHostTimer
1718
piKernelCreate
1819
piKernelGetGroupInfo

0 commit comments

Comments
 (0)