summaryrefslogtreecommitdiff
path: root/utests/compiler_fill_image_1d_array.cpp
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2015-02-04 12:51:04 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-02-04 18:10:57 +0800
commitf784052fa92005467ea3d2316be197b34fa32b8f (patch)
treec40da9e1e3d6c55733e8d4cda1c680ce53dc6342 /utests/compiler_fill_image_1d_array.cpp
parentc283eeb9481c7ed029552ff80abcc4141573b03a (diff)
downloadbeignet-f784052fa92005467ea3d2316be197b34fa32b8f.tar.gz
Fix a bug of 1d image array test case.
Because of the HW limitation, vertical stride is at least aligned to 2. For 1D array image, the data has interval. The image size is just twice as big as the buffer size we think. Use clEnqueueWriteImage is safe and fix this bug. Signed-off-by: Junyan He <junyan.he@linux.intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/compiler_fill_image_1d_array.cpp')
-rw-r--r--utests/compiler_fill_image_1d_array.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/utests/compiler_fill_image_1d_array.cpp b/utests/compiler_fill_image_1d_array.cpp
index cc7cf0a0..67f96436 100644
--- a/utests/compiler_fill_image_1d_array.cpp
+++ b/utests/compiler_fill_image_1d_array.cpp
@@ -10,6 +10,11 @@ static void compiler_fill_image_1d_array(void)
size_t origin[3] = { };
size_t region[3];
uint32_t* dst;
+ uint32_t* src;
+
+ region[0] = w;
+ region[1] = array;
+ region[2] = 1;
memset(&desc, 0x0, sizeof(cl_image_desc));
memset(&format, 0x0, sizeof(cl_image_format));
@@ -26,9 +31,9 @@ static void compiler_fill_image_1d_array(void)
OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL);
- OCL_MAP_BUFFER_GTT(0);
- memset(buf_data[0], 0, sizeof(uint32_t) * w * array);
- OCL_UNMAP_BUFFER_GTT(0);
+ src = (uint32_t*)malloc(w*array*sizeof(uint32_t));
+ memset(src, 0, sizeof(uint32_t) * w * array);
+ OCL_WRITE_IMAGE(buf[0], origin, region, src);
// Run the kernel
OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
@@ -39,9 +44,6 @@ static void compiler_fill_image_1d_array(void)
OCL_NDRANGE(2);
// Check result
- region[0] = w;
- region[1] = array;
- region[2] = 1;
dst = (uint32_t*)malloc(w*array*sizeof(uint32_t));
OCL_READ_IMAGE(buf[0], origin, region, dst);