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

@@ -243,13 +243,17 @@ int test_atomic_function(cl_device_id deviceID, cl_context context, cl_command_q
for( size_t i = 0; i < numDestItems; i++ )
memcpy( destItems + i * typeSize, startValue, typeSize );
streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), typeSize * numDestItems, destItems, NULL);
streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
typeSize * numDestItems, destItems, NULL);
if (!streams[0])
{
log_error("ERROR: Creating output array failed!\n");
return -1;
}
streams[1] = clCreateBuffer(context, (cl_mem_flags)(( startRefValues != NULL ? CL_MEM_COPY_HOST_PTR : CL_MEM_READ_WRITE )), typeSize * threadSize, startRefValues, NULL);
streams[1] = clCreateBuffer(
context,
((startRefValues != NULL ? CL_MEM_COPY_HOST_PTR : CL_MEM_READ_WRITE)),
typeSize * threadSize, startRefValues, NULL);
if (!streams[1])
{
log_error("ERROR: Creating reference array failed!\n");

View File

@@ -64,12 +64,12 @@ int test_atomic_add_index(cl_device_id deviceID, cl_context context, cl_command_
(int)numGlobalThreads, (int)numLocalThreads);
// Create the counter that will keep track of where each thread writes.
counter = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE),
sizeof(cl_int) * 1, NULL, NULL);
counter = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * 1,
NULL, NULL);
// Create the counters that will hold the results of each thread writing
// its ID into a (hopefully) unique location.
counters = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE),
sizeof(cl_int) * numGlobalThreads, NULL, NULL);
counters = clCreateBuffer(context, CL_MEM_READ_WRITE,
sizeof(cl_int) * numGlobalThreads, NULL, NULL);
// Reset all those locations to -1 to indciate they have not been used.
cl_int *values = (cl_int*) malloc(sizeof(cl_int)*numGlobalThreads);
@@ -175,12 +175,15 @@ int add_index_bin_test(size_t *global_threads, cl_command_queue queue, cl_contex
(int)global_threads[0], (int)local_threads[0]);
// Allocate our storage
cl_mem bin_counters = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE),
sizeof(cl_int) * number_of_bins, NULL, NULL);
cl_mem bins = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE),
sizeof(cl_int) * number_of_bins*max_counts_per_bin, NULL, NULL);
cl_mem bin_assignments = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_ONLY),
sizeof(cl_int) * number_of_items, NULL, NULL);
cl_mem bin_counters =
clCreateBuffer(context, CL_MEM_READ_WRITE,
sizeof(cl_int) * number_of_bins, NULL, NULL);
cl_mem bins = clCreateBuffer(
context, CL_MEM_READ_WRITE,
sizeof(cl_int) * number_of_bins * max_counts_per_bin, NULL, NULL);
cl_mem bin_assignments =
clCreateBuffer(context, CL_MEM_READ_ONLY,
sizeof(cl_int) * number_of_items, NULL, NULL);
if (bin_counters == NULL) {
log_error("add_index_bin_test FAILED to allocate bin_counters.\n");