Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
15 Views

problem of clEnqueueMapImage

Jump to solution

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

Accepted Solutions
Highlighted
15 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

0 Kudos
2 Replies
Highlighted
16 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

0 Kudos
Highlighted
Beginner
15 Views

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

0 Kudos