Remove unnecessary cl_mem_flags casts (#1018)

* api, atomics: remove unnecessary cl_mem_flags casts

Instances in api, atomics, buffers and c11_atomics suites

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* basic: remove unnecessary cl_mem_flags casts

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* spir, thread_dimensions: remove unnecessary cl_mem_flags casts

Instances in spir, thread_dimensions and workgroups tests

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* profiling, relationals: remove unnecessary cl_mem_flags casts

Includes relationals, profiling, muliple_device_context, integer_ops
tests

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* clcpp: remove unnecessary cl_mem_flags casts

Contibutes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* events, geometrics: remove unnecessary cl_mem_flags casts

Includes events, geometrics, gl and images tests

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* commonfs, compiler: remove unnecessary cl_mem_flags casts

Includes cast removal in commonfs, compiler and device_partition tests

Fixes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* Fix up formatting

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
This commit is contained in:
ellnor01
2020-10-19 13:56:02 +01:00
committed by GitHub
parent 8ca1537157
commit a6809710ea
140 changed files with 1077 additions and 556 deletions

View File

@@ -97,7 +97,8 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu
test_error( error, "Unable to create kernel to test against" );
// Create an output buffer
outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error );
outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE,
sizeof(outKernelData), NULL, &error);
test_error( error, "Unable to create output buffer" );
// Set up arguments and run

View File

@@ -101,7 +101,8 @@ int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue que
test_error( error, "Unable to create kernel to test against" );
// Create an output buffer
outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error );
outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE,
sizeof(outKernelData), NULL, &error);
test_error( error, "Unable to create output buffer" );
// Set up arguments and run

View File

@@ -125,7 +125,8 @@ int test_get_image_info_single( cl_context context, cl_command_queue queue, imag
test_error( error, "Unable to create kernel to test against" );
// Create an output buffer
outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error );
outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE,
sizeof(outKernelData), NULL, &error);
test_error( error, "Unable to create output buffer" );
// Set up arguments and run

View File

@@ -105,7 +105,8 @@ int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue que
test_error( error, "Unable to create kernel to test against" );
// Create an output buffer
outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error );
outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE,
sizeof(outKernelData), NULL, &error);
test_error( error, "Unable to create output buffer" );
// Set up arguments and run

View File

@@ -1428,11 +1428,20 @@ int test_read_image_2D( cl_context context, cl_command_queue queue, cl_kernel ke
if( gDebugTrace )
log_info( " - Creating kernel arguments...\n" );
xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height, xOffsetValues, &error );
xOffsets =
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width * imageInfo->height,
xOffsetValues, &error);
test_error( error, "Unable to create x offset buffer" );
yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height, yOffsetValues, &error );
yOffsets =
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width * imageInfo->height,
yOffsetValues, &error);
test_error( error, "Unable to create y offset buffer" );
results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->height, NULL, &error );
results = clCreateBuffer(context, CL_MEM_READ_WRITE,
get_explicit_type_size(outputType) * 4
* imageInfo->width * imageInfo->height,
NULL, &error);
test_error( error, "Unable to create result buffer" );
// Create sampler to use

View File

@@ -394,9 +394,14 @@ int test_read_image_1D( cl_context context, cl_command_queue queue, cl_kernel ke
if( gDebugTrace )
log_info( " - Creating kernel arguments...\n" );
xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width, xOffsetValues, &error );
xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width,
xOffsetValues, &error);
test_error( error, "Unable to create x offset buffer" );
results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width, NULL, &error );
results = clCreateBuffer(context, CL_MEM_READ_WRITE,
get_explicit_type_size(outputType) * 4
* imageInfo->width,
NULL, &error);
test_error( error, "Unable to create result buffer" );
// Create sampler to use

View File

@@ -468,16 +468,22 @@ int test_read_image_1D_array( cl_context context, cl_command_queue queue, cl_ker
if( gDebugTrace )
log_info( " - Creating kernel arguments...\n" );
xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ),
sizeof( cl_float ) * imageInfo->width * imageInfo->arraySize, xOffsetValues, &error );
xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->arraySize,
xOffsetValues, &error);
test_error( error, "Unable to create x offset buffer" );
yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ),
sizeof( cl_float ) * imageInfo->width * imageInfo->arraySize, yOffsetValues, &error );
yOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->arraySize,
yOffsetValues, &error);
test_error( error, "Unable to create y offset buffer" );
results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE),
get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->arraySize, NULL, &error );
results = clCreateBuffer(context, CL_MEM_READ_WRITE,
get_explicit_type_size(outputType) * 4
* imageInfo->width * imageInfo->arraySize,
NULL, &error);
test_error( error, "Unable to create result buffer" );
// Create sampler to use

View File

@@ -478,13 +478,26 @@ int test_read_image_2D_array( cl_context context, cl_command_queue queue, cl_ker
}
}
xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->arraySize, xOffsetValues, &error );
xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->height * imageInfo->arraySize,
xOffsetValues, &error);
test_error( error, "Unable to create x offset buffer" );
yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->arraySize, yOffsetValues, &error );
yOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->height * imageInfo->arraySize,
yOffsetValues, &error);
test_error( error, "Unable to create y offset buffer" );
zOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->arraySize, zOffsetValues, &error );
zOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->height * imageInfo->arraySize,
zOffsetValues, &error);
test_error( error, "Unable to create y offset buffer" );
results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->height * imageInfo->arraySize, NULL, &error );
results =
clCreateBuffer(context, CL_MEM_READ_WRITE,
get_explicit_type_size(outputType) * 4 * imageInfo->width
* imageInfo->height * imageInfo->arraySize,
NULL, &error);
test_error( error, "Unable to create result buffer" );
// Create sampler to use

View File

@@ -368,9 +368,9 @@ int test_read_image_3D( cl_context context, cl_command_queue queue, cl_kernel ke
( gEnablePitch ? imageInfo->rowPitch : 0 ),
( gEnablePitch ? imageInfo->slicePitch : 0 ), maxImageUseHostPtrBackingStore, &error );
} else {
error = protImage.Create( context,
(cl_mem_flags)(image_read_write_flags),
imageInfo->format, imageInfo->width, imageInfo->height, imageInfo->depth );
error = protImage.Create(context, image_read_write_flags,
imageInfo->format, imageInfo->width,
imageInfo->height, imageInfo->depth);
}
if( error != CL_SUCCESS )
{
@@ -487,13 +487,26 @@ int test_read_image_3D( cl_context context, cl_command_queue queue, cl_kernel ke
}
}
xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->depth, xOffsetValues, &error );
xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->height * imageInfo->depth,
xOffsetValues, &error);
test_error( error, "Unable to create x offset buffer" );
yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->depth, yOffsetValues, &error );
yOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->height * imageInfo->depth,
yOffsetValues, &error);
test_error( error, "Unable to create y offset buffer" );
zOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->depth, zOffsetValues, &error );
zOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
sizeof(cl_float) * imageInfo->width
* imageInfo->height * imageInfo->depth,
zOffsetValues, &error);
test_error( error, "Unable to create y offset buffer" );
results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->height * imageInfo->depth, NULL, &error );
results =
clCreateBuffer(context, CL_MEM_READ_WRITE,
get_explicit_type_size(outputType) * 4 * imageInfo->width
* imageInfo->height * imageInfo->depth,
NULL, &error);
test_error( error, "Unable to create result buffer" );
// Create sampler to use

View File

@@ -271,8 +271,10 @@ int test_write_image_1D( cl_device_id device, cl_context context, cl_command_que
clMemWrapper inputStream;
char *imagePtrOffset = imageValues + nextLevelOffset;
inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ),
get_explicit_type_size( inputType ) * 4 * width_lod, imagePtrOffset, &error );
inputStream = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
get_explicit_type_size(inputType) * 4
* width_lod,
imagePtrOffset, &error);
test_error( error, "Unable to create input buffer" );
// Set arguments

View File

@@ -285,8 +285,10 @@ int test_write_image_1D_array( cl_device_id device, cl_context context, cl_comma
clMemWrapper inputStream;
char *imagePtrOffset = imageValues + nextLevelOffset;
inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ),
get_explicit_type_size( inputType ) * 4 * width_lod * imageInfo->arraySize, imagePtrOffset, &error );
inputStream = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
get_explicit_type_size(inputType) * 4
* width_lod * imageInfo->arraySize,
imagePtrOffset, &error);
test_error( error, "Unable to create input buffer" );
// Set arguments

View File

@@ -305,8 +305,11 @@ int test_write_image_2D_array( cl_device_id device, cl_context context, cl_comma
clMemWrapper inputStream;
char *imagePtrOffset = imageValues + nextLevelOffset;
inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ),
get_explicit_type_size( inputType ) * 4 * width_lod * height_lod * imageInfo->arraySize, imagePtrOffset, &error );
inputStream =
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
get_explicit_type_size(inputType) * 4 * width_lod
* height_lod * imageInfo->arraySize,
imagePtrOffset, &error);
test_error( error, "Unable to create input buffer" );
// Set arguments

View File

@@ -311,8 +311,11 @@ int test_write_image_3D( cl_device_id device, cl_context context, cl_command_que
clMemWrapper inputStream;
char *imagePtrOffset = imageValues + nextLevelOffset;
inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ),
get_explicit_type_size( inputType ) * 4 * width_lod * height_lod * depth_lod, imagePtrOffset, &error );
inputStream =
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
get_explicit_type_size(inputType) * 4 * width_lod
* height_lod * depth_lod,
imagePtrOffset, &error);
test_error( error, "Unable to create input buffer" );
// Set arguments

View File

@@ -333,8 +333,11 @@ int test_write_image( cl_device_id device, cl_context context, cl_command_queue
char *imagePtrOffset = imageValues + nextLevelOffset;
inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ),
get_explicit_type_size( inputType ) * channel_scale * width_lod * height_lod, imagePtrOffset, &error );
inputStream =
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
get_explicit_type_size(inputType) * channel_scale
* width_lod * height_lod,
imagePtrOffset, &error);
test_error( error, "Unable to create input buffer" );
// Set arguments