From c7b682f12af7a263ccf661eaef9bbb220663004d Mon Sep 17 00:00:00 2001 From: Harald van Dijk Date: Tue, 25 Jun 2024 17:47:55 +0100 Subject: [PATCH] spirv_new: fix test_decorate. (#1980) test_decorate was checking for half-precision NAN incorrectly, calling cl_half_from_float where cl_half_to_float was intended, causing a wrong expected result. test_decorate was also printing the expected and actual results reversed, printing "got -1, want 0", when our implementation already returned 0. --- test_conformance/spirv_new/test_decorate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_conformance/spirv_new/test_decorate.cpp b/test_conformance/spirv_new/test_decorate.cpp index 4c2f82b5..3a1f422a 100644 --- a/test_conformance/spirv_new/test_decorate.cpp +++ b/test_conformance/spirv_new/test_decorate.cpp @@ -229,7 +229,7 @@ static inline To compute_saturated_output(Ti lhs, Ti rhs) f = cl_half_to_float(cl_half_from_float(f, CL_HALF_RTE)); To val = (To)std::min(std::max(f, loVal), hiVal); - if (isnan(cl_half_from_float(rhs, CL_HALF_RTE))) + if (isnan(cl_half_to_float(rhs))) { val = 0; } @@ -309,7 +309,7 @@ int verify_saturated_results(cl_device_id deviceID, cl_context context, if (val != h_res[i]) { - log_error("Value error at %d: got %d, want %d\n", i, val, h_res[i]); + log_error("Value error at %d: got %d, want %d\n", i, h_res[i], val); return -1; } }