From 0a8c5feed73d9480fef1df8efb221ae3c4863729 Mon Sep 17 00:00:00 2001 From: james-morrissey-arm Date: Mon, 19 Oct 2020 13:57:01 +0100 Subject: [PATCH] Fix floating point validation in write_image tests (#1017) Fix validate_float/half_write_results so that when nan/inf is encountered on a channel, the rest of the channel values are still considered for correctness. Signed-off-by: John Kesapides Signed-off-by: James Morrissey Co-authored-by: John Kesapides --- .../images/kernel_read_write/test_iterations.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test_conformance/images/kernel_read_write/test_iterations.cpp b/test_conformance/images/kernel_read_write/test_iterations.cpp index 7281564b..c518b768 100644 --- a/test_conformance/images/kernel_read_write/test_iterations.cpp +++ b/test_conformance/images/kernel_read_write/test_iterations.cpp @@ -1174,8 +1174,11 @@ bool validate_float_write_results( float *expected, float *actual, image_descrip continue; if ( IsFloatSubnormal( expected[j] ) && actual[j] == 0.0f ) continue; - pass = false; - break; + if (expected[j] != actual[j]) + { + pass = false; + break; + } } } return pass; @@ -1193,8 +1196,11 @@ bool validate_half_write_results( cl_half *expected, cl_half *actual, image_desc continue; if ( is_half_denorm( expected[j] ) && is_half_zero( actual[j] ) ) continue; - pass = false; - break; + if (expected[j] != actual[j]) + { + pass = false; + break; + } } } return pass;