From 148f1bd59daca39ce9c21286e29453d1b8bc6b43 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Thu, 22 Jul 2021 21:46:05 -0400 Subject: [PATCH] SWDEV-294597 - Fix hipNormalizedFloatValueTex Enable hipNormalizedFloatValueTex on AMD and NV. Add thresh_hold for comparing data. Change-Id: I3fe6dbc35a7b14aab11adf297b7885df83d28049 --- tests/src/texture/hipNormalizedFloatValueTex.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/src/texture/hipNormalizedFloatValueTex.cpp b/tests/src/texture/hipNormalizedFloatValueTex.cpp index 132f21c138..09a9246c01 100644 --- a/tests/src/texture/hipNormalizedFloatValueTex.cpp +++ b/tests/src/texture/hipNormalizedFloatValueTex.cpp @@ -21,13 +21,15 @@ THE SOFTWARE. */ /* HIT_START - * BUILD: %t %s ../test_common.cpp EXCLUDE_HIP_PLATFORM nvidia EXCLUDE_HIP_PLATFORM amd + * BUILD: %t %s ../test_common.cpp * TEST: %t * HIT_END */ #include "test_common.h" +#include #define SIZE 10 +#define THRESH_HOLD 0.02 static float getNormalizedValue(const float value, const hipChannelFormatDesc& desc) { @@ -94,9 +96,11 @@ bool textureTest(texture *tex) for(int i = 0; i < SIZE; i++) { float expected = getNormalizedValue(float(hData[i]), desc); - if(expected != hOutputData[i]) + float mean = (fabs(expected) + fabs(hOutputData[i])) / 2; + float ratio = fabs(expected - hOutputData[i]) / mean; + if(ratio > THRESH_HOLD) { - printf("mismatch at index:%d output:%f expected:%f\n",i,hOutputData[i],expected); + printf("mismatch at index:%d output:%f expected:%f, ratio:%f\n", i, hOutputData[i], expected, ratio); testResult = false; break; } @@ -120,6 +124,8 @@ int main(int argc, char** argv) std::cout << "Arch - AMD GPU :: " << props.gcnArch << std::endl; #endif + printf("THRESH_HOLD:%f\n", THRESH_HOLD); + status &= textureTest (&texc); status &= textureTest (&texuc); status &= textureTest (&texs);