Hello,
we've detected suspicious behaviour of clEnqueueWriteBufferRect/clEnqueueCopyBufferRect functions which is demonstrated with simple test case attached. The test case depends on OpenCL API only. This work correctly on AMD Tahiti but not on Intel HD4400, HD4600.
The problem is in copying rectangle of interest with some specific parameters from whole image, which is kept in cl buffer.
The short description of test case:
1. create opencl buffer for whole image (not initialized)
2. copy to this buffer data a from aligned host memory rectangle with some specific parameters (using clEnqueueWriteBufferRect)
3. create opencl buffer for size of rectangle used on previous step (not initialized)
4. copy gpu data for the rectangle from whole image cl buffer to this rectangle-only cl buffer (using clEnqueueCopyBufferRect)
5. map rectangle-only cl buffer to host memory
6. compare content of original host data for rectangle with content of this mapped memory. It is expected to be exactly the same but it is not on our environment (HD4400).
Below is sample output
on AMD system:
C:\project\vdudnik\iocl-bug\build\Debug>iocl-bug.exe
AMD Accelerated Parallel Processing
OpenCL 1.2 AMD-APP (1445.5)
Advanced Micro Devices, Inc.
Tahiti
no mismatch found, test PASSED
on Intel system:
C:\dev\iocl-bug\build\Debug>iocl-bug.exe
Intel(R) OpenCL
OpenCL 1.2
Intel(R) Corporation
Intel(R) HD Graphics 4400
detetcted mismatch: [ 0 X 1 ], expected = 4, actual = 55
detetcted mismatch: [ 1 X 1 ], expected = 4, actual = 55
detetcted mismatch: [ 2 X 1 ], expected = 4, actual = 55
detetcted mismatch: [ 3 X 1 ], expected = 4, actual = 55
detetcted mismatch: [ 4 X 1 ], expected = 4, actual = 55
detetcted mismatch: [ 0 X 2 ], expected = 4, actual = 55
detetcted mismatch: [ 1 X 2 ], expected = 4, actual = 55
detetcted mismatch: [ 2 X 2 ], expected = 4, actual = 55
detetcted mismatch: [ 3 X 2 ], expected = 4, actual = 55
detetcted mismatch: [ 4 X 2 ], expected = 4, actual = 55
detetcted mismatch: [ 5 X 2 ], expected = 4, actual = 55
detetcted mismatch: [ 6 X 2 ], expected = 4, actual = 0
detetcted mismatch: [ 7 X 2 ], expected = 4, actual = 0
show only few first mismatches.., test FAILED
To build this test case CMake 3.1+ is required.
Regards,
Vladimir