diff options
author | Guo Yejun <yejun.guo@intel.com> | 2016-08-02 04:16:19 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-08-03 18:20:22 +0800 |
commit | 8030099e578c57f71e9abc89b05ce23dc34e6618 (patch) | |
tree | 8065e61ae3dafba4224d4e7be3954ccd07320bf7 /utests/runtime_use_host_ptr_image.cpp | |
parent | aa077d9279cedc28704d02444e26fab0f77f3bbd (diff) | |
download | beignet-8030099e578c57f71e9abc89b05ce23dc34e6618.tar.gz |
use different pointer alignment for different implementation
beignet only requirs 64 bytes alignment while other implementations
might require 4096 alignment.
and also change function cl_check_beignet for better output message.
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/runtime_use_host_ptr_image.cpp')
-rw-r--r-- | utests/runtime_use_host_ptr_image.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utests/runtime_use_host_ptr_image.cpp b/utests/runtime_use_host_ptr_image.cpp index 2de9194a..4a30e891 100644 --- a/utests/runtime_use_host_ptr_image.cpp +++ b/utests/runtime_use_host_ptr_image.cpp @@ -18,8 +18,12 @@ static void runtime_use_host_ptr_image(void) desc.image_width = w; desc.image_height = h; + size_t alignment = 4096; //page size + if (cl_check_beignet()) + alignment = 64; //cacheline size, beignet has loose limitaiont to enable userptr + //src image - int ret = posix_memalign(&buf_data[0], 64, sizeof(uint32_t) * w * h); + int ret = posix_memalign(&buf_data[0], alignment, sizeof(uint32_t) * w * h); OCL_ASSERT(ret == 0); for (size_t i = 0; i < w*h; ++i) ((uint32_t*)buf_data[0])[i] = i; @@ -27,7 +31,7 @@ static void runtime_use_host_ptr_image(void) OCL_CREATE_IMAGE(buf[0], CL_MEM_USE_HOST_PTR, &format, &desc, buf_data[0]); //dst image - ret = posix_memalign(&buf_data[1], 64, sizeof(uint32_t) * w * h); + ret = posix_memalign(&buf_data[1], alignment, sizeof(uint32_t) * w * h); OCL_ASSERT(ret == 0); for (size_t i = 0; i < w*h; ++i) ((uint32_t*)buf_data[1])[i] = 0; |