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

Test IMAGE1D_BUFFER in more scenario #1806

Merged
merged 21 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 20 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
15 changes: 14 additions & 1 deletion test_common/harness/imageHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,10 +768,14 @@ void get_max_sizes(

(*numberOfSizes) = 0;

if (image_type == CL_MEM_OBJECT_IMAGE1D)
if (image_type == CL_MEM_OBJECT_IMAGE1D
|| image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER)
{

size_t M = maximum_sizes[0];
rjodinchr marked this conversation as resolved.
Show resolved Hide resolved
size_t A = max_pixels;

M = static_cast<size_t>(fmax(1, fmin(A / M, M)));

// Store the size
sizes[(*numberOfSizes)][0] = M;
Expand Down Expand Up @@ -859,6 +863,7 @@ void get_max_sizes(
{
switch (image_type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
log_info(" size[%d] = [%zu] (%g MB image)\n", j, sizes[j][0],
raw_pixel_size * sizes[j][0] * sizes[j][1]
Expand Down Expand Up @@ -1079,6 +1084,7 @@ cl_ulong get_image_size(image_descriptor const *imageInfo)
{
switch (imageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D: imageSize = imageInfo->rowPitch; break;
case CL_MEM_OBJECT_IMAGE2D:
imageSize = imageInfo->height * imageInfo->rowPitch;
Expand Down Expand Up @@ -2316,6 +2322,7 @@ int debug_find_vector_in_image(void *imagePtr, image_descriptor *imageInfo,

switch (imageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1;
height = 1;
Expand Down Expand Up @@ -3512,6 +3519,7 @@ void copy_image_data(image_descriptor *srcImageInfo,

switch (srcImageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
src_lod = sourcePos[1];
sourcePos_lod[1] = sourcePos_lod[2] = 0;
Expand Down Expand Up @@ -3557,6 +3565,7 @@ void copy_image_data(image_descriptor *srcImageInfo,
size_t dst_height_lod = 1 /*dstImageInfo->height*/;
switch (dstImageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
dst_lod = destPos[1];
destPos_lod[1] = destPos_lod[2] = 0;
Expand Down Expand Up @@ -4021,6 +4030,7 @@ cl_ulong compute_mipmapped_image_size(image_descriptor imageInfo)
retSize += (cl_ulong)curr_width * curr_height
* get_pixel_size(imageInfo.format);
break;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
retSize +=
(cl_ulong)curr_width * get_pixel_size(imageInfo.format);
Expand All @@ -4042,6 +4052,7 @@ cl_ulong compute_mipmapped_image_size(image_descriptor imageInfo)
case CL_MEM_OBJECT_IMAGE2D:
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
curr_height = curr_height >> 1 ? curr_height >> 1 : 1;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
curr_width = curr_width >> 1 ? curr_width >> 1 : 1;
Expand Down Expand Up @@ -4079,6 +4090,7 @@ size_t compute_mip_level_offset(image_descriptor *imageInfo, size_t lod)
retOffset +=
(size_t)width * height * get_pixel_size(imageInfo->format);
break;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
retOffset += (size_t)width * get_pixel_size(imageInfo->format);
break;
Expand All @@ -4091,6 +4103,7 @@ size_t compute_mip_level_offset(image_descriptor *imageInfo, size_t lod)
case CL_MEM_OBJECT_IMAGE2D:
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
height = (height >> 1) ? (height >> 1) : 1;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
case CL_MEM_OBJECT_IMAGE1D: width = (width >> 1) ? (width >> 1) : 1;
}
Expand Down
1 change: 1 addition & 0 deletions test_conformance/images/clCopyImage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(${MODULE_NAME}_SOURCES
test_copy_2D_array.cpp
test_copy_3D.cpp
test_copy_3D_2D_array.cpp
test_copy_1D_buffer.cpp
test_copy_generic.cpp
test_loops.cpp
../common.cpp
Expand Down
31 changes: 20 additions & 11 deletions test_conformance/images/clCopyImage/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ int test_3D(cl_device_id device, cl_context context, cl_command_queue queue, int
{
return test_image_set( device, context, queue, k3D );
}
int test_1Dbuffer(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
{
return test_image_set(device, context, queue, k1DBuffer);
}
int test_1DTo1Dbuffer(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
{
return test_image_set(device, context, queue, k1DTo1DBuffer);
}
int test_1DbufferTo1D(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
{
return test_image_set(device, context, queue, k1DBufferTo1D);
}
int test_1Darray(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
{
return test_image_set( device, context, queue, k1DArray );
Expand Down Expand Up @@ -79,17 +94,11 @@ int test_3Dto2Darray(cl_device_id device, cl_context context, cl_command_queue q
}

test_definition test_list[] = {
ADD_TEST( 1D ),
ADD_TEST( 2D ),
ADD_TEST( 3D ),
ADD_TEST( 1Darray ),
ADD_TEST( 2Darray ),
ADD_TEST( 2Dto3D ),
ADD_TEST( 3Dto2D ),
ADD_TEST( 2Darrayto2D ),
ADD_TEST( 2Dto2Darray ),
ADD_TEST( 2Darrayto3D ),
ADD_TEST( 3Dto2Darray ),
ADD_TEST(1D), ADD_TEST(2D), ADD_TEST(3D),
ADD_TEST(1Darray), ADD_TEST(2Darray), ADD_TEST(2Dto3D),
ADD_TEST(3Dto2D), ADD_TEST(2Darrayto2D), ADD_TEST(2Dto2Darray),
ADD_TEST(2Darrayto3D), ADD_TEST(3Dto2Darray), ADD_TEST(1Dbuffer),
ADD_TEST(1DTo1Dbuffer), ADD_TEST(1DbufferTo1D),
};

const int test_num = ARRAY_SIZE( test_list );
Expand Down
Loading
Loading