KhronosGroup / KhronosGroup/OpenCL-CTS

The sizes of images should be limited when testing rounding in "test_image_streams".

Open
#593 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
232
Forks
235
Avg merge
8d 7h
Merged PRs (30d)
18

Description

When testing **_rounding_** in suite **_test_image_streams_**(source codes in conformance/images/kernel_read_write), the sizes of images to be created should be smaller than the max sizes that vendors support. But, for example, in file:
> conformance/images/kernel_read_write/test_read_2D_array.cpp

there is:
```
else if( gTestRounding )
{
size_t typeRange = 1 << ( get_format_type_size( imageInfo.format ) * 8 );
imageInfo.height = typeRange / 256;
imageInfo.width = (size_t)( typeRange / (cl_ulong)imageInfo.height );
imageInfo.arraySize = 2;

imageInfo.rowPitch = imageInfo.width * pixelSize;
imageInfo.slicePitch = imageInfo.height * imageInfo.rowPitch;
...
}
```
The maximum return value of **_get_format_type_size_** coulld be **_4_**, the maximum **_typeRange_** could be **_2^32_**(65536^2), resulting in the height of image being **_2^24_**(65536*256) which is out of the top bound most vendors support. This happens in:
> conformance/images/kernel_read_write/test_read_2D_array.cpp
conformance/images/kernel_read_write/test_read_3D.cpp
conformance/images/kernel_read_write/test_write_1D.cpp
conformance/images/kernel_read_write/test_write_1D_array.cpp
conformance/images/kernel_read_write/test_write_2D_array.cpp
conformance/images/kernel_read_write/test_write_3D.cpp
conformance/images/kernel_read_write/test_write_image.cpp

following files correctly deal with it:
> conformance/images/kernel_read_write/test_iterations.cpp
conformance/images/kernel_read_write/test_read_1D.cpp
conformance/images/kernel_read_write/test_read_1D_array.cpp

In test_read_1D_array.cpp:
```
else if( gTestRounding )
{
uint64_t typeRange = 1LL << ( get_format_type_size( imageInfo.format ) * 8 );
typeRange /= pixelSize / get_format_type_size( imageInfo.format );
imageInfo.arraySize = (size_t)( ( typeRange + 255LL ) / 256LL );
imageInfo.width = (size_t)( typeRange / (cl_ulong)imageInfo.arraySize );
while( imageInfo.arraySize >= maxArraySize / 2 )
{
imageInfo.width <<= 1;
imageInfo.arraySize >>= 1;
}

while( imageInfo.width >= maxWidth / 2 )
imageInfo.width >>= 1;
imageInfo.rowPitch = imageInfo.slicePitch = imageInfo.width * pixelSize;

...
}
```
I think this method is good.

Best wishes!
Feb. 13. 2020.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the rounding branches in the seven listed conformance/images/kernel_read_write files, then compare them with the existing handling in test_iterations.cpp, test_read_1D.cpp, and test_read_1D_array.cpp. Run the test_image_streams rounding cases and verify that generated image dimensions stay within the supported maximums without losing the rounding coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.