OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1664 Discussions

problem of clEnqueueMapImage

wu__frank
Beginner
219 Views

Recently I use VME to derive MVs information and I need Write Source and Reference image into memory. I use clEnqueueMapImage to do this operation as follows: (host to device side)

size_t pitch;

unsigned char* dst = (unsigned char*)clEnqueueMapImage(queue, srcImage, CL_TRUE,CL_MAP_WRITE, offset, region, &pitch,0, 0, NULL, NULL, &err);

unsigned char*  src = YBuffer;

for(i, i<height; i++)

{

memcpy(dst, src, sizeof(unsigned char)*width);

src+=src_pitch;

dst += pitch;

}

clEnqueueUnmapMemObject(queue, srcImage, dst,0, NULL, NULL);

The simulation results show wrong data. all MVs are a fix value (-64, -48). However when I use clEnqueueWriteImage, the result is correct. I don't know if the usage of Map/Unmap operation not correct? Thanks a lot.

0 Kudos
1 Solution
Jeffrey_M_Intel1
Employee
219 Views

Depending on how the image was created, you may be missing out on the conversion to tiled memory layout that you would get with clEnqueWriteImage. 

The driver may be able to help automate the conversion so you can still use mapping.  For more information see:

https://software.intel.com/en-us/articles/getting-the-most-from-opencl-12-how-to-increase-performanc...

 

 

 

View solution in original post

2 Replies
Jeffrey_M_Intel1
Employee
220 Views

Depending on how the image was created, you may be missing out on the conversion to tiled memory layout that you would get with clEnqueWriteImage. 

The driver may be able to help automate the conversion so you can still use mapping.  For more information see:

https://software.intel.com/en-us/articles/getting-the-most-from-opencl-12-how-to-increase-performanc...

 

 

 

wu__frank
Beginner
219 Views

Jeffrey, thank you so much for quickly reply. I have found the question. and fixed this problem.

Reply