From 43fc5cd712eed23b9cec340f526e6d5fb5050afa Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Thu, 12 Oct 2017 11:05:18 +0100 Subject: COMPMID-618: Fix mismatches in CLDepthConvert Oclgrind Out-of-bounds float to integer conversion is implementation defined. Oclgrind converts to S32 and truncated while GPU converts S32 and clamps. We force to always SATURATE for float to int conversion. Change-Id: I82be9e8cdcc49b32adb8c0da064542b63f891666 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/91512 Tested-by: Kaizen Reviewed-by: Michalis Spyrou --- src/core/CL/kernels/CLDepthConvertKernel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/CL/kernels/CLDepthConvertKernel.cpp b/src/core/CL/kernels/CLDepthConvertKernel.cpp index c43884a509..b2132073d5 100644 --- a/src/core/CL/kernels/CLDepthConvertKernel.cpp +++ b/src/core/CL/kernels/CLDepthConvertKernel.cpp @@ -90,7 +90,8 @@ void CLDepthConvertKernel::configure(const ICLTensor *input, ICLTensor *output, if(input_size > output_size) { kernel_name += "_down"; - build_opts.insert((policy == ConvertPolicy::WRAP) ? "-DWRAP" : "-DSATURATE"); + // Down conversions from float always SATURATE as out-of-bounds conversion from float->integer is implementation defined + build_opts.insert(((policy == ConvertPolicy::WRAP) && !is_data_type_float(input->info()->data_type())) ? "-DWRAP" : "-DSATURATE"); } else { -- cgit v1.2.1