mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Reimplement buffer tests (#1007)
* Reimplement buffer tests Reintegrated and fixed test code for buffer tests buffer_read_half and buffer_write_half tests. Added mem_alloc_ref_flags test code, as was previously non-existent, to test CL_MEM_ALLOC_HOST_PTR. This flag was otherwise untested and as similar tests within the suite are used to test other cl_mem_flags it has been assumed that this was the purpose of the test. Fixes #439 Change-Id: I5accf986be7436d09377d0bfd7afd5de2235c329 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * move mem_read_write_flags to a common function Code under mem_*_flags tests have a lot of duplication, this is the first step of moving test code to a common function. Contributes #439 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * move mem_write_only_flags test code to a common function Code under mem_*_flags tests have a lot of duplication Contributes #439 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * move mem_read_only_flags test code to a common function Code under mem_*_flags tests have a lot of duplication Contributes #439 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * move mem_copy_host_flags test code to a common function Code under mem_*_flags tests have a lot of duplication, moved mem_copy_host_flags code and rearranged function where appropriate mem_ref_alloc_flags test also uses common function. Contributes #439 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * Remove unused NOT_IMPLEMENTED_TEST macro This define is not in use anymore, since tests have been reimplemented in #439. Tests should be working and implemented or not registered. Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
This commit is contained in:
@@ -315,40 +315,51 @@ static const char *float_kernel_name[] = { "test_buffer_write_float", "test_buff
|
||||
|
||||
|
||||
const char *buffer_write_half_kernel_code[] = {
|
||||
"__kernel void test_buffer_write_half(__global half *src, __global float *dst)\n"
|
||||
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
|
||||
"__kernel void test_buffer_write_half(__global half *src, __global half "
|
||||
"*dst)\n"
|
||||
"{\n"
|
||||
" int tid = get_global_id(0);\n"
|
||||
"\n"
|
||||
" dst[tid] = vload_half( tid * 2, src );\n"
|
||||
" dst[tid] = src[tid];\n"
|
||||
"}\n",
|
||||
|
||||
"__kernel void test_buffer_write_half2(__global half2 *src, __global float2 *dst)\n"
|
||||
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
|
||||
"__kernel void test_buffer_write_half2(__global half2 *src, __global half2 "
|
||||
"*dst)\n"
|
||||
"{\n"
|
||||
" int tid = get_global_id(0);\n"
|
||||
"\n"
|
||||
" dst[tid] = vload_half2( tid * 2, src );\n"
|
||||
" dst[tid] = src[tid];\n"
|
||||
"}\n",
|
||||
|
||||
"__kernel void test_buffer_write_half4(__global half4 *src, __global float4 *dst)\n"
|
||||
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
|
||||
"__kernel void test_buffer_write_half4(__global half4 *src, __global half4 "
|
||||
"*dst)\n"
|
||||
"{\n"
|
||||
" int tid = get_global_id(0);\n"
|
||||
"\n"
|
||||
" dst[tid] = vload_half4( tid * 2, src );\n"
|
||||
" dst[tid] = src[tid];\n"
|
||||
"}\n",
|
||||
|
||||
"__kernel void test_buffer_write_half8(__global half8 *src, __global float8 *dst)\n"
|
||||
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
|
||||
"__kernel void test_buffer_write_half8(__global half8 *src, __global half8 "
|
||||
"*dst)\n"
|
||||
"{\n"
|
||||
" int tid = get_global_id(0);\n"
|
||||
"\n"
|
||||
" dst[tid] = vload_half8( tid * 2, src );\n"
|
||||
" dst[tid] = src[tid];\n"
|
||||
"}\n",
|
||||
|
||||
"__kernel void test_buffer_write_half16(__global half16 *src, __global float16 *dst)\n"
|
||||
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
|
||||
"__kernel void test_buffer_write_half16(__global half16 *src, __global "
|
||||
"half16 *dst)\n"
|
||||
"{\n"
|
||||
" int tid = get_global_id(0);\n"
|
||||
"\n"
|
||||
" dst[tid] = vload_half16( tid * 2, src );\n"
|
||||
"}\n" };
|
||||
" dst[tid] = src[tid];\n"
|
||||
"}\n"
|
||||
};
|
||||
|
||||
static const char *half_kernel_name[] = { "test_buffer_write_half", "test_buffer_write_half2", "test_buffer_write_half4", "test_buffer_write_half8", "test_buffer_write_half16" };
|
||||
|
||||
@@ -1398,6 +1409,7 @@ int test_buffer_write_float( cl_device_id deviceID, cl_context context, cl_comma
|
||||
|
||||
int test_buffer_write_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||
{
|
||||
PASSIVE_REQUIRE_FP16_SUPPORT(deviceID)
|
||||
float *inptr[5];
|
||||
size_t ptrSizes[5];
|
||||
int i, err;
|
||||
@@ -1422,8 +1434,10 @@ int test_buffer_write_half( cl_device_id deviceID, cl_context context, cl_comman
|
||||
inptr[i][j] = get_random_float( -FLT_MAX, FLT_MAX, d );
|
||||
}
|
||||
|
||||
err = test_buffer_write( deviceID, context, queue, num_elements, sizeof( cl_float ) / 2, (char*)"half", 5, (void**)inptr,
|
||||
buffer_write_half_kernel_code, half_kernel_name, foo, d );
|
||||
err = test_buffer_write(deviceID, context, queue, num_elements,
|
||||
sizeof(cl_half), (char *)"half", 5, (void **)inptr,
|
||||
buffer_write_half_kernel_code, half_kernel_name,
|
||||
foo, d);
|
||||
|
||||
for ( i = 0; i < 5; i++ ){
|
||||
align_free( (void *)inptr[i] );
|
||||
|
||||
Reference in New Issue
Block a user