Skip to content
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

Give appropriate errors for out of order execution related props #713

Merged
merged 20 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ using the name of the corresponding environment variable.

* `CLVK_CONFIG_FILE` specifies the path to an additional configuration file.

* `CLVK_IGNORE_OUT_OF_ORDER_EXECUTION` can be used to ignore out of order execution checks
kpet marked this conversation as resolved.
Show resolved Hide resolved

* 0: does not ignore OOOE checks and validates if hardware can support it
Rekt3421 marked this conversation as resolved.
Show resolved Hide resolved
* 1: ignores the aforementioned checks

* `CLVK_LOG` controls the level of logging

* 0: only print fatal messages (default)
Expand Down
27 changes: 26 additions & 1 deletion src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ struct api_query_string : public std::string {
size_t size_with_null() const { return size() + 1; }
};

bool out_of_order_device_support(const cl_device_id devices, cl_int err) {
Rekt3421 marked this conversation as resolved.
Show resolved Hide resolved
cl_command_queue_properties device_props = 0;
err = clGetDeviceInfo(devices, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(device_props), &device_props, NULL);
if (err == CL_SUCCESS) {
return device_props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
}
return false;
}

Rekt3421 marked this conversation as resolved.
Show resolved Hide resolved
} // namespace

// Platform API
Expand Down Expand Up @@ -1466,11 +1476,26 @@ cvk_create_command_queue(cl_context context, cl_device_id device,
return nullptr;
}

cl_int err = CL_SUCCESS;
std::string oooe_env_var = "CLVK_IGNORE_OUT_OF_ORDER_EXECUTION";
Rekt3421 marked this conversation as resolved.
Show resolved Hide resolved
const char* oooe_env_var_val = getenv(oooe_env_var.c_str());

if (oooe_env_var_val == nullptr || strcmp(oooe_env_var_val, "1") != 0) {
// We do not support out of order command queues so this must fail
if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE &&
!out_of_order_device_support(device, err)) {
*errcode_ret = CL_INVALID_QUEUE_PROPERTIES;
if (err != CL_SUCCESS) {
*errcode_ret = err;
}
Rekt3421 marked this conversation as resolved.
Show resolved Hide resolved
return nullptr;
}
}
auto queue = std::make_unique<cvk_command_queue>(
icd_downcast(context), icd_downcast(device), properties,
std::move(properties_array));

cl_int err = queue->init();
err = queue->init();

*errcode_ret = err;

Expand Down