Skip to content

Commit

Permalink
math_brute_force: skip all enqueues in -l mode
Browse files Browse the repository at this point in the history
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 <sven.vanhaastregt@arm.com>
  • Loading branch information
svenvh committed Jun 28, 2024
1 parent fcbccab commit f03ae1e
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/i_unary_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/i_unary_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/i_unary_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/mad_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/mad_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/mad_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/ternary_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/ternary_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/ternary_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions test_conformance/math_brute_force/unary_two_results_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions test_conformance/math_brute_force/unary_two_results_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
{
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/unary_u_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down Expand Up @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/unary_u_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/math_brute_force/unary_u_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down

0 comments on commit f03ae1e

Please sign in to comment.