From 5be093e0c84b350a284ef6a77efed579a7e66af7 Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Tue, 6 Aug 2024 18:26:38 +0200 Subject: [PATCH] math_brute_force: skip all enqueues in -l mode (#1993) The math_brute_force test has a link-check-only mode to quickly test if all math functions are present. In link-check-only mode, most tests return immediately after kernel compilation, but some tests also run the kernel and read back the result data before returning. Running the kernels takes a lot more time, defeating the purpose of the `-l` mode. Break out at the start of the main `for` loops in link-check-only mode instead of returning directly, so that each test can still log its trailing message (in most cases just a `\n`). Signed-off-by: Sven van Haastregt --- .../math_brute_force/binary_two_results_i_double.cpp | 4 ++-- .../math_brute_force/binary_two_results_i_float.cpp | 4 ++-- .../math_brute_force/binary_two_results_i_half.cpp | 4 ++-- test_conformance/math_brute_force/i_unary_double.cpp | 4 ++-- test_conformance/math_brute_force/i_unary_float.cpp | 4 ++-- test_conformance/math_brute_force/i_unary_half.cpp | 4 ++-- test_conformance/math_brute_force/mad_double.cpp | 4 ++-- test_conformance/math_brute_force/mad_float.cpp | 4 ++-- test_conformance/math_brute_force/mad_half.cpp | 4 ++-- test_conformance/math_brute_force/ternary_double.cpp | 4 ++-- test_conformance/math_brute_force/ternary_float.cpp | 4 ++-- test_conformance/math_brute_force/ternary_half.cpp | 4 ++-- .../math_brute_force/unary_two_results_double.cpp | 4 ++-- .../math_brute_force/unary_two_results_float.cpp | 8 ++------ .../math_brute_force/unary_two_results_half.cpp | 8 ++------ .../math_brute_force/unary_two_results_i_double.cpp | 4 ++-- .../math_brute_force/unary_two_results_i_float.cpp | 4 ++-- .../math_brute_force/unary_two_results_i_half.cpp | 4 ++-- test_conformance/math_brute_force/unary_u_double.cpp | 4 ++-- test_conformance/math_brute_force/unary_u_float.cpp | 4 ++-- test_conformance/math_brute_force/unary_u_half.cpp | 4 ++-- 21 files changed, 42 insertions(+), 50 deletions(-) diff --git a/test_conformance/math_brute_force/binary_two_results_i_double.cpp b/test_conformance/math_brute_force/binary_two_results_i_double.cpp index 0dc5b9f9..ec244c17 100644 --- a/test_conformance/math_brute_force/binary_two_results_i_double.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i_double.cpp @@ -104,6 +104,8 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array double *p = (double *)gIn; double *p2 = (double *)gIn2; @@ -264,8 +266,6 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint64_t *t = (uint64_t *)gOut_Ref; int32_t *t2 = (int32_t *)gOut_Ref2; diff --git a/test_conformance/math_brute_force/binary_two_results_i_float.cpp b/test_conformance/math_brute_force/binary_two_results_i_float.cpp index 7742076f..36d71898 100644 --- a/test_conformance/math_brute_force/binary_two_results_i_float.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i_float.cpp @@ -106,6 +106,8 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_uint *p = (cl_uint *)gIn; cl_uint *p2 = (cl_uint *)gIn2; @@ -266,8 +268,6 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; int32_t *t2 = (int32_t *)gOut_Ref2; diff --git a/test_conformance/math_brute_force/binary_two_results_i_half.cpp b/test_conformance/math_brute_force/binary_two_results_i_half.cpp index adeada7c..c5efabe5 100644 --- a/test_conformance/math_brute_force/binary_two_results_i_half.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i_half.cpp @@ -104,6 +104,8 @@ int TestFunc_HalfI_Half_Half(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_half *p = (cl_half *)gIn; cl_half *p2 = (cl_half *)gIn2; @@ -257,8 +259,6 @@ int TestFunc_HalfI_Half_Half(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data cl_half *t = (cl_half *)gOut_Ref; int32_t *t2 = (int32_t *)gOut_Ref2; diff --git a/test_conformance/math_brute_force/i_unary_double.cpp b/test_conformance/math_brute_force/i_unary_double.cpp index 2ed80874..c2c7963f 100644 --- a/test_conformance/math_brute_force/i_unary_double.cpp +++ b/test_conformance/math_brute_force/i_unary_double.cpp @@ -64,6 +64,8 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array double *p = (double *)gIn; if (gWimpyMode) @@ -163,8 +165,6 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; for (size_t j = 0; j < BUFFER_SIZE / sizeof(cl_double); j++) diff --git a/test_conformance/math_brute_force/i_unary_float.cpp b/test_conformance/math_brute_force/i_unary_float.cpp index 0df35c4a..eed76a6e 100644 --- a/test_conformance/math_brute_force/i_unary_float.cpp +++ b/test_conformance/math_brute_force/i_unary_float.cpp @@ -63,6 +63,8 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_uint *p = (cl_uint *)gIn; if (gWimpyMode) @@ -162,8 +164,6 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; for (size_t j = 0; j < BUFFER_SIZE / sizeof(float); j++) diff --git a/test_conformance/math_brute_force/i_unary_half.cpp b/test_conformance/math_brute_force/i_unary_half.cpp index 3a8991a3..97955f93 100644 --- a/test_conformance/math_brute_force/i_unary_half.cpp +++ b/test_conformance/math_brute_force/i_unary_half.cpp @@ -73,6 +73,8 @@ int TestFunc_Int_Half(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 16); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_ushort *p = (cl_ushort *)gIn; @@ -160,8 +162,6 @@ int TestFunc_Int_Half(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; for (size_t j = 0; j < bufferElements; j++) diff --git a/test_conformance/math_brute_force/mad_double.cpp b/test_conformance/math_brute_force/mad_double.cpp index 623d59ce..b6a6742f 100644 --- a/test_conformance/math_brute_force/mad_double.cpp +++ b/test_conformance/math_brute_force/mad_double.cpp @@ -61,6 +61,8 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array double *p = (double *)gIn; double *p2 = (double *)gIn2; @@ -186,8 +188,6 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data -- No verification possible. // MAD is a random number generator. if (0 == (i & 0x0fffffff)) diff --git a/test_conformance/math_brute_force/mad_float.cpp b/test_conformance/math_brute_force/mad_float.cpp index 3127cca0..3f237ed9 100644 --- a/test_conformance/math_brute_force/mad_float.cpp +++ b/test_conformance/math_brute_force/mad_float.cpp @@ -62,6 +62,8 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_uint *p = (cl_uint *)gIn; cl_uint *p2 = (cl_uint *)gIn2; @@ -187,8 +189,6 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data -- No verification possible. // MAD is a random number generator. if (0 == (i & 0x0fffffff)) diff --git a/test_conformance/math_brute_force/mad_half.cpp b/test_conformance/math_brute_force/mad_half.cpp index b6cdda64..33235534 100644 --- a/test_conformance/math_brute_force/mad_half.cpp +++ b/test_conformance/math_brute_force/mad_half.cpp @@ -63,6 +63,8 @@ int TestFunc_mad_Half(const Func *f, MTdata d, bool relaxedMode) } for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_ushort *p = (cl_ushort *)gIn; cl_ushort *p2 = (cl_ushort *)gIn2; @@ -173,8 +175,6 @@ int TestFunc_mad_Half(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data - no verification possible. MAD is a random number // generator. diff --git a/test_conformance/math_brute_force/ternary_double.cpp b/test_conformance/math_brute_force/ternary_double.cpp index 2ae65424..62adbf29 100644 --- a/test_conformance/math_brute_force/ternary_double.cpp +++ b/test_conformance/math_brute_force/ternary_double.cpp @@ -141,6 +141,8 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array double *p = (double *)gIn; double *p2 = (double *)gIn2; @@ -291,8 +293,6 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, } } - if (gSkipCorrectnessTesting) break; - // Verify data uint64_t *t = (uint64_t *)gOut_Ref; for (size_t j = 0; j < BUFFER_SIZE / sizeof(double); j++) diff --git a/test_conformance/math_brute_force/ternary_float.cpp b/test_conformance/math_brute_force/ternary_float.cpp index d11f4ba3..3e024b1e 100644 --- a/test_conformance/math_brute_force/ternary_float.cpp +++ b/test_conformance/math_brute_force/ternary_float.cpp @@ -159,6 +159,8 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_uint *p = (cl_uint *)gIn; cl_uint *p2 = (cl_uint *)gIn2; @@ -328,8 +330,6 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; for (size_t j = 0; j < BUFFER_SIZE / sizeof(float); j++) diff --git a/test_conformance/math_brute_force/ternary_half.cpp b/test_conformance/math_brute_force/ternary_half.cpp index 18075379..a7aa9303 100644 --- a/test_conformance/math_brute_force/ternary_half.cpp +++ b/test_conformance/math_brute_force/ternary_half.cpp @@ -94,6 +94,8 @@ int TestFunc_Half_Half_Half_Half(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_half *hp0 = (cl_half *)gIn; cl_half *hp1 = (cl_half *)gIn2; @@ -262,8 +264,6 @@ int TestFunc_Half_Half_Half_Half(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint16_t *t = (uint16_t *)gOut_Ref; for (size_t j = 0; j < bufferElements; j++) diff --git a/test_conformance/math_brute_force/unary_two_results_double.cpp b/test_conformance/math_brute_force/unary_two_results_double.cpp index f464c791..4d660e0a 100644 --- a/test_conformance/math_brute_force/unary_two_results_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_double.cpp @@ -67,6 +67,8 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array double *p = (double *)gIn; if (gWimpyMode) @@ -203,8 +205,6 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint64_t *t = (uint64_t *)gOut_Ref; uint64_t *t2 = (uint64_t *)gOut_Ref2; diff --git a/test_conformance/math_brute_force/unary_two_results_float.cpp b/test_conformance/math_brute_force/unary_two_results_float.cpp index 8d423408..983e0395 100644 --- a/test_conformance/math_brute_force/unary_two_results_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_float.cpp @@ -68,6 +68,8 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array uint32_t *p = (uint32_t *)gIn; if (gWimpyMode) @@ -258,12 +260,6 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) - { - if (isFract && gIsInRTZMode) (void)set_round(oldRoundMode, kfloat); - break; - } - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; uint32_t *t2 = (uint32_t *)gOut_Ref2; diff --git a/test_conformance/math_brute_force/unary_two_results_half.cpp b/test_conformance/math_brute_force/unary_two_results_half.cpp index 7d75c67a..7593191c 100644 --- a/test_conformance/math_brute_force/unary_two_results_half.cpp +++ b/test_conformance/math_brute_force/unary_two_results_half.cpp @@ -72,6 +72,8 @@ int TestFunc_Half2_Half(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 16); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_half *pIn = (cl_half *)gIn; for (size_t j = 0; j < bufferElements; j++) pIn[j] = (cl_ushort)i + j; @@ -231,12 +233,6 @@ int TestFunc_Half2_Half(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) - { - if (isFract && gIsInRTZMode) (void)set_round(oldRoundMode, kfloat); - break; - } - // Verify data for (size_t j = 0; j < bufferElements; j++) { diff --git a/test_conformance/math_brute_force/unary_two_results_i_double.cpp b/test_conformance/math_brute_force/unary_two_results_i_double.cpp index 2c84826f..916f4a0c 100644 --- a/test_conformance/math_brute_force/unary_two_results_i_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i_double.cpp @@ -75,6 +75,8 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array double *p = (double *)gIn; if (gWimpyMode) @@ -207,8 +209,6 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint64_t *t = (uint64_t *)gOut_Ref; int32_t *t2 = (int32_t *)gOut_Ref2; diff --git a/test_conformance/math_brute_force/unary_two_results_i_float.cpp b/test_conformance/math_brute_force/unary_two_results_i_float.cpp index aea49fa6..0dbe3f77 100644 --- a/test_conformance/math_brute_force/unary_two_results_i_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i_float.cpp @@ -80,6 +80,8 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array uint32_t *p = (uint32_t *)gIn; if (gWimpyMode) @@ -212,8 +214,6 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; int32_t *t2 = (int32_t *)gOut_Ref2; diff --git a/test_conformance/math_brute_force/unary_two_results_i_half.cpp b/test_conformance/math_brute_force/unary_two_results_i_half.cpp index d81ff12c..df404b8a 100644 --- a/test_conformance/math_brute_force/unary_two_results_i_half.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i_half.cpp @@ -84,6 +84,8 @@ int TestFunc_HalfI_Half(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 16); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_half *pIn = (cl_half *)gIn; for (size_t j = 0; j < bufferElements; j++) pIn[j] = (cl_ushort)i + j; @@ -206,8 +208,6 @@ int TestFunc_HalfI_Half(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data for (size_t j = 0; j < bufferElements; j++) { diff --git a/test_conformance/math_brute_force/unary_u_double.cpp b/test_conformance/math_brute_force/unary_u_double.cpp index 8521b4b9..226ef068 100644 --- a/test_conformance/math_brute_force/unary_u_double.cpp +++ b/test_conformance/math_brute_force/unary_u_double.cpp @@ -67,6 +67,8 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_ulong *p = (cl_ulong *)gIn; for (size_t j = 0; j < BUFFER_SIZE / sizeof(cl_ulong); j++) @@ -157,8 +159,6 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint64_t *t = (uint64_t *)gOut_Ref; for (size_t j = 0; j < BUFFER_SIZE / sizeof(cl_double); j++) diff --git a/test_conformance/math_brute_force/unary_u_float.cpp b/test_conformance/math_brute_force/unary_u_float.cpp index 7a410240..3eb76794 100644 --- a/test_conformance/math_brute_force/unary_u_float.cpp +++ b/test_conformance/math_brute_force/unary_u_float.cpp @@ -67,6 +67,8 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array uint32_t *p = (uint32_t *)gIn; if (gWimpyMode) @@ -164,8 +166,6 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data uint32_t *t = (uint32_t *)gOut_Ref; for (size_t j = 0; j < BUFFER_SIZE / sizeof(float); j++) diff --git a/test_conformance/math_brute_force/unary_u_half.cpp b/test_conformance/math_brute_force/unary_u_half.cpp index 5c83d04e..c9eef431 100644 --- a/test_conformance/math_brute_force/unary_u_half.cpp +++ b/test_conformance/math_brute_force/unary_u_half.cpp @@ -67,6 +67,8 @@ int TestFunc_Half_UShort(const Func *f, MTdata d, bool relaxedMode) for (uint64_t i = 0; i < (1ULL << 32); i += step) { + if (gSkipCorrectnessTesting) break; + // Init input array cl_ushort *p = (cl_ushort *)gIn; for (size_t j = 0; j < bufferElements; j++) p[j] = (uint16_t)i + j; @@ -155,8 +157,6 @@ int TestFunc_Half_UShort(const Func *f, MTdata d, bool relaxedMode) } } - if (gSkipCorrectnessTesting) break; - // Verify data cl_ushort *t = (cl_ushort *)gOut_Ref; for (size_t j = 0; j < bufferElements; j++)