mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
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:
@@ -244,18 +244,21 @@ cl_int perThreadDataInit(perThreadData * pThis, ExplicitType type,
|
||||
(cl_int*)malloc(pThis->m_type_size * num_elements * vectorSize);
|
||||
pThis->m_output_ptr =
|
||||
(cl_int*)malloc(pThis->m_type_size * num_elements * vectorSize);
|
||||
pThis->m_streams[0] =
|
||||
clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), pThis->m_type_size * num_elements * inputAVecSize, NULL, &err);
|
||||
pThis->m_streams[0] = clCreateBuffer(
|
||||
context, CL_MEM_READ_WRITE,
|
||||
pThis->m_type_size * num_elements * inputAVecSize, NULL, &err);
|
||||
|
||||
test_error(err, "clCreateBuffer failed");
|
||||
|
||||
pThis->m_streams[1] =
|
||||
clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), pThis->m_type_size * num_elements * inputBVecSize, NULL, &err );
|
||||
pThis->m_streams[1] = clCreateBuffer(
|
||||
context, CL_MEM_READ_WRITE,
|
||||
pThis->m_type_size * num_elements * inputBVecSize, NULL, &err);
|
||||
|
||||
test_error(err, "clCreateBuffer failed");
|
||||
|
||||
pThis->m_streams[2] =
|
||||
clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), pThis->m_type_size * num_elements * vectorSize, NULL, &err );
|
||||
pThis->m_streams[2] = clCreateBuffer(
|
||||
context, CL_MEM_READ_WRITE,
|
||||
pThis->m_type_size * num_elements * vectorSize, NULL, &err);
|
||||
|
||||
test_error(err, "clCreateBuffer failed");
|
||||
|
||||
@@ -1445,13 +1448,21 @@ int test_question_colon_op(cl_device_id deviceID, cl_context context,
|
||||
generate_random_data( type, num_elements * inputBVecSize, s_randStates, input_ptr[ 1 ] );
|
||||
generate_random_bool_data( num_elements * inputCVecSize, s_randStates, (cl_char *)input_ptr[ 2 ], type_size );
|
||||
|
||||
streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), type_size * num_elements * inputAVecSize, input_ptr[0], &err);
|
||||
streams[0] = clCreateBuffer(
|
||||
context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
|
||||
type_size * num_elements * inputAVecSize, input_ptr[0], &err);
|
||||
test_error(err, "clCreateBuffer failed");
|
||||
streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), type_size * num_elements * inputBVecSize, input_ptr[1], &err );
|
||||
streams[1] = clCreateBuffer(
|
||||
context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
|
||||
type_size * num_elements * inputBVecSize, input_ptr[1], &err);
|
||||
test_error(err, "clCreateBuffer failed");
|
||||
streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), type_size * num_elements * inputCVecSize, input_ptr[2], &err );
|
||||
streams[2] = clCreateBuffer(
|
||||
context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
|
||||
type_size * num_elements * inputCVecSize, input_ptr[2], &err);
|
||||
test_error(err, "clCreateBuffer failed");
|
||||
streams[3] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_WRITE_ONLY), type_size * num_elements * vectorSize, NULL, &err );
|
||||
streams[3] =
|
||||
clCreateBuffer(context, CL_MEM_WRITE_ONLY,
|
||||
type_size * num_elements * vectorSize, NULL, &err);
|
||||
test_error(err, "clCreateBuffer failed");
|
||||
|
||||
const char *vectorString = sizeNames[ vectorSize ];
|
||||
|
||||
@@ -96,9 +96,9 @@ int test_single_param_integer_kernel(cl_command_queue queue, cl_context context,
|
||||
/* Generate some streams */
|
||||
generate_random_data( vecType, vecSize * TEST_SIZE, d, inDataA );
|
||||
|
||||
streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR),
|
||||
get_explicit_type_size( vecType ) * vecSize * TEST_SIZE,
|
||||
inDataA, NULL);
|
||||
streams[0] = clCreateBuffer(
|
||||
context, CL_MEM_COPY_HOST_PTR,
|
||||
get_explicit_type_size(vecType) * vecSize * TEST_SIZE, inDataA, NULL);
|
||||
if( streams[0] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating input array A failed!\n");
|
||||
@@ -110,9 +110,10 @@ int test_single_param_integer_kernel(cl_command_queue queue, cl_context context,
|
||||
// Op kernels use an r/w buffer for the second param, so we need to init it with data
|
||||
generate_random_data( vecType, vecSize * TEST_SIZE, d, inDataB );
|
||||
}
|
||||
streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE | ( useOpKernel ? CL_MEM_COPY_HOST_PTR : 0 )),
|
||||
get_explicit_type_size( vecType ) * vecSize * TEST_SIZE,
|
||||
( useOpKernel ) ? &inDataB : NULL, NULL );
|
||||
streams[1] = clCreateBuffer(
|
||||
context, (CL_MEM_READ_WRITE | (useOpKernel ? CL_MEM_COPY_HOST_PTR : 0)),
|
||||
get_explicit_type_size(vecType) * vecSize * TEST_SIZE,
|
||||
(useOpKernel) ? &inDataB : NULL, NULL);
|
||||
if( streams[1] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating output array failed!\n");
|
||||
@@ -667,25 +668,25 @@ int test_two_param_integer_kernel(cl_command_queue queue, cl_context context, co
|
||||
generate_random_data( vecAType, vecSize * TEST_SIZE, d, inDataA );
|
||||
generate_random_data( vecBType, vecSize * TEST_SIZE, d, inDataB );
|
||||
|
||||
streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR),
|
||||
get_explicit_type_size( vecAType ) * vecSize * TEST_SIZE,
|
||||
&inDataA, NULL);
|
||||
streams[0] = clCreateBuffer(
|
||||
context, CL_MEM_COPY_HOST_PTR,
|
||||
get_explicit_type_size(vecAType) * vecSize * TEST_SIZE, &inDataA, NULL);
|
||||
if( streams[0] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating input array A failed!\n");
|
||||
return -1;
|
||||
}
|
||||
streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR),
|
||||
get_explicit_type_size( vecBType ) * vecSize * TEST_SIZE,
|
||||
&inDataB, NULL);
|
||||
streams[1] = clCreateBuffer(
|
||||
context, CL_MEM_COPY_HOST_PTR,
|
||||
get_explicit_type_size(vecBType) * vecSize * TEST_SIZE, &inDataB, NULL);
|
||||
if( streams[1] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating input array B failed!\n");
|
||||
return -1;
|
||||
}
|
||||
streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE),
|
||||
get_explicit_type_size( vecAType ) * vecSize * TEST_SIZE,
|
||||
NULL, NULL );
|
||||
streams[2] = clCreateBuffer(
|
||||
context, CL_MEM_READ_WRITE,
|
||||
get_explicit_type_size(vecAType) * vecSize * TEST_SIZE, NULL, NULL);
|
||||
if( streams[2] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating output array failed!\n");
|
||||
@@ -1324,25 +1325,33 @@ int test_three_param_integer_kernel(cl_command_queue queue, cl_context context,
|
||||
generate_random_data( vecBType, vecSize * TEST_SIZE, d, inDataB );
|
||||
generate_random_data( vecCType, vecSize * TEST_SIZE, d, inDataC );
|
||||
|
||||
streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecAType ) * vecSize * TEST_SIZE, &inDataA, NULL);
|
||||
streams[0] = clCreateBuffer(
|
||||
context, CL_MEM_COPY_HOST_PTR,
|
||||
get_explicit_type_size(vecAType) * vecSize * TEST_SIZE, &inDataA, NULL);
|
||||
if( streams[0] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating input array A failed!\n");
|
||||
return -1;
|
||||
}
|
||||
streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecBType ) * vecSize * TEST_SIZE, &inDataB, NULL);
|
||||
streams[1] = clCreateBuffer(
|
||||
context, CL_MEM_COPY_HOST_PTR,
|
||||
get_explicit_type_size(vecBType) * vecSize * TEST_SIZE, &inDataB, NULL);
|
||||
if( streams[1] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating input array B failed!\n");
|
||||
return -1;
|
||||
}
|
||||
streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecCType ) * vecSize * TEST_SIZE, &inDataC, NULL);
|
||||
streams[2] = clCreateBuffer(
|
||||
context, CL_MEM_COPY_HOST_PTR,
|
||||
get_explicit_type_size(vecCType) * vecSize * TEST_SIZE, &inDataC, NULL);
|
||||
if( streams[2] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating input array C failed!\n");
|
||||
return -1;
|
||||
}
|
||||
streams[3] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( destType ) * vecSize * TEST_SIZE, NULL, NULL );
|
||||
streams[3] = clCreateBuffer(
|
||||
context, CL_MEM_READ_WRITE,
|
||||
get_explicit_type_size(destType) * vecSize * TEST_SIZE, NULL, NULL);
|
||||
if( streams[3] == NULL )
|
||||
{
|
||||
log_error("ERROR: Creating output array failed!\n");
|
||||
|
||||
@@ -90,9 +90,9 @@ int test_unary_op( cl_command_queue queue, cl_context context, OpKonstants which
|
||||
|
||||
// Generate two streams. The first is our random data to test against, the second is our control stream
|
||||
generate_random_data( vecType, vecSize * TEST_SIZE, d, inData );
|
||||
streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR),
|
||||
get_explicit_type_size( vecType ) * vecSize * TEST_SIZE,
|
||||
inData, &error );
|
||||
streams[0] = clCreateBuffer(
|
||||
context, CL_MEM_COPY_HOST_PTR,
|
||||
get_explicit_type_size(vecType) * vecSize * TEST_SIZE, inData, &error);
|
||||
test_error( error, "Creating input data array failed" );
|
||||
|
||||
cl_uint bits;
|
||||
@@ -110,8 +110,8 @@ int test_unary_op( cl_command_queue queue, cl_context context, OpKonstants which
|
||||
// For addition ops, the MAX control value is 1. Otherwise, it's 3
|
||||
controlData[ i ] &= ~0x02;
|
||||
}
|
||||
streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR),
|
||||
sizeof( controlData ), controlData, &error );
|
||||
streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
|
||||
sizeof(controlData), controlData, &error);
|
||||
test_error( error, "Unable to create control stream" );
|
||||
|
||||
// Assign streams and execute
|
||||
|
||||
@@ -92,19 +92,24 @@ int test_upsample_2_param_fn(cl_command_queue queue, cl_context context, const c
|
||||
}
|
||||
|
||||
/* Set up parameters */
|
||||
streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sourceATypeSize * sourceAVecSize * count, sourceA, NULL );
|
||||
streams[0] =
|
||||
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
|
||||
sourceATypeSize * sourceAVecSize * count, sourceA, NULL);
|
||||
if (!streams[0])
|
||||
{
|
||||
log_error("ERROR: Creating input array A failed!\n");
|
||||
return -1;
|
||||
}
|
||||
streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sourceBTypeSize * sourceBVecSize * count, sourceB, NULL );
|
||||
streams[1] =
|
||||
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
|
||||
sourceBTypeSize * sourceBVecSize * count, sourceB, NULL);
|
||||
if (!streams[1])
|
||||
{
|
||||
log_error("ERROR: Creating input array B failed!\n");
|
||||
return -1;
|
||||
}
|
||||
streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), outStride * count, NULL, NULL );
|
||||
streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, outStride * count,
|
||||
NULL, NULL);
|
||||
if (!streams[2])
|
||||
{
|
||||
log_error("ERROR: Creating output array failed!\n");
|
||||
|
||||
Reference in New Issue
Block a user