Skip to content

Commit 25a70b6

Browse files
EwanCKornevNikita
authored andcommitted
[UR][OpenCL][Graph] Set simultaneous-use property (#18154)
The merged PR #17658 added the requirement for OpenCL cl_khr_command_buffer implementations to support the simultaneous use capability in order to support UR command-buffers. There was an oversight in this PR where the simultaneous use property wasn't set on command-buffer creation in the OpenCL adapter. This is rectified in this patch.
1 parent 69cf82b commit 25a70b6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

unified-runtime/source/adapters/opencl/command_buffer.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp(
6363
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
6464
}
6565

66-
cl_command_buffer_properties_khr Properties[3] = {
67-
CL_COMMAND_BUFFER_FLAGS_KHR,
68-
IsUpdatable ? CL_COMMAND_BUFFER_MUTABLE_KHR : 0u, 0};
66+
// OpenCL command-buffer must be simultaneous use to match expectation of UR
67+
// command-buffer specification.
68+
cl_command_buffer_flags_khr Flags = CL_COMMAND_BUFFER_SIMULTANEOUS_USE_KHR;
69+
if (IsUpdatable) {
70+
Flags |= CL_COMMAND_BUFFER_MUTABLE_KHR;
71+
}
72+
73+
cl_command_buffer_properties_khr Properties[3] = {CL_COMMAND_BUFFER_FLAGS_KHR,
74+
Flags, 0};
6975

7076
cl_int Res = CL_SUCCESS;
7177
auto CLCommandBuffer = clCreateCommandBufferKHR(

0 commit comments

Comments
 (0)