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

fix bugs in negative command_buffer tests #1969

Merged
merged 2 commits into from
Jul 2, 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 @@ -37,6 +37,13 @@ struct CommandBufferBarrierNotNullQueue : public BasicCommandBufferTest

return CL_SUCCESS;
}

bool Skip() override
{
if (BasicCommandBufferTest::Skip()) return true;
return is_extension_available(device,
"cl_khr_command_buffer_multi_device");
}
};

// CL_INVALID_COMMAND_BUFFER_KHR if command_buffer is not a valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,20 @@ struct CommandCopyBaseTest : BasicCommandBufferTest

cl_int SetUp(int elements) override
{
num_elements = elements;
origin[0] = origin[1] = origin[2] = 0;
region[0] = elements / 64;
region[1] = 64;
region[2] = 1;
cl_int error = BasicCommandBufferTest::SetUp(elements);
test_error(error, "BasicCommandBufferTest::SetUp failed");

src_image = create_image_2d(context, CL_MEM_READ_ONLY, &formats, 512,
512, 0, NULL, &error);
src_image = create_image_2d(context, CL_MEM_READ_ONLY, &formats,
elements / 64, 64, 0, NULL, &error);
test_error(error, "create_image_2d failed");

dst_image = create_image_2d(context, CL_MEM_WRITE_ONLY, &formats, 512,
512, 0, NULL, &error);
dst_image = create_image_2d(context, CL_MEM_WRITE_ONLY, &formats,
elements / 64, 64, 0, NULL, &error);
test_error(error, "create_image_2d failed");

return CL_SUCCESS;
Expand All @@ -58,8 +63,8 @@ struct CommandCopyBaseTest : BasicCommandBufferTest
clMemWrapper src_image;
clMemWrapper dst_image;
const cl_image_format formats = { CL_RGBA, CL_UNSIGNED_INT8 };
const size_t origin[3] = { 0, 0, 0 };
const size_t region[3] = { 512, 512, 1 };
size_t origin[3];
size_t region[3];
};

namespace {
Expand All @@ -81,7 +86,7 @@ struct CommandBufferCopyImageQueueNotNull : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(command_buffer, queue, src_image,
dst_image, origin, region, 0, 0,
out_mem, origin, region, 0, 0,
nullptr, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE,
Expand Down Expand Up @@ -119,8 +124,8 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(
command_buffer, nullptr, src_image_ctx, dst_image, origin, region,
0, 0, nullptr, nullptr, nullptr);
command_buffer, nullptr, src_image_ctx, out_mem, origin, region, 0,
0, nullptr, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_CONTEXT,
"clCommandCopyImageToBufferKHR should return "
Expand Down Expand Up @@ -159,7 +164,7 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
nullptr, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_CONTEXT,
Expand All @@ -179,11 +184,11 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
test_error(error, "Failed to create context");

src_image_ctx = create_image_2d(context1, CL_MEM_READ_ONLY, &formats,
512, 512, 0, NULL, &error);
elements / 64, 64, 0, NULL, &error);
test_error(error, "create_image_2d failed");

dst_image_ctx = create_image_2d(context1, CL_MEM_WRITE_ONLY, &formats,
512, 512, 0, NULL, &error);
elements / 64, 64, 0, NULL, &error);
test_error(error, "create_image_2d failed");

queue1 = clCreateCommandQueue(context1, device, 0, &error);
Expand Down Expand Up @@ -220,7 +225,7 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 1,
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 1,
&invalid_point, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
Expand All @@ -239,7 +244,7 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 1,
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 1,
nullptr, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
Expand All @@ -263,7 +268,7 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
&point, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
Expand Down Expand Up @@ -294,7 +299,7 @@ struct CommandBufferCopyImageInvalidCommandBuffer : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(nullptr, nullptr, src_image,
dst_image, origin, region, 0, 0,
out_mem, origin, region, 0, 0,
nullptr, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR,
Expand Down Expand Up @@ -327,7 +332,7 @@ struct CommandBufferCopyImageFinalizedCommandBuffer : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
nullptr, nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_OPERATION,
Expand Down Expand Up @@ -358,7 +363,7 @@ struct CommandBufferCopyImageMutableHandleNotNull : public CommandCopyBaseTest
TEST_FAIL);

error = clCommandCopyImageToBufferKHR(
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
nullptr, nullptr, &mutable_handle);

test_failure_error_ret(error, CL_INVALID_VALUE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ struct CommandBufferCommandSVMQueueNotNull : public BasicSVMCommandBufferTest
}

const cl_char pattern_1 = 0x14;

bool Skip() override
{
if (BasicSVMCommandBufferTest::Skip()) return true;
return is_extension_available(device,
"cl_khr_command_buffer_multi_device");
EwanC marked this conversation as resolved.
Show resolved Hide resolved
}
};

// CL_INVALID_SYNC_POINT_WAIT_LIST_KHR if sync_point_wait_list is NULL and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ struct CommandNDRangeKernelQueueNotNull : public BasicCommandBufferTest

return CL_SUCCESS;
}

bool Skip() override
{
if (BasicCommandBufferTest::Skip()) return true;
return is_extension_available(device,
"cl_khr_command_buffer_multi_device");
}
};

// CL_INVALID_CONTEXT if the context associated with command_queue,
Expand Down Expand Up @@ -108,7 +115,7 @@ struct CommandNDRangeKerneSyncPointsNullOrNumZero
cl_sync_point_khr invalid_point = 0;
cl_sync_point_khr* invalid_sync_points[] = { &invalid_point };
cl_int error = clCommandNDRangeKernelKHR(
command_buffer, nullptr, nullptr, kernel, 0, nullptr, &num_elements,
command_buffer, nullptr, nullptr, kernel, 1, nullptr, &num_elements,
nullptr, 1, invalid_sync_points[0], nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
Expand All @@ -134,7 +141,7 @@ struct CommandNDRangeKerneSyncPointsNullOrNumZero

cl_sync_point_khr* sync_points[] = { &point };
error = clCommandNDRangeKernelKHR(
command_buffer, nullptr, nullptr, kernel, 0, nullptr, &num_elements,
command_buffer, nullptr, nullptr, kernel, 1, nullptr, &num_elements,
nullptr, 0, sync_points[0], nullptr, nullptr);

test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
Expand Down
Loading