Skip to content

Commit 99cd1ad

Browse files
authored
[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 871b5b1 commit 99cd1ad

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
@@ -60,9 +60,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp(
6060
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
6161
}
6262

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

6773
ur_queue_handle_t Queue = nullptr;
6874
ur_queue_properties_t QueueProperties = {UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,

0 commit comments

Comments
 (0)