diff options
author | Benjamin Segovia <benjamin.segovia@intel.com> | 2012-11-02 21:12:41 -0700 |
---|---|---|
committer | Benjamin Segovia <benjamin.segovia@intel.com> | 2012-11-02 21:12:41 -0700 |
commit | 96c13a11afdbbc61a8da60f2ec8d6527386541c2 (patch) | |
tree | b09c6cb13a81d92555ddee8f28e38e7ab7fa9f10 /utests/compiler_mandelbrot_alternate.cpp | |
parent | 2c49b307dfb9fca7943632d5b9de704c036da4ba (diff) | |
download | beignet-96c13a11afdbbc61a8da60f2ec8d6527386541c2.tar.gz |
- Added reference images for all the remaining tests that need them
- Added a lengthy comment on instruction selection
- Added some new patters to improve immediate matching
Diffstat (limited to 'utests/compiler_mandelbrot_alternate.cpp')
-rw-r--r-- | utests/compiler_mandelbrot_alternate.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/utests/compiler_mandelbrot_alternate.cpp b/utests/compiler_mandelbrot_alternate.cpp index 74fc7164..2e5d59fc 100644 --- a/utests/compiler_mandelbrot_alternate.cpp +++ b/utests/compiler_mandelbrot_alternate.cpp @@ -20,9 +20,8 @@ #include "utest_helper.hpp" static int *dst = NULL; -static const size_t w = 64; -static const size_t h = 64; -static const size_t iter = 4; +static const size_t w = 256; +static const size_t h = 256; static const float criterium = 4.f; static void compiler_mandelbrot_alternate(void) @@ -30,22 +29,25 @@ static void compiler_mandelbrot_alternate(void) const size_t global[2] = {w, h}; const size_t local[2] = {16, 1}; const size_t sz = w * h * sizeof(char[4]); - const float rcpW = 1.f / float(w); - const float rcpH = 1.f / float(h); + const float rcpWidth = 1.f / float(w); + const float rcpHeight = 1.f / float(h); OCL_CREATE_KERNEL("compiler_mandelbrot_alternate"); - cl_mem cl_dst = clCreateBuffer(ctx, 0, sz, NULL, NULL); - OCL_CALL (clSetKernelArg, kernel, 0, sizeof(cl_mem), &cl_dst); - OCL_CALL (clSetKernelArg, kernel, 1, sizeof(float), &rcpW); - OCL_CALL (clSetKernelArg, kernel, 2, sizeof(float), &rcpH); + OCL_CREATE_BUFFER(buf[0], 0, sz, NULL); + OCL_CALL (clSetKernelArg, kernel, 0, sizeof(cl_mem), &buf[0]); + OCL_CALL (clSetKernelArg, kernel, 1, sizeof(float), &rcpWidth); + OCL_CALL (clSetKernelArg, kernel, 2, sizeof(float), &rcpHeight); OCL_CALL (clSetKernelArg, kernel, 3, sizeof(float), &criterium); OCL_CALL (clEnqueueNDRangeKernel, queue, kernel, 2, NULL, global, local, 0, NULL, NULL); - dst = (int *) clIntelMapBuffer(cl_dst, NULL); + OCL_MAP_BUFFER(0); + dst = (int *) buf_data[0]; - cl_write_bmp(dst, w, h, "mandelbrot.bmp"); - OCL_CALL (clIntelUnmapBuffer, cl_dst); - OCL_CALL (clReleaseMemObject, cl_dst); + /* Save the image (for debug purpose) */ + cl_write_bmp(dst, w, h, "compiler_mandelbrot_alternate.bmp"); + + /* Compare with the golden image */ + OCL_CHECK_IMAGE(dst, w, h, "compiler_mandelbrot_alternate_ref.bmp"); } MAKE_UTEST_FROM_FUNCTION(compiler_mandelbrot_alternate); |