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:
Steven Winston
2023-01-24 08:51:00 -08:00
committed by GitHub
parent 77e4fe5588
commit 4759159a50
29 changed files with 1027 additions and 506 deletions

View File

@@ -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

View File

@@ -222,9 +222,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_ulong *)clEnqueueMapBuffer(
@@ -240,6 +242,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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);
@@ -292,6 +296,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -304,20 +310,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -227,9 +227,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_uint *)clEnqueueMapBuffer(
@@ -245,6 +247,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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);
@@ -298,6 +302,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -310,20 +316,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -225,9 +225,11 @@ 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];
if (gHostFill)
{
// Start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_ulong *)clEnqueueMapBuffer(
@@ -243,6 +245,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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;
@@ -295,6 +299,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -307,20 +313,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -216,9 +216,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_uint *)clEnqueueMapBuffer(
@@ -234,6 +236,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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;
@@ -287,6 +290,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -299,20 +304,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -216,9 +216,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_ulong *)clEnqueueMapBuffer(
@@ -231,6 +233,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
return error;
}
}
}
// Get that moving
if ((error = clFlush(tinfo->tQueue))) vlog("clFlush failed\n");
@@ -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);
@@ -286,6 +290,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -298,20 +304,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -213,9 +213,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_uint *)clEnqueueMapBuffer(
@@ -231,6 +233,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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);
@@ -300,6 +303,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -312,20 +317,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -146,30 +146,55 @@ 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",
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)))
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",
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2b(%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 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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -149,30 +149,55 @@ 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",
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)))
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",
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2b(%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 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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -107,20 +107,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -106,20 +106,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -208,9 +208,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_long *)clEnqueueMapBuffer(
@@ -226,6 +228,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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);
@@ -276,6 +280,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -288,20 +294,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -197,9 +197,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_int *)clEnqueueMapBuffer(
@@ -215,6 +217,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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);
@@ -269,6 +273,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -281,20 +287,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -86,9 +86,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_long *)clEnqueueMapBuffer(
@@ -104,6 +106,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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;
@@ -118,6 +121,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -130,20 +135,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -89,9 +89,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_int *)clEnqueueMapBuffer(
@@ -107,6 +109,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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;
@@ -120,6 +123,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -132,20 +137,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -113,20 +113,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -114,20 +114,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -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 ");

View File

@@ -218,20 +218,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -240,20 +240,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -94,9 +94,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_ulong *)clEnqueueMapBuffer(
@@ -112,6 +114,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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;
@@ -126,6 +129,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -138,20 +143,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -100,9 +100,11 @@ 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];
if (gHostFill)
{
// start the map of the output arrays
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
out[j] = (cl_uint *)clEnqueueMapBuffer(
@@ -118,6 +120,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
// 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;
@@ -155,6 +158,8 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
}
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
if (gHostFill)
{
// Wait for the map to finish
if ((error = clWaitForEvents(1, e + j)))
@@ -167,20 +172,35 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
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;
if (gHostFill)
{
memset_pattern4(out[j], &pattern, buffer_size);
if ((error = clEnqueueUnmapMemObject(tinfo->tQueue, tinfo->outBuf[j],
out[j], 0, NULL, NULL)))
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

View File

@@ -106,30 +106,55 @@ 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",
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)))
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",
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2b(%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 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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -122,30 +122,55 @@ 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",
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)))
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",
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2b(%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 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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -114,30 +114,55 @@ 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",
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)))
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",
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2b(%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 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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -119,30 +119,55 @@ 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",
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)))
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",
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2b(%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 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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -99,20 +99,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -106,20 +106,35 @@ 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",
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;
}
}
}
// Run the kernels
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)

View File

@@ -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;