cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

bmerry
Journeyman III
Journeyman III

clEnqueueCopyImage returning CL_MEM_COPY_OVERLAP

Hi

I'm trying to use clEnqueueCopyImage to copy from one region of an image to another part of the same image. The specification says the error CL_MEM_COPY_OVERLAP is returned if "src_image and dst_image are the same image object and the source and destination regions overlap." I'm getting this error even though I'm using non-overlapping regions. There is a test case in the attachment, which fails on the 64-bit Linux build of APP SDK 2.8.

Does anyone have recommendations for a workaround? I'm considering writing a kernel that does the copy, but I'm not sure if it's well-defined to read and write from a single image within a single kernel. Otherwise I could copy via a temporary buffer, but that seems pretty wasteful.

Tags (2)
0 Kudos
Reply
3 Replies
binying
Challenger
Challenger

Re: clEnqueueCopyImage returning CL_MEM_COPY_OVERLAP

It's ok to write and read from a single buffer within a single kernel. Not sure about an image.

0 Kudos
Reply
nou
Exemplar
Exemplar

Re: clEnqueueCopyImage returning CL_MEM_COPY_OVERLAP

From image you can only read or write. Not both at once. It may work but it is under undefined behavior.

bmerry
Journeyman III
Journeyman III

Re: clEnqueueCopyImage returning CL_MEM_COPY_OVERLAP

Thanks. Kernel-based copy reading and writing the same image seems to be working for me, at least on the CPU, which is all I need it for at the moment.

0 Kudos
Reply