diff --git a/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.cpp b/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.cpp index a9d96bcc20..cd6ea46eb5 100644 --- a/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.cpp +++ b/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.cpp @@ -72,7 +72,7 @@ void OCLCreateBuffer::open(unsigned int test, char *units, double &conversion, void OCLCreateBuffer::run(void) { CPerfCounter timer; - cl_ulong pattern = PATTERN_20_64BIT; + cl_uchar pattern = PATTERN; timer.Reset(); timer.Start(); error_ = /*_wrapper->*/ clEnqueueFillBuffer( @@ -90,20 +90,22 @@ void OCLCreateBuffer::run(void) { } #endif void *resultBuf = NULL; - + ; while ((resultBuf = malloc(maxSteps)) == NULL) { maxSteps /= 2; continue; } - checkResult(maxSteps, resultBuf, PATTERN_20_64BIT); + checkResult(maxSteps, resultBuf, pattern); - memset(resultBuf, PATTERN_2A_08BIT, maxSteps); + pattern += 1; + + memset(resultBuf, pattern, maxSteps); writeBuffer(maxSteps, resultBuf); memset(resultBuf, 0x00, maxSteps); - checkResult(maxSteps, resultBuf, PATTERN_2A_64BIT); + checkResult(maxSteps, resultBuf, pattern); free(resultBuf); @@ -125,7 +127,7 @@ void OCLCreateBuffer::run(void) { } void OCLCreateBuffer::checkResult(size_t maxSteps, void *resultBuf, - cl_ulong pattern) { + cl_uchar pattern) { size_t startPoint = 0; while ((startPoint) < maxSize_) { cl_event ee; @@ -138,16 +140,14 @@ void OCLCreateBuffer::checkResult(size_t maxSteps, void *resultBuf, resultBuf, 0, NULL, &ee); CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueReadBuffer() failed"); _wrapper->clFinish(cmdQueues_[_deviceId]); - - size_t err_cnt = 0, chk_cnt = readSize / sizeof(cl_ulong); - cl_ulong *cc = (cl_ulong *)resultBuf; - - for (size_t i = 0; i < chk_cnt; i++) { + size_t cnt = 0; + cl_uchar *cc = (cl_uchar *)resultBuf; + for (size_t i = 0; i < readSize; i++) { if (cc[i] != pattern) { - err_cnt++; + cnt++; } } - if (err_cnt != 0) { + if (cnt != 0) { error_ = -1; CHECK_RESULT((error_ != CL_SUCCESS), "checkResult() failed"); break; diff --git a/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.h b/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.h index 2c63984096..d02117c5b8 100644 --- a/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.h +++ b/opencl/tests/ocltst/module/runtime/OCLCreateBuffer.h @@ -22,10 +22,7 @@ #define _OCL_CREATE_BUFFER_H_ #include "OCLTestImp.h" -#define PATTERN_20_08BIT 0x20 -#define PATTERN_20_64BIT 0x2020202020202020 -#define PATTERN_2A_08BIT 0x2a -#define PATTERN_2A_64BIT 0x2a2a2a2a2a2a2a2a +#define PATTERN 0x20 class OCLCreateBuffer : public OCLTestImp { public: @@ -37,7 +34,8 @@ class OCLCreateBuffer : public OCLTestImp { unsigned int deviceID); virtual void run(void); virtual void writeBuffer(size_t tmpMaxSize, void* dataBuf); - virtual void checkResult(size_t tmpMaxSize, void* resultBuf, cl_ulong pattern); + virtual void checkResult(size_t tmpMaxSize, void* resultBuf, + cl_uchar pattern); virtual unsigned int close(void); private: