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 <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2024-08-06 18:26:38 +02:00
committed by GitHub
parent 8974d74db7
commit 5be093e0c8
21 changed files with 42 additions and 50 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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++)

View File

@@ -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++)

View File

@@ -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++)

View File

@@ -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))

View File

@@ -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))

View File

@@ -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.

View File

@@ -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++)

View File

@@ -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++)

View File

@@ -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++)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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++)
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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++)
{

View File

@@ -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++)

View File

@@ -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++)

View File

@@ -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++)