Memory object mapped for reading should be unmapped before a kernel writes to it
Detected with oclgrind.
According to the clEnqueueMapBuffer documentation:
If a memory object is currently mapped for reading, the application must ensure that the memory object is unmapped before any enqueued kernels or commands that write to this memory object or any of its associated memory objects (sub-buffer or 1D image buffer objects) or its parent object (if the memory object is a sub-buffer or 1D image buffer object) begin execution; otherwise the behavior is undefined.
The maps perfomed in master
and in debugfastergrad
branches are followed by
kernel2 executions as in master and
Such kernel2 writes that memory object.
Therefore, the aforementioned map call should be followed by an unmap call before kernel2 is invoked (or any kernel that writes to the memory object being mapped).