[Beignet] [PATCH] Runtime: don't use map_gtt for cl buffer.
Zhigang Gong
zhigang.gong at intel.com
Sat May 3 18:41:56 PDT 2014
We only need to map gtt for image. Map gtt may fail for
large buffers.
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
src/cl_api.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/cl_api.c b/src/cl_api.c
index 03a1cda..774ca8f 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -2172,9 +2172,16 @@ static cl_int _cl_map_mem(cl_mem mem, void **ptr, void **mem_ptr, size_t offset,
sub_offset = buffer->sub_offset;
}
- if (!(*ptr = cl_mem_map_gtt_unsync(mem))) {
- err = CL_MAP_FAILURE;
- goto error;
+ if (mem->type == CL_MEM_IMAGE_TYPE) {
+ if (!(*ptr = cl_mem_map_gtt_unsync(mem))) {
+ err = CL_MAP_FAILURE;
+ goto error;
+ }
+ } else {
+ if (!(*ptr = cl_mem_map(mem))) {
+ err = CL_MAP_FAILURE;
+ goto error;
+ }
}
*ptr = (char*)(*ptr) + offset + sub_offset;
if(mem->flags & CL_MEM_USE_HOST_PTR) {
--
1.8.3.2
More information about the Beignet
mailing list