mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Enqueue fill buffer (#1561)
* grab latest from upstream OpenCL * Use clEnqueueFillBuffer rather than memset4 in all test files * Cleanup leftover code from memset_pattern4 * Remove unnecessary map, unmap, writeBuffer from math_brute_force tests * Remove extraneous build system change * Appease clang-format * Add option to perform buffer fills on the host Co-authored-by: Taeten Prettyman <taeten.j@gmail.com> Co-authored-by: taetenp <taet@holochip.com> Co-authored-by: Chip Davis <chip@holochip.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/csh
|
||||
#!/bin/bash
|
||||
#
|
||||
# This runs the conversions in 32- and 64-bit modes, split into 9 processes for better throughput.
|
||||
# It is intended to allow for quicker debugging turnaround for code development purposes
|
||||
|
||||
@@ -222,24 +222,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
Force64BitFPUPrecision();
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_ulong *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
cl_ulong *p = (cl_ulong *)gIn + thread_id * buffer_elements;
|
||||
@@ -248,8 +251,9 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
int totalSpecialValueCount = specialValuesCount * specialValuesCount;
|
||||
int lastSpecialJobIndex = (totalSpecialValueCount - 1) / buffer_elements;
|
||||
|
||||
// Test edge cases
|
||||
if (job_id <= (cl_uint)lastSpecialJobIndex)
|
||||
{ // test edge cases
|
||||
{
|
||||
cl_double *fp = (cl_double *)p;
|
||||
cl_double *fp2 = (cl_double *)p2;
|
||||
uint32_t x, y;
|
||||
@@ -270,7 +274,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
// Init any remaining values.
|
||||
// Init any remaining values
|
||||
for (; idx < buffer_elements; idx++)
|
||||
{
|
||||
p[idx] = genrand_int64(d);
|
||||
@@ -293,31 +297,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -227,24 +227,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_uint *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
cl_uint *p = (cl_uint *)gIn + thread_id * buffer_elements;
|
||||
@@ -253,8 +256,9 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
int totalSpecialValueCount = specialValuesCount * specialValuesCount;
|
||||
int lastSpecialJobIndex = (totalSpecialValueCount - 1) / buffer_elements;
|
||||
|
||||
// Test edge cases
|
||||
if (job_id <= (cl_uint)lastSpecialJobIndex)
|
||||
{ // test edge cases
|
||||
{
|
||||
float *fp = (float *)p;
|
||||
float *fp2 = (float *)p2;
|
||||
uint32_t x, y;
|
||||
@@ -276,7 +280,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
// Init any remaining values.
|
||||
// Init any remaining values
|
||||
for (; idx < buffer_elements; idx++)
|
||||
{
|
||||
p[idx] = genrand_int32(d);
|
||||
@@ -299,31 +303,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -225,24 +225,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
Force64BitFPUPrecision();
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_ulong *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// Start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
cl_ulong *p = (cl_ulong *)gIn + thread_id * buffer_elements;
|
||||
@@ -251,8 +254,9 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
int totalSpecialValueCount = specialValuesCount * specialValuesIntCount;
|
||||
int lastSpecialJobIndex = (totalSpecialValueCount - 1) / buffer_elements;
|
||||
|
||||
// Test edge cases
|
||||
if (job_id <= (cl_uint)lastSpecialJobIndex)
|
||||
{ // test edge cases
|
||||
{
|
||||
cl_double *fp = (cl_double *)p;
|
||||
cl_int *ip2 = (cl_int *)p2;
|
||||
uint32_t x, y;
|
||||
@@ -296,31 +300,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -216,24 +216,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
cl_float *s = 0;
|
||||
cl_int *s2 = 0;
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_uint *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
cl_uint *p = (cl_uint *)gIn + thread_id * buffer_elements;
|
||||
@@ -288,31 +291,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -216,19 +216,22 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
Force64BitFPUPrecision();
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_ulong *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,8 +245,9 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
int totalSpecialValueCount = specialValuesCount * specialValuesCount;
|
||||
int lastSpecialJobIndex = (totalSpecialValueCount - 1) / buffer_elements;
|
||||
|
||||
// Test edge cases
|
||||
if (job_id <= (cl_uint)lastSpecialJobIndex)
|
||||
{ // test edge cases
|
||||
{
|
||||
cl_double *fp = (cl_double *)p;
|
||||
cl_double *fp2 = (cl_double *)p2;
|
||||
uint32_t x, y;
|
||||
@@ -264,7 +268,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
// Init any remaining values.
|
||||
// Init any remaining values
|
||||
for (; idx < buffer_elements; idx++)
|
||||
{
|
||||
p[idx] = genrand_int64(d);
|
||||
@@ -287,31 +291,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -213,24 +213,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
func = job->f->rfunc;
|
||||
}
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_uint *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
cl_uint *p = (cl_uint *)gIn + thread_id * buffer_elements;
|
||||
@@ -269,7 +272,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
// Init any remaining values.
|
||||
// Init any remaining values
|
||||
for (; idx < buffer_elements; idx++)
|
||||
{
|
||||
p[idx] = genrand_int32(d);
|
||||
@@ -301,31 +304,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -146,28 +146,53 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j], CL_FALSE,
|
||||
0, BUFFER_SIZE, gOut2[j], 0, NULL,
|
||||
NULL)))
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut2[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 1 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer2[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 2 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,28 +149,53 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j], CL_FALSE,
|
||||
0, BUFFER_SIZE, gOut2[j], 0, NULL,
|
||||
NULL)))
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut2[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 1 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer2[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 2 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,18 +107,33 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,18 +106,33 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,24 +208,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
Force64BitFPUPrecision();
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_long *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_long *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_long *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
double *p = (double *)gIn + thread_id * buffer_elements;
|
||||
@@ -234,8 +237,9 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
int totalSpecialValueCount = specialValuesCount * specialValuesCount;
|
||||
int lastSpecialJobIndex = (totalSpecialValueCount - 1) / buffer_elements;
|
||||
|
||||
// Test edge cases
|
||||
if (job_id <= (cl_uint)lastSpecialJobIndex)
|
||||
{ // test edge cases
|
||||
{
|
||||
uint32_t x, y;
|
||||
|
||||
x = (job_id * buffer_elements) % specialValuesCount;
|
||||
@@ -254,7 +258,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
// Init any remaining values.
|
||||
// Init any remaining values
|
||||
for (; idx < buffer_elements; idx++)
|
||||
{
|
||||
((cl_ulong *)p)[idx] = genrand_int64(d);
|
||||
@@ -277,31 +281,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -197,24 +197,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
cl_float *s = 0;
|
||||
cl_float *s2 = 0;
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_int *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_int *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_int *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
cl_uint *p = (cl_uint *)gIn + thread_id * buffer_elements;
|
||||
@@ -224,8 +227,9 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
int totalSpecialValueCount = specialValuesCount * specialValuesCount;
|
||||
int lastSpecialJobIndex = (totalSpecialValueCount - 1) / buffer_elements;
|
||||
|
||||
// Test edge cases
|
||||
if (job_id <= (cl_uint)lastSpecialJobIndex)
|
||||
{ // test edge cases
|
||||
{
|
||||
float *fp = (float *)p;
|
||||
float *fp2 = (float *)p2;
|
||||
uint32_t x, y;
|
||||
@@ -247,7 +251,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
// Init any remaining values.
|
||||
// Init any remaining values
|
||||
for (; idx < buffer_elements; idx++)
|
||||
{
|
||||
p[idx] = genrand_int32(d);
|
||||
@@ -270,31 +274,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -86,24 +86,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
Force64BitFPUPrecision();
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_long *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_long *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_long *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Write the new values to the input array
|
||||
cl_double *p = (cl_double *)gIn + thread_id * buffer_elements;
|
||||
@@ -119,31 +122,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -89,24 +89,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
#define ref_func(s) (signbit_test ? func.i_f_f(s) : func.i_f(s))
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_int *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_int *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_int *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Init input array
|
||||
cl_uint *p = (cl_uint *)gIn + thread_id * buffer_elements;
|
||||
@@ -121,31 +124,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -113,18 +113,33 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,18 +114,33 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ static int gStopOnError = 0;
|
||||
static bool gSkipRestOfTests;
|
||||
int gForceFTZ = 0;
|
||||
int gWimpyMode = 0;
|
||||
int gHostFill = 0;
|
||||
static int gHasDouble = 0;
|
||||
static int gTestFloat = 1;
|
||||
// This flag should be 'ON' by default and it can be changed through the command
|
||||
@@ -421,6 +422,8 @@ static int ParseArgs(int argc, const char **argv)
|
||||
parseWimpyReductionFactor(arg, gWimpyReductionFactor);
|
||||
break;
|
||||
|
||||
case 'b': gHostFill ^= 1; break;
|
||||
|
||||
case 'z': gForceFTZ ^= 1; break;
|
||||
|
||||
case '1':
|
||||
@@ -550,6 +553,7 @@ static void PrintUsage(void)
|
||||
vlog("\t\t-[2^n]\tSet wimpy reduction factor, recommended range of n is "
|
||||
"1-10, default factor(%u)\n",
|
||||
gWimpyReductionFactor);
|
||||
vlog("\t\t-b\tFill buffers on host instead of device. (Default: off)\n");
|
||||
vlog("\t\t-z\tToggle FTZ mode (Section 6.5.3) for all functions. (Set by "
|
||||
"device capabilities by default.)\n");
|
||||
vlog("\t\t-v\tToggle Verbosity (Default: off)\n ");
|
||||
|
||||
@@ -218,18 +218,33 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,18 +240,33 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,24 +94,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
Force64BitFPUPrecision();
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_ulong *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_ulong *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Write the new values to the input array
|
||||
cl_double *p = (cl_double *)gIn + thread_id * buffer_elements;
|
||||
@@ -127,31 +130,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -100,24 +100,27 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
float half_sin_cos_tan_limit = job->half_sin_cos_tan_limit;
|
||||
int ftz = job->ftz;
|
||||
|
||||
// start the map of the output arrays
|
||||
cl_event e[VECTOR_SIZE_COUNT];
|
||||
cl_uint *out[VECTOR_SIZE_COUNT];
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
if (gHostFill)
|
||||
{
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
// start the map of the output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
out[j] = (cl_uint *)clEnqueueMapBuffer(
|
||||
tinfo->tQueue, tinfo->outBuf[j], CL_FALSE, CL_MAP_WRITE, 0,
|
||||
buffer_size, 0, NULL, e + j, &error);
|
||||
if (error || NULL == out[j])
|
||||
{
|
||||
vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
// Get that moving
|
||||
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
|
||||
}
|
||||
|
||||
// Write the new values to the input array
|
||||
cl_uint *p = (cl_uint *)gIn + thread_id * buffer_elements;
|
||||
@@ -156,31 +159,48 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
|
||||
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
// Wait for the map to finish
|
||||
if ((error = clWaitForEvents(1, e + j)))
|
||||
{
|
||||
vlog_error("Error: clWaitForEvents failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
if ((error = clReleaseEvent(e[j])))
|
||||
{
|
||||
vlog_error("Error: clReleaseEvent failed! err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the result buffer with garbage, so that old results don't carry
|
||||
// over
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
|
||||
out[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
memset_pattern4(out[j], &pattern, buffer_size);
|
||||
if ((error = clEnqueueUnmapMemObject(
|
||||
tinfo->tQueue, tinfo->outBuf[j], out[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(tinfo->tQueue, tinfo->outBuf[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
buffer_size, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// run the kernel
|
||||
// Run the kernel
|
||||
size_t vectorCount =
|
||||
(buffer_elements + sizeValues[j] - 1) / sizeValues[j];
|
||||
cl_kernel kernel = job->k[j][thread_id]; // each worker thread has its
|
||||
|
||||
@@ -106,28 +106,53 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j], CL_FALSE,
|
||||
0, BUFFER_SIZE, gOut2[j], 0, NULL,
|
||||
NULL)))
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut2[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 1 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer2[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 2 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,28 +122,53 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j], CL_FALSE,
|
||||
0, BUFFER_SIZE, gOut2[j], 0, NULL,
|
||||
NULL)))
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut2[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 1 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 2 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,28 +114,53 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j], CL_FALSE,
|
||||
0, BUFFER_SIZE, gOut2[j], 0, NULL,
|
||||
NULL)))
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut2[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 1 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer2[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 2 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,28 +119,53 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j], CL_FALSE,
|
||||
0, BUFFER_SIZE, gOut2[j], 0, NULL,
|
||||
NULL)))
|
||||
memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer2[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut2[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 1 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer2[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer 2 failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,18 +99,33 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,18 +106,33 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// write garbage into output arrays
|
||||
// Write garbage into output arrays
|
||||
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
if (gHostFill)
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gOutBuffer[j],
|
||||
CL_FALSE, 0, BUFFER_SIZE,
|
||||
gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error = clEnqueueFillBuffer(gQueue, gOutBuffer[j],
|
||||
&pattern, sizeof(pattern), 0,
|
||||
BUFFER_SIZE, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("Error: clEnqueueFillBuffer failed! err: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ extern int gSkipCorrectnessTesting;
|
||||
extern int gForceFTZ;
|
||||
extern int gFastRelaxedDerived;
|
||||
extern int gWimpyMode;
|
||||
extern int gHostFill;
|
||||
extern int gIsInRTZMode;
|
||||
extern int gInfNanSupport;
|
||||
extern int gIsEmbedded;
|
||||
|
||||
Reference in New Issue
Block a user