diff --git a/test_conformance/conversions/run_batch b/test_conformance/conversions/run_batch index a99abeee..dcd6aa51 100644 --- a/test_conformance/conversions/run_batch +++ b/test_conformance/conversions/run_batch @@ -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 diff --git a/test_conformance/math_brute_force/binary_double.cpp b/test_conformance/math_brute_force/binary_double.cpp index 8ce9f67d..431bcab5 100644 --- a/test_conformance/math_brute_force/binary_double.cpp +++ b/test_conformance/math_brute_force/binary_double.cpp @@ -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 diff --git a/test_conformance/math_brute_force/binary_float.cpp b/test_conformance/math_brute_force/binary_float.cpp index ace1fadf..f964920c 100644 --- a/test_conformance/math_brute_force/binary_float.cpp +++ b/test_conformance/math_brute_force/binary_float.cpp @@ -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 diff --git a/test_conformance/math_brute_force/binary_i_double.cpp b/test_conformance/math_brute_force/binary_i_double.cpp index 2e08996a..3b4d1e4b 100644 --- a/test_conformance/math_brute_force/binary_i_double.cpp +++ b/test_conformance/math_brute_force/binary_i_double.cpp @@ -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 diff --git a/test_conformance/math_brute_force/binary_i_float.cpp b/test_conformance/math_brute_force/binary_i_float.cpp index 174f58c7..5c8e7224 100644 --- a/test_conformance/math_brute_force/binary_i_float.cpp +++ b/test_conformance/math_brute_force/binary_i_float.cpp @@ -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 diff --git a/test_conformance/math_brute_force/binary_operator_double.cpp b/test_conformance/math_brute_force/binary_operator_double.cpp index a96f8f6a..2d202e9f 100644 --- a/test_conformance/math_brute_force/binary_operator_double.cpp +++ b/test_conformance/math_brute_force/binary_operator_double.cpp @@ -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 diff --git a/test_conformance/math_brute_force/binary_operator_float.cpp b/test_conformance/math_brute_force/binary_operator_float.cpp index 68497de5..cc91a3a3 100644 --- a/test_conformance/math_brute_force/binary_operator_float.cpp +++ b/test_conformance/math_brute_force/binary_operator_float.cpp @@ -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 diff --git a/test_conformance/math_brute_force/binary_two_results_i_double.cpp b/test_conformance/math_brute_force/binary_two_results_i_double.cpp index f3a5088d..cc5b2886 100644 --- a/test_conformance/math_brute_force/binary_two_results_i_double.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i_double.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/binary_two_results_i_float.cpp b/test_conformance/math_brute_force/binary_two_results_i_float.cpp index 3bff093d..12545898 100644 --- a/test_conformance/math_brute_force/binary_two_results_i_float.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i_float.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/i_unary_double.cpp b/test_conformance/math_brute_force/i_unary_double.cpp index 4c6545a2..90cef3ff 100644 --- a/test_conformance/math_brute_force/i_unary_double.cpp +++ b/test_conformance/math_brute_force/i_unary_double.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/i_unary_float.cpp b/test_conformance/math_brute_force/i_unary_float.cpp index ffae1321..a66aa9f4 100644 --- a/test_conformance/math_brute_force/i_unary_float.cpp +++ b/test_conformance/math_brute_force/i_unary_float.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/macro_binary_double.cpp b/test_conformance/math_brute_force/macro_binary_double.cpp index 14a6b732..6398d851 100644 --- a/test_conformance/math_brute_force/macro_binary_double.cpp +++ b/test_conformance/math_brute_force/macro_binary_double.cpp @@ -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 diff --git a/test_conformance/math_brute_force/macro_binary_float.cpp b/test_conformance/math_brute_force/macro_binary_float.cpp index 12eff3b9..67212563 100644 --- a/test_conformance/math_brute_force/macro_binary_float.cpp +++ b/test_conformance/math_brute_force/macro_binary_float.cpp @@ -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 diff --git a/test_conformance/math_brute_force/macro_unary_double.cpp b/test_conformance/math_brute_force/macro_unary_double.cpp index 10de39dd..dd196a1c 100644 --- a/test_conformance/math_brute_force/macro_unary_double.cpp +++ b/test_conformance/math_brute_force/macro_unary_double.cpp @@ -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 diff --git a/test_conformance/math_brute_force/macro_unary_float.cpp b/test_conformance/math_brute_force/macro_unary_float.cpp index c1335cce..f4cfdc85 100644 --- a/test_conformance/math_brute_force/macro_unary_float.cpp +++ b/test_conformance/math_brute_force/macro_unary_float.cpp @@ -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 diff --git a/test_conformance/math_brute_force/mad_double.cpp b/test_conformance/math_brute_force/mad_double.cpp index 589eda9e..db202b3f 100644 --- a/test_conformance/math_brute_force/mad_double.cpp +++ b/test_conformance/math_brute_force/mad_double.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/mad_float.cpp b/test_conformance/math_brute_force/mad_float.cpp index 513f20dc..ff98f2c4 100644 --- a/test_conformance/math_brute_force/mad_float.cpp +++ b/test_conformance/math_brute_force/mad_float.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/main.cpp b/test_conformance/math_brute_force/main.cpp index ab75efd5..df162f28 100644 --- a/test_conformance/math_brute_force/main.cpp +++ b/test_conformance/math_brute_force/main.cpp @@ -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 "); diff --git a/test_conformance/math_brute_force/ternary_double.cpp b/test_conformance/math_brute_force/ternary_double.cpp index cf88b526..a21fbf37 100644 --- a/test_conformance/math_brute_force/ternary_double.cpp +++ b/test_conformance/math_brute_force/ternary_double.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/ternary_float.cpp b/test_conformance/math_brute_force/ternary_float.cpp index 949fc488..5584f153 100644 --- a/test_conformance/math_brute_force/ternary_float.cpp +++ b/test_conformance/math_brute_force/ternary_float.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/unary_double.cpp b/test_conformance/math_brute_force/unary_double.cpp index 154cda1b..368f065f 100644 --- a/test_conformance/math_brute_force/unary_double.cpp +++ b/test_conformance/math_brute_force/unary_double.cpp @@ -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 diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index 740cddad..3d328981 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -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 diff --git a/test_conformance/math_brute_force/unary_two_results_double.cpp b/test_conformance/math_brute_force/unary_two_results_double.cpp index 9cb0269f..5e5b6bfa 100644 --- a/test_conformance/math_brute_force/unary_two_results_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_double.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/unary_two_results_float.cpp b/test_conformance/math_brute_force/unary_two_results_float.cpp index fd7b0e68..b2f253fd 100644 --- a/test_conformance/math_brute_force/unary_two_results_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_float.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/unary_two_results_i_double.cpp b/test_conformance/math_brute_force/unary_two_results_i_double.cpp index 54c8b213..25c0db49 100644 --- a/test_conformance/math_brute_force/unary_two_results_i_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i_double.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/unary_two_results_i_float.cpp b/test_conformance/math_brute_force/unary_two_results_i_float.cpp index 8f7307d9..faa9d92b 100644 --- a/test_conformance/math_brute_force/unary_two_results_i_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i_float.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/unary_u_double.cpp b/test_conformance/math_brute_force/unary_u_double.cpp index 625556f7..ae2ae5be 100644 --- a/test_conformance/math_brute_force/unary_u_double.cpp +++ b/test_conformance/math_brute_force/unary_u_double.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/unary_u_float.cpp b/test_conformance/math_brute_force/unary_u_float.cpp index 5bc9e9ff..0bdbcebe 100644 --- a/test_conformance/math_brute_force/unary_u_float.cpp +++ b/test_conformance/math_brute_force/unary_u_float.cpp @@ -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; + } } } diff --git a/test_conformance/math_brute_force/utility.h b/test_conformance/math_brute_force/utility.h index 2072c56b..78df4739 100644 --- a/test_conformance/math_brute_force/utility.h +++ b/test_conformance/math_brute_force/utility.h @@ -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;