Skip to content
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
25 changes: 14 additions & 11 deletions unified-runtime/source/adapters/opencl/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp(
const ur_exp_command_buffer_desc_t *pCommandBufferDesc,
ur_exp_command_buffer_handle_t *phCommandBuffer) {

ur_queue_handle_t Queue = nullptr;
ur_queue_properties_t QueueProperties = {UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
nullptr, 0};
const bool IsInOrder = pCommandBufferDesc->isInOrder;
if (!IsInOrder) {
QueueProperties.flags = UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE;
}
UR_RETURN_ON_FAILURE(
urQueueCreate(hContext, hDevice, &QueueProperties, &Queue));

cl_context CLContext = hContext->CLContext;
cl_ext::clCreateCommandBufferKHR_fn clCreateCommandBufferKHR = nullptr;
UR_RETURN_ON_FAILURE(
Expand All @@ -71,11 +61,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp(
CL_COMMAND_BUFFER_FLAGS_KHR,
IsUpdatable ? CL_COMMAND_BUFFER_MUTABLE_KHR : 0u, 0};

ur_queue_handle_t Queue = nullptr;
ur_queue_properties_t QueueProperties = {UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
nullptr, 0};
const bool IsInOrder = pCommandBufferDesc->isInOrder;
if (!IsInOrder) {
QueueProperties.flags = UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE;
}
UR_RETURN_ON_FAILURE(
urQueueCreate(hContext, hDevice, &QueueProperties, &Queue));

cl_int Res = CL_SUCCESS;
const cl_command_queue CLQueue = Queue->CLQueue;
auto CLCommandBuffer =
clCreateCommandBufferKHR(1, &CLQueue, Properties, &Res);
CL_RETURN_ON_FAILURE_AND_SET_NULL(Res, phCommandBuffer);
if (Res != CL_SUCCESS) {
urQueueRelease(Queue);
CL_RETURN_ON_FAILURE_AND_SET_NULL(Res, phCommandBuffer);
}

try {
auto URCommandBuffer = std::make_unique<ur_exp_command_buffer_handle_t_>(
Expand Down
5 changes: 3 additions & 2 deletions unified-runtime/source/adapters/opencl/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ struct ur_device_handle_t_ {
if (Parent) {
Type = Parent->Type;
} else {
clGetDeviceInfo(CLDevice, CL_DEVICE_TYPE, sizeof(cl_device_type), &Type,
nullptr);
[[maybe_unused]] auto Res = clGetDeviceInfo(
CLDevice, CL_DEVICE_TYPE, sizeof(cl_device_type), &Type, nullptr);
assert(Res == CL_SUCCESS);
}
}

Expand Down