mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
ba879cd60f
Previously, OpenCL in-place flip kernels (rows/cols/both) could produce incorrect results compared to the CPU implementation on strict OpenCL drivers such as Mesa. The kernels relied on implicit load–load–store–store (LLSS) ordering when src and dst alias, which is not guaranteed by the OpenCL memory model and may be reordered. Some vendor drivers happened to preserve the expected ordering, masking the issue, but Mesa correctly exposes the undefined behavior. This change introduces dedicated in-place flip kernels that: - Explicitly detect in-place execution (src == dst) - Stage data through local memory tiles - Enforce correct ordering with work-group barriers - Avoid global memory read/write aliasing hazards The non in-place path is unchanged. With this fix, OpenCL in-place flip produces correct and consistent results across drivers, matches CPU behavior, and complies with the OpenCL memory model. Signed-off-by: jiajia Qian <jiajia.qian@nxp.com>