mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Command buffer testing fixes (#2081)
Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
This commit is contained in:
committed by
GitHub
parent
5026b1be00
commit
1a17853e75
@@ -40,7 +40,7 @@ struct CommandBufferCopyBaseTest : BasicCommandBufferTest
|
||||
|
||||
if (check_image_support)
|
||||
{
|
||||
image = create_image_2d(context, CL_MEM_READ_WRITE, &formats,
|
||||
image = create_image_2d(context, CL_MEM_READ_WRITE, &format,
|
||||
img_width, img_height, 0, NULL, &error);
|
||||
test_error(error, "create_image_2d failed");
|
||||
|
||||
@@ -72,19 +72,31 @@ struct CommandBufferCopyBaseTest : BasicCommandBufferTest
|
||||
return BasicCommandBufferTest::Skip() || command_buffer_multi_device;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr size_t num_channels = 4;
|
||||
|
||||
protected:
|
||||
const size_t img_width = 512;
|
||||
const size_t img_height = 512;
|
||||
const size_t origin[3] = { 0, 0, 0 };
|
||||
const size_t region[3] = { img_width, img_height, 1 };
|
||||
const cl_image_format formats = { CL_RGBA, CL_UNSIGNED_INT8 };
|
||||
static constexpr size_t img_width = 512;
|
||||
static constexpr size_t img_height = 512;
|
||||
static constexpr size_t origin[3] = { 0, 0, 0 };
|
||||
static constexpr size_t region[3] = { img_width, img_height, 1 };
|
||||
static constexpr cl_image_format format = { CL_RGBA, CL_UNSIGNED_INT8 };
|
||||
static constexpr size_t data_size =
|
||||
img_width * img_height * num_channels * sizeof(uint8_t);
|
||||
clMemWrapper image;
|
||||
clMemWrapper buffer;
|
||||
const size_t data_size = img_width * img_height * sizeof(cl_char);
|
||||
clMemWrapper in_mem;
|
||||
clMemWrapper out_mem;
|
||||
};
|
||||
|
||||
template <bool check_image_support>
|
||||
constexpr size_t CommandBufferCopyBaseTest<check_image_support>::origin[3];
|
||||
template <bool check_image_support>
|
||||
constexpr size_t CommandBufferCopyBaseTest<check_image_support>::region[3];
|
||||
template <bool check_image_support>
|
||||
constexpr cl_image_format
|
||||
CommandBufferCopyBaseTest<check_image_support>::format;
|
||||
|
||||
namespace {
|
||||
|
||||
// CL_INVALID_COMMAND_QUEUE if command_queue is not NULL.
|
||||
@@ -226,7 +238,7 @@ struct CommandBufferCopyImageDifferentContexts
|
||||
context1 = clCreateContext(0, 1, &device, nullptr, nullptr, &error);
|
||||
test_error(error, "Failed to create context");
|
||||
|
||||
image_ctx = create_image_2d(context1, CL_MEM_READ_WRITE, &formats,
|
||||
image_ctx = create_image_2d(context1, CL_MEM_READ_WRITE, &format,
|
||||
img_width, img_height, 0, NULL, &error);
|
||||
test_error(error, "create_image_2d failed");
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
|
||||
TEST_FAIL);
|
||||
|
||||
error = clCommandCopyImageToBufferKHR(
|
||||
command_buffer, nullptr, nullptr, src_image, dst_image_ctx, origin,
|
||||
command_buffer, nullptr, nullptr, src_image, out_mem_ctx, origin,
|
||||
region, 0, 0, nullptr, nullptr, nullptr);
|
||||
|
||||
test_failure_error_ret(error, CL_INVALID_CONTEXT,
|
||||
@@ -192,6 +192,12 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
|
||||
elements / 64, 64, 0, NULL, &error);
|
||||
test_error(error, "create_image_2d failed");
|
||||
|
||||
out_mem_ctx = clCreateBuffer(context1, CL_MEM_WRITE_ONLY,
|
||||
sizeof(cl_int) * num_elements
|
||||
* buffer_size_multiplier,
|
||||
nullptr, &error);
|
||||
test_error(error, "clCreateBuffer failed");
|
||||
|
||||
queue1 = clCreateCommandQueue(context1, device, 0, &error);
|
||||
test_error(error, "clCreateCommandQueue failed");
|
||||
|
||||
@@ -202,6 +208,7 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
|
||||
clCommandQueueWrapper queue1;
|
||||
clMemWrapper src_image_ctx;
|
||||
clMemWrapper dst_image_ctx;
|
||||
clMemWrapper out_mem_ctx;
|
||||
};
|
||||
|
||||
// CL_INVALID_SYNC_POINT_WAIT_LIST_KHR if sync_point_wait_list is NULL and
|
||||
|
||||
@@ -218,18 +218,22 @@ struct GetCommandBufferInfo : public BasicCommandBufferTest
|
||||
|
||||
cl_int RunPropArrayInfoTest()
|
||||
{
|
||||
std::vector<cl_command_buffer_properties_khr> properties;
|
||||
properties.resize(number_of_properties);
|
||||
if (0 != number_of_properties)
|
||||
{
|
||||
std::vector<cl_command_buffer_properties_khr> properties;
|
||||
properties.resize(number_of_properties);
|
||||
|
||||
cl_int error = clGetCommandBufferInfoKHR(
|
||||
command_buffer, CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR,
|
||||
number_of_properties * sizeof(cl_command_buffer_properties_khr) - 1,
|
||||
properties.data(), nullptr);
|
||||
cl_int error = clGetCommandBufferInfoKHR(
|
||||
command_buffer, CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR,
|
||||
number_of_properties * sizeof(cl_command_buffer_properties_khr)
|
||||
- 1,
|
||||
properties.data(), nullptr);
|
||||
|
||||
test_failure_error_ret(error, CL_INVALID_VALUE,
|
||||
"clGetCommandBufferInfoKHR should return "
|
||||
"CL_INVALID_VALUE",
|
||||
TEST_FAIL);
|
||||
test_failure_error_ret(error, CL_INVALID_VALUE,
|
||||
"clGetCommandBufferInfoKHR should return "
|
||||
"CL_INVALID_VALUE",
|
||||
TEST_FAIL);
|
||||
}
|
||||
|
||||
return TEST_PASS;
|
||||
}
|
||||
|
||||
@@ -298,10 +298,10 @@ __kernel void printf_kernel() {
|
||||
}
|
||||
)";
|
||||
|
||||
error = build_program_create_kernel_helper(context, &program, &kernel,
|
||||
1, &kernel_str,
|
||||
"printf_kernel", nullptr);
|
||||
test_error(error, "build_program_create_kernel_helper failed");
|
||||
error =
|
||||
create_single_kernel_helper(context, &program, &kernel, 1,
|
||||
&kernel_str, "printf_kernel", nullptr);
|
||||
test_error(error, "create_single_kernel_helper failed");
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
@@ -407,10 +407,10 @@ enqueue_kernel(def_q, CLK_ENQUEUE_FLAGS_WAIT_KERNEL, ndrange,
|
||||
)";
|
||||
std::string build_options = std::string(" ") + cl_std;
|
||||
|
||||
error = build_program_create_kernel_helper(
|
||||
context, &program, &kernel, 1, &kernel_str, "enqueue_call_kernel",
|
||||
build_options.c_str());
|
||||
test_error(error, "build_program_create_kernel_helper failed");
|
||||
error = create_single_kernel_helper(context, &program, &kernel, 1,
|
||||
&kernel_str, "enqueue_call_kernel",
|
||||
build_options.c_str());
|
||||
test_error(error, "create_single_kernel_helper failed");
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user