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

Array based clUpdateMutableCommandsKHR changes #1984

Merged
merged 2 commits into from
Sep 6, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ struct MutableDispatchGlobalArguments : public MutableDispatchArgumentsTest
cl_mutable_dispatch_arg_khr arg{ 1, sizeof(dst_buf_1), &dst_buf_1 };

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
1 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -180,12 +178,13 @@ struct MutableDispatchGlobalArguments : public MutableDispatchArgumentsTest
nullptr /* local_work_size */
};

cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down Expand Up @@ -292,8 +291,6 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest
cl_mutable_dispatch_arg_khr args[] = { arg_1 };

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
1 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -306,15 +303,17 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest
nullptr /* global_work_size */,
nullptr /* local_work_size */
};
cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
};

error = clFinish(queue);
test_error(error, "clFinish failed.");

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error =
Expand Down Expand Up @@ -426,8 +425,6 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest
cl_mutable_dispatch_arg_khr args[] = { arg_1 };

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
1 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -440,15 +437,17 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest
nullptr /* global_work_size */,
nullptr /* local_work_size */
};
cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
};

error = clFinish(queue);
test_error(error, "clFinish failed.");

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueReadBuffer(queue, stream, CL_TRUE, 0, size_to_allocate,
Expand Down Expand Up @@ -572,8 +571,6 @@ struct MutableDispatchNullArguments : public MutableDispatchArgumentsTest
// Modify and execute the command buffer
cl_mutable_dispatch_arg_khr arg{ 0, sizeof(cl_mem), nullptr };
cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
1 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -587,12 +584,13 @@ struct MutableDispatchNullArguments : public MutableDispatchArgumentsTest
nullptr /* local_work_size */
};

cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down Expand Up @@ -773,19 +771,18 @@ struct MutableDispatchSVMArguments : public MutableDispatchArgumentsTest
exec_info.param_value = &new_buffer;

cl_mutable_dispatch_config_khr dispatch_config{};
dispatch_config.type = CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR;
dispatch_config.command = command;
dispatch_config.num_svm_args = 1;
dispatch_config.arg_svm_list = &arg_svm;
dispatch_config.num_exec_infos = 1;
dispatch_config.exec_info_list = &exec_info;

cl_mutable_base_config_khr mutable_config{};
mutable_config.type = CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR;
mutable_config.num_mutable_dispatch = 1;
mutable_config.mutable_dispatch_list = &dispatch_config;

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ struct BasicMutableCommandBufferTest : BasicCommandBufferTest
"cl_khr_command_buffer_mutable_dispatch")
== true;

if (extension_avaliable) {
// API breaking changes occur at revision 0.9.2, check implementation
// matches tested API
Version device_version = get_device_cl_version(device);
if ((device_version >= Version(3, 0))
|| is_extension_available(device, "cl_khr_extended_versioning")) {

cl_version extension_version =
get_extension_version(device, "cl_khr_command_buffer_mutable_dispatch");

if (extension_version < CL_MAKE_VERSION(0, 9, 2)) {
extension_avaliable = false;
}
}
}

cl_mutable_dispatch_fields_khr mutable_capabilities;

bool mutable_support =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest
available_caps &= ~CL_MUTABLE_DISPATCH_EXEC_INFO_KHR;

// require at least one mutable capabillity
return (available_caps == 0) && InfoMutableCommandBufferTest::Skip();
return (available_caps == 0) || InfoMutableCommandBufferTest::Skip();
}

// setup kernel program specific for command buffer with full mutable
Expand Down Expand Up @@ -336,8 +336,6 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest

// Modify and execute the command buffer
cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
0 /* num_args */,
0 /* num_svm_arg */,
Expand Down Expand Up @@ -395,12 +393,13 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest
dispatch_config.local_work_size = &group_size;
}

cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest
test_error(error, "clFinish failed.");

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
0 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -102,12 +100,14 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest
nullptr /* global_work_size */,
nullptr /* local_work_size */
};
cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
};

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest
test_error(error, "clFinish failed.");

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
0 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -101,12 +99,14 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest
&update_global_size /* global_work_size */,
nullptr /* local_work_size */
};
cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
};

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest
cl_mutable_dispatch_arg_khr args[] = { arg_2 };

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
1 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -176,11 +174,14 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest
nullptr /* global_work_size */,
nullptr /* local_work_size */
};
cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config

cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down Expand Up @@ -360,8 +361,6 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest
cl_mutable_dispatch_arg_khr args[] = { arg_2 };

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
1 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -374,11 +373,14 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest
nullptr /* global_work_size */,
nullptr /* local_work_size */
};
cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config

cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest
cl_mutable_dispatch_arg_khr args = { 0, sizeof(cl_int), &pattern_sec };

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
1 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -167,12 +165,13 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest
nullptr /* local_work_size */
};

cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

// update parameter of previous mutable dispatch by using the same
Expand All @@ -181,7 +180,8 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest
args.arg_size = sizeof(new_out_mem);
args.arg_value = &new_out_mem;

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueFillBuffer(queue, new_out_mem, &pattern_pri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest
test_error(error, "clFinish failed.");

cl_mutable_dispatch_config_khr dispatch_config{
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
nullptr,
command,
0 /* num_args */,
0 /* num_svm_arg */,
Expand All @@ -104,12 +102,14 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest
&update_global_size /* global_work_size */,
&update_local_size /* local_work_size */
};
cl_mutable_base_config_khr mutable_config{
CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1,
&dispatch_config
};

error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config);
cl_uint num_configs = 1;
cl_command_buffer_update_type_khr config_types[1] = {
CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR
};
const void *configs[1] = { &dispatch_config };
error = clUpdateMutableCommandsKHR(command_buffer, num_configs,
config_types, configs);
test_error(error, "clUpdateMutableCommandsKHR failed");

error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,
Expand Down
Loading
Loading