From ba6961e0f4e69b87e0ae6676bd79e476fdec4bc5 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 25 Nov 2016 17:31:41 +0100 Subject: [PATCH] opencl: Fix OpenCL kernel code assertion for newer versions With Debian package beignet-opencl-icd 1.2.1-1, Tesseract + OpenCL fails: [DS] Profile file not available (tesseract_opencl_profile_devices.dat); performing profiling. [DS] Device: "Intel(R) HD Graphics IvyBridge M GT2" (OpenCL) evaluation... ASSERTION FAILED: sel.hasDoubleType() at file /home/geier/beignet/backend/src/backend/gen_insn_selection.cpp, function void gbe::ConvertInstructionPattern::convertDoubleToSmallInts(gbe::Selection::Opaque&, const gbe::ir::ConvertInstruction&, bool&) const, line 5269 Trace/breakpoint trap Using a pure float expression (instead of double) fixes this issue. Signed-off-by: Stefan Weil --- opencl/oclkernels.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opencl/oclkernels.h b/opencl/oclkernels.h index b353d0d87..010ca661b 100644 --- a/opencl/oclkernels.h +++ b/opencl/oclkernels.h @@ -1201,7 +1201,7 @@ KERNEL( unsigned int word = srcData[pixelIdx]; int output = (rwt * ((word >> RED_SHIFT) & 0xff) + gwt * ((word >> GREEN_SHIFT) & 0xff) + - bwt * ((word >> BLUE_SHIFT) & 0xff) + 0.5); + bwt * ((word >> BLUE_SHIFT) & 0xff) + 0.5f); // SET_DATA_BYTE dstData[pixelIdx] = output; }