The version of clEnqueueReadBuffer that reads into a java array does not work correctly when doing non-blocking reads. The reason is that the java array itself is pinned in memory using GetPrimitiveArrayCritical only for the duration of the call. So, sometimes the array is moved before the read completes (frequently enough that I eventually found out what is wrong...). Therefore having the parameter to select whether to block or not does not make sense.
I understand that the function itself is generated, but some possible fixes could be 1) remove the blocking_read argument from the function that reads into a java array, 2) add an assertion so that calling the function with blocking_read==false is caught, 3) at least document this problem somewhere.
As for 3), I haven't really found the tutorials and other docs to be incorrect, but they refer to possible non-blocking reads (which works fine for ByteBuffers). Since buffers created, e.g., with BufferUtils.createIntBuffer do not support the array() method sometimes using the methods that take java arrays as arguments is really useful.
Staffan