[Offload][Conformance] Add exhaustive tests for half-precision math functions (#155112)

This patch adds a set of exhaustive tests for half-precision math.

The functions included in this set were selected based on the following
criteria:
- An implementation exists in `libc/src/math/generic` (i.e., it is not
just a wrapper around a compiler built-in).
- The corresponding LLVM CPU libm implementation is correctly rounded.
- The function is listed in Table 69 of the OpenCL C Specification
v3.0.19.

This patch also fixes the testing range of the following functions:
`acos`, `acosf`, `asin`, `asinf`, and `log1p`.
This commit is contained in:
Leandro Lacerda
2025-08-24 11:42:26 -03:00
committed by GitHub
parent 11c615818f
commit 5ef4120b64
32 changed files with 1644 additions and 5 deletions

View File

@@ -103,49 +103,68 @@ extern "C" {
double __ocml_acos_f64(double);
float __ocml_acos_f32(float);
float16 __ocml_acos_f16(float16);
float __ocml_acosh_f32(float);
float16 __ocml_acosh_f16(float16);
double __ocml_asin_f64(double);
float __ocml_asin_f32(float);
float16 __ocml_asin_f16(float16);
float __ocml_asinh_f32(float);
float16 __ocml_asinh_f16(float16);
float __ocml_atan_f32(float);
float16 __ocml_atan_f16(float16);
float __ocml_atan2_f32(float, float);
float __ocml_atanh_f32(float);
float16 __ocml_atanh_f16(float16);
double __ocml_cbrt_f64(double);
float __ocml_cbrt_f32(float);
double __ocml_cos_f64(double);
float __ocml_cos_f32(float);
float16 __ocml_cos_f16(float16);
float __ocml_cosh_f32(float);
float16 __ocml_cosh_f16(float16);
float __ocml_cospi_f32(float);
float __ocml_erf_f32(float);
double __ocml_exp_f64(double);
float __ocml_exp_f32(float);
float16 __ocml_exp_f16(float16);
double __ocml_exp10_f64(double);
float __ocml_exp10_f32(float);
float16 __ocml_exp10_f16(float16);
double __ocml_exp2_f64(double);
float __ocml_exp2_f32(float);
float16 __ocml_exp2_f16(float16);
double __ocml_expm1_f64(double);
float __ocml_expm1_f32(float);
float16 __ocml_expm1_f16(float16);
double __ocml_hypot_f64(double, double);
float __ocml_hypot_f32(float, float);
double __ocml_log_f64(double);
float __ocml_log_f32(float);
float16 __ocml_log_f16(float16);
double __ocml_log10_f64(double);
float __ocml_log10_f32(float);
float16 __ocml_log10_f16(float16);
double __ocml_log1p_f64(double);
float __ocml_log1p_f32(float);
double __ocml_log2_f64(double);
float __ocml_log2_f32(float);
float16 __ocml_log2_f16(float16);
float __ocml_pow_f32(float, float);
float __ocml_round_f32(float);
double __ocml_sin_f64(double);
float __ocml_sin_f32(float);
float16 __ocml_sin_f16(float16);
double __ocml_sincos_f64(double, double *);
float __ocml_sincos_f32(float, float *);
float __ocml_sinh_f32(float);
float16 __ocml_sinh_f16(float16);
float __ocml_sinpi_f32(float);
double __ocml_tan_f64(double);
float __ocml_tan_f32(float);
float16 __ocml_tan_f16(float16);
float __ocml_tanh_f32(float);
float16 __ocml_tanh_f16(float16);
} // extern "C"
#endif // HIP_MATH_FOUND

View File

@@ -70,11 +70,21 @@ __gpu_kernel void acosfKernel(const float *X, float *Out,
runKernelBody<__ocml_acos_f32>(NumElements, Out, X);
}
__gpu_kernel void acosf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_acos_f16>(NumElements, Out, X);
}
__gpu_kernel void acoshfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_acosh_f32>(NumElements, Out, X);
}
__gpu_kernel void acoshf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_acosh_f16>(NumElements, Out, X);
}
__gpu_kernel void asinKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_asin_f64>(NumElements, Out, X);
@@ -85,16 +95,31 @@ __gpu_kernel void asinfKernel(const float *X, float *Out,
runKernelBody<__ocml_asin_f32>(NumElements, Out, X);
}
__gpu_kernel void asinf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_asin_f16>(NumElements, Out, X);
}
__gpu_kernel void asinhfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_asinh_f32>(NumElements, Out, X);
}
__gpu_kernel void asinhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_asinh_f16>(NumElements, Out, X);
}
__gpu_kernel void atanfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_atan_f32>(NumElements, Out, X);
}
__gpu_kernel void atanf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_atan_f16>(NumElements, Out, X);
}
__gpu_kernel void atan2fKernel(const float *X, const float *Y, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_atan2_f32>(NumElements, Out, X, Y);
@@ -105,6 +130,11 @@ __gpu_kernel void atanhfKernel(const float *X, float *Out,
runKernelBody<__ocml_atanh_f32>(NumElements, Out, X);
}
__gpu_kernel void atanhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_atanh_f16>(NumElements, Out, X);
}
__gpu_kernel void cbrtKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_cbrt_f64>(NumElements, Out, X);
@@ -125,11 +155,21 @@ __gpu_kernel void cosfKernel(const float *X, float *Out,
runKernelBody<__ocml_cos_f32>(NumElements, Out, X);
}
__gpu_kernel void cosf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_cos_f16>(NumElements, Out, X);
}
__gpu_kernel void coshfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_cosh_f32>(NumElements, Out, X);
}
__gpu_kernel void coshf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_cosh_f16>(NumElements, Out, X);
}
__gpu_kernel void cospifKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_cospi_f32>(NumElements, Out, X);
@@ -150,6 +190,11 @@ __gpu_kernel void expfKernel(const float *X, float *Out,
runKernelBody<__ocml_exp_f32>(NumElements, Out, X);
}
__gpu_kernel void expf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_exp_f16>(NumElements, Out, X);
}
__gpu_kernel void exp10Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_exp10_f64>(NumElements, Out, X);
@@ -160,6 +205,11 @@ __gpu_kernel void exp10fKernel(const float *X, float *Out,
runKernelBody<__ocml_exp10_f32>(NumElements, Out, X);
}
__gpu_kernel void exp10f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_exp10_f16>(NumElements, Out, X);
}
__gpu_kernel void exp2Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_exp2_f64>(NumElements, Out, X);
@@ -170,6 +220,11 @@ __gpu_kernel void exp2fKernel(const float *X, float *Out,
runKernelBody<__ocml_exp2_f32>(NumElements, Out, X);
}
__gpu_kernel void exp2f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_exp2_f16>(NumElements, Out, X);
}
__gpu_kernel void expm1Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_expm1_f64>(NumElements, Out, X);
@@ -180,6 +235,11 @@ __gpu_kernel void expm1fKernel(const float *X, float *Out,
runKernelBody<__ocml_expm1_f32>(NumElements, Out, X);
}
__gpu_kernel void expm1f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_expm1_f16>(NumElements, Out, X);
}
__gpu_kernel void hypotKernel(const double *X, const double *Y, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_hypot_f64>(NumElements, Out, X, Y);
@@ -200,6 +260,11 @@ __gpu_kernel void logfKernel(const float *X, float *Out,
runKernelBody<__ocml_log_f32>(NumElements, Out, X);
}
__gpu_kernel void logf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_log_f16>(NumElements, Out, X);
}
__gpu_kernel void log10Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_log10_f64>(NumElements, Out, X);
@@ -210,6 +275,11 @@ __gpu_kernel void log10fKernel(const float *X, float *Out,
runKernelBody<__ocml_log10_f32>(NumElements, Out, X);
}
__gpu_kernel void log10f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_log10_f16>(NumElements, Out, X);
}
__gpu_kernel void log1pKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_log1p_f64>(NumElements, Out, X);
@@ -230,6 +300,11 @@ __gpu_kernel void log2fKernel(const float *X, float *Out,
runKernelBody<__ocml_log2_f32>(NumElements, Out, X);
}
__gpu_kernel void log2f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_log2_f16>(NumElements, Out, X);
}
__gpu_kernel void powfKernel(const float *X, float *Y, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_pow_f32>(NumElements, Out, X, Y);
@@ -251,6 +326,11 @@ __gpu_kernel void sinfKernel(const float *X, float *Out,
runKernelBody<__ocml_sin_f32>(NumElements, Out, X);
}
__gpu_kernel void sinf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_sin_f16>(NumElements, Out, X);
}
__gpu_kernel void sincosSinKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<sincosSin>(NumElements, Out, X);
@@ -276,6 +356,11 @@ __gpu_kernel void sinhfKernel(const float *X, float *Out,
runKernelBody<__ocml_sinh_f32>(NumElements, Out, X);
}
__gpu_kernel void sinhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_sinh_f16>(NumElements, Out, X);
}
__gpu_kernel void sinpifKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_sinpi_f32>(NumElements, Out, X);
@@ -291,10 +376,20 @@ __gpu_kernel void tanfKernel(const float *X, float *Out,
runKernelBody<__ocml_tan_f32>(NumElements, Out, X);
}
__gpu_kernel void tanf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_tan_f16>(NumElements, Out, X);
}
__gpu_kernel void tanhfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_tanh_f32>(NumElements, Out, X);
}
__gpu_kernel void tanhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<__ocml_tanh_f16>(NumElements, Out, X);
}
} // extern "C"
#endif // HIP_MATH_FOUND

View File

@@ -69,11 +69,26 @@ __gpu_kernel void acosfKernel(const float *X, float *Out,
runKernelBody<acosf>(NumElements, Out, X);
}
__gpu_kernel void acosf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<acosf16>(NumElements, Out, X);
}
__gpu_kernel void acoshfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<acoshf>(NumElements, Out, X);
}
__gpu_kernel void acoshf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<acoshf16>(NumElements, Out, X);
}
__gpu_kernel void acospif16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<acospif16>(NumElements, Out, X);
}
__gpu_kernel void asinKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<asin>(NumElements, Out, X);
@@ -84,16 +99,31 @@ __gpu_kernel void asinfKernel(const float *X, float *Out,
runKernelBody<asinf>(NumElements, Out, X);
}
__gpu_kernel void asinf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<asinf16>(NumElements, Out, X);
}
__gpu_kernel void asinhfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<asinhf>(NumElements, Out, X);
}
__gpu_kernel void asinhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<asinhf16>(NumElements, Out, X);
}
__gpu_kernel void atanfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<atanf>(NumElements, Out, X);
}
__gpu_kernel void atanf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<atanf16>(NumElements, Out, X);
}
__gpu_kernel void atan2fKernel(const float *X, const float *Y, float *Out,
size_t NumElements) noexcept {
runKernelBody<atan2f>(NumElements, Out, X, Y);
@@ -104,6 +134,11 @@ __gpu_kernel void atanhfKernel(const float *X, float *Out,
runKernelBody<atanhf>(NumElements, Out, X);
}
__gpu_kernel void atanhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<atanhf16>(NumElements, Out, X);
}
__gpu_kernel void cbrtKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<cbrt>(NumElements, Out, X);
@@ -124,16 +159,31 @@ __gpu_kernel void cosfKernel(const float *X, float *Out,
runKernelBody<cosf>(NumElements, Out, X);
}
__gpu_kernel void cosf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<cosf16>(NumElements, Out, X);
}
__gpu_kernel void coshfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<coshf>(NumElements, Out, X);
}
__gpu_kernel void coshf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<coshf16>(NumElements, Out, X);
}
__gpu_kernel void cospifKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<cospif>(NumElements, Out, X);
}
__gpu_kernel void cospif16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<cospif16>(NumElements, Out, X);
}
__gpu_kernel void erffKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<erff>(NumElements, Out, X);
@@ -149,6 +199,11 @@ __gpu_kernel void expfKernel(const float *X, float *Out,
runKernelBody<expf>(NumElements, Out, X);
}
__gpu_kernel void expf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<expf16>(NumElements, Out, X);
}
__gpu_kernel void exp10Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<exp10>(NumElements, Out, X);
@@ -159,6 +214,11 @@ __gpu_kernel void exp10fKernel(const float *X, float *Out,
runKernelBody<exp10f>(NumElements, Out, X);
}
__gpu_kernel void exp10f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<exp10f16>(NumElements, Out, X);
}
__gpu_kernel void exp2Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<exp2>(NumElements, Out, X);
@@ -169,6 +229,11 @@ __gpu_kernel void exp2fKernel(const float *X, float *Out,
runKernelBody<exp2f>(NumElements, Out, X);
}
__gpu_kernel void exp2f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<exp2f16>(NumElements, Out, X);
}
__gpu_kernel void expm1Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<expm1>(NumElements, Out, X);
@@ -179,6 +244,11 @@ __gpu_kernel void expm1fKernel(const float *X, float *Out,
runKernelBody<expm1f>(NumElements, Out, X);
}
__gpu_kernel void expm1f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<expm1f16>(NumElements, Out, X);
}
__gpu_kernel void hypotKernel(const double *X, const double *Y, double *Out,
size_t NumElements) noexcept {
runKernelBody<hypot>(NumElements, Out, X, Y);
@@ -204,6 +274,11 @@ __gpu_kernel void logfKernel(const float *X, float *Out,
runKernelBody<logf>(NumElements, Out, X);
}
__gpu_kernel void logf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<logf16>(NumElements, Out, X);
}
__gpu_kernel void log10Kernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<log10>(NumElements, Out, X);
@@ -214,6 +289,11 @@ __gpu_kernel void log10fKernel(const float *X, float *Out,
runKernelBody<log10f>(NumElements, Out, X);
}
__gpu_kernel void log10f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<log10f16>(NumElements, Out, X);
}
__gpu_kernel void log1pKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<log1p>(NumElements, Out, X);
@@ -234,6 +314,11 @@ __gpu_kernel void log2fKernel(const float *X, float *Out,
runKernelBody<log2f>(NumElements, Out, X);
}
__gpu_kernel void log2f16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<log2f16>(NumElements, Out, X);
}
__gpu_kernel void powfKernel(const float *X, float *Y, float *Out,
size_t NumElements) noexcept {
runKernelBody<powf>(NumElements, Out, X, Y);
@@ -255,6 +340,11 @@ __gpu_kernel void sinfKernel(const float *X, float *Out,
runKernelBody<sinf>(NumElements, Out, X);
}
__gpu_kernel void sinf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<sinf16>(NumElements, Out, X);
}
__gpu_kernel void sincosSinKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<sincosSin>(NumElements, Out, X);
@@ -280,11 +370,21 @@ __gpu_kernel void sinhfKernel(const float *X, float *Out,
runKernelBody<sinhf>(NumElements, Out, X);
}
__gpu_kernel void sinhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<sinhf16>(NumElements, Out, X);
}
__gpu_kernel void sinpifKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<sinpif>(NumElements, Out, X);
}
__gpu_kernel void sinpif16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<sinpif16>(NumElements, Out, X);
}
__gpu_kernel void tanKernel(const double *X, double *Out,
size_t NumElements) noexcept {
runKernelBody<tan>(NumElements, Out, X);
@@ -295,13 +395,28 @@ __gpu_kernel void tanfKernel(const float *X, float *Out,
runKernelBody<tanf>(NumElements, Out, X);
}
__gpu_kernel void tanf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<tanf16>(NumElements, Out, X);
}
__gpu_kernel void tanhfKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<tanhf>(NumElements, Out, X);
}
__gpu_kernel void tanhf16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<tanhf16>(NumElements, Out, X);
}
__gpu_kernel void tanpifKernel(const float *X, float *Out,
size_t NumElements) noexcept {
runKernelBody<tanpif>(NumElements, Out, X);
}
__gpu_kernel void tanpif16Kernel(const float16 *X, float16 *Out,
size_t NumElements) noexcept {
runKernelBody<tanpif16>(NumElements, Out, X);
}
} // extern "C"

View File

@@ -50,7 +50,9 @@ int main(int argc, const char **argv) {
uint64_t Seed = 42;
uint64_t Size = 1ULL << 32;
IndexedRange<double> Range;
IndexedRange<double> Range(/*Begin=*/-1.0,
/*End=*/1.0,
/*Inclusive=*/true);
RandomGenerator<double> Generator(SeedTy{Seed}, Size, Range);
const auto Configs = cl::getTestConfigs();

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the acosf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 acosf16(float16);
namespace mathtest {
template <> struct FunctionConfig<acosf16> {
static constexpr llvm::StringRef Name = "acosf16";
static constexpr llvm::StringRef KernelName = "acosf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the acosf16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(-1.0),
/*End=*/float16(1.0),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<acosf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -40,7 +40,9 @@ int main(int argc, const char **argv) {
using namespace mathtest;
IndexedRange<float> Range;
IndexedRange<float> Range(/*Begin=*/-1.0f,
/*End=*/1.0f,
/*Inclusive=*/true);
ExhaustiveGenerator<float> Generator(Range);
const auto Configs = cl::getTestConfigs();

View File

@@ -0,0 +1,62 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the acoshf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/Numerics.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 acoshf16(float16);
namespace mathtest {
template <> struct FunctionConfig<acoshf16> {
static constexpr llvm::StringRef Name = "acoshf16";
static constexpr llvm::StringRef KernelName = "acoshf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the acoshf16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(1.0),
/*End=*/getMaxOrInf<float16>(),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<acoshf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the acospif16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 acospif16(float16);
namespace mathtest {
template <> struct FunctionConfig<acospif16> {
static constexpr llvm::StringRef Name = "acospif16";
static constexpr llvm::StringRef KernelName = "acospif16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the acospif16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(-1.0),
/*End=*/float16(1.0),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<acospif16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -50,7 +50,9 @@ int main(int argc, const char **argv) {
uint64_t Seed = 42;
uint64_t Size = 1ULL << 32;
IndexedRange<double> Range;
IndexedRange<double> Range(/*Begin=*/-1.0,
/*End=*/1.0,
/*Inclusive=*/true);
RandomGenerator<double> Generator(SeedTy{Seed}, Size, Range);
const auto Configs = cl::getTestConfigs();

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the asinf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 asinf16(float16);
namespace mathtest {
template <> struct FunctionConfig<asinf16> {
static constexpr llvm::StringRef Name = "asinf16";
static constexpr llvm::StringRef KernelName = "asinf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the asinf16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(-1.0),
/*End=*/float16(1.0),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<asinf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -40,7 +40,9 @@ int main(int argc, const char **argv) {
using namespace mathtest;
IndexedRange<float> Range;
IndexedRange<float> Range(/*Begin=*/-1.0f,
/*End=*/1.0f,
/*Inclusive=*/true);
ExhaustiveGenerator<float> Generator(Range);
const auto Configs = cl::getTestConfigs();

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the asinhf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 asinhf16(float16);
namespace mathtest {
template <> struct FunctionConfig<asinhf16> {
static constexpr llvm::StringRef Name = "asinhf16";
static constexpr llvm::StringRef KernelName = "asinhf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the asinhf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<asinhf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the atanf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 atanf16(float16);
namespace mathtest {
template <> struct FunctionConfig<atanf16> {
static constexpr llvm::StringRef Name = "atanf16";
static constexpr llvm::StringRef KernelName = "atanf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the atanf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<atanf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the atanhf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 atanhf16(float16);
namespace mathtest {
template <> struct FunctionConfig<atanhf16> {
static constexpr llvm::StringRef Name = "atanhf16";
static constexpr llvm::StringRef KernelName = "atanhf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the atanhf16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(-1.0),
/*End=*/float16(1.0),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<atanhf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -5,47 +5,70 @@ endif()
add_conformance_test(acos AcosTest.cpp)
add_conformance_test(acosf AcosfTest.cpp)
add_conformance_test(acosf16 Acosf16Test.cpp)
add_conformance_test(acoshf AcoshfTest.cpp)
add_conformance_test(acoshf16 Acoshf16Test.cpp)
add_conformance_test(acospif16 Acospif16Test.cpp)
add_conformance_test(asin AsinTest.cpp)
add_conformance_test(asinf AsinfTest.cpp)
add_conformance_test(asinf16 Asinf16Test.cpp)
add_conformance_test(asinhf AsinhfTest.cpp)
add_conformance_test(asinhf16 Asinhf16Test.cpp)
add_conformance_test(atanf AtanfTest.cpp)
add_conformance_test(atanf16 Atanf16Test.cpp)
add_conformance_test(atan2f Atan2fTest.cpp)
add_conformance_test(atanhf AtanhfTest.cpp)
add_conformance_test(atanhf16 Atanhf16Test.cpp)
add_conformance_test(cbrt CbrtTest.cpp)
add_conformance_test(cbrtf CbrtfTest.cpp)
add_conformance_test(cos CosTest.cpp)
add_conformance_test(cosf CosfTest.cpp)
add_conformance_test(cosf16 Cosf16Test.cpp)
add_conformance_test(coshf CoshfTest.cpp)
add_conformance_test(coshf16 Coshf16Test.cpp)
add_conformance_test(cospif CospifTest.cpp)
add_conformance_test(cospif16 Cospif16Test.cpp)
add_conformance_test(erff ErffTest.cpp)
add_conformance_test(exp ExpTest.cpp)
add_conformance_test(expf ExpfTest.cpp)
add_conformance_test(expf16 Expf16Test.cpp)
add_conformance_test(exp10 Exp10Test.cpp)
add_conformance_test(exp10f Exp10fTest.cpp)
add_conformance_test(exp10f16 Exp10f16Test.cpp)
add_conformance_test(exp2 Exp2Test.cpp)
add_conformance_test(exp2f Exp2fTest.cpp)
add_conformance_test(exp2f16 Exp2f16Test.cpp)
add_conformance_test(expm1 Expm1Test.cpp)
add_conformance_test(expm1f Expm1fTest.cpp)
add_conformance_test(expm1f16 Expm1f16Test.cpp)
add_conformance_test(hypot HypotTest.cpp)
add_conformance_test(hypotf HypotfTest.cpp)
add_conformance_test(hypotf16 Hypotf16Test.cpp)
add_conformance_test(log LogTest.cpp)
add_conformance_test(logf LogfTest.cpp)
add_conformance_test(logf16 Logf16Test.cpp)
add_conformance_test(log10 Log10Test.cpp)
add_conformance_test(log10f Log10fTest.cpp)
add_conformance_test(log10f16 Log10f16Test.cpp)
add_conformance_test(log1p Log1pTest.cpp)
add_conformance_test(log1pf Log1pfTest.cpp)
add_conformance_test(log2 Log2Test.cpp)
add_conformance_test(log2f Log2fTest.cpp)
add_conformance_test(log2f16 Log2f16Test.cpp)
add_conformance_test(powf PowfTest.cpp)
add_conformance_test(sin SinTest.cpp)
add_conformance_test(sinf SinfTest.cpp)
add_conformance_test(sinf16 Sinf16Test.cpp)
add_conformance_test(sincos SincosTest.cpp)
add_conformance_test(sincosf SincosfTest.cpp)
add_conformance_test(sinhf SinhfTest.cpp)
add_conformance_test(sinhf16 Sinhf16Test.cpp)
add_conformance_test(sinpif SinpifTest.cpp)
add_conformance_test(sinpif16 Sinpif16Test.cpp)
add_conformance_test(tan TanTest.cpp)
add_conformance_test(tanf TanfTest.cpp)
add_conformance_test(tanf16 Tanf16Test.cpp)
add_conformance_test(tanhf TanhfTest.cpp)
add_conformance_test(tanhf16 Tanhf16Test.cpp)
add_conformance_test(tanpif TanpifTest.cpp)
add_conformance_test(tanpif16 Tanpif16Test.cpp)

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the cosf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 cosf16(float16);
namespace mathtest {
template <> struct FunctionConfig<cosf16> {
static constexpr llvm::StringRef Name = "cosf16";
static constexpr llvm::StringRef KernelName = "cosf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the cosf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<cosf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the coshf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 coshf16(float16);
namespace mathtest {
template <> struct FunctionConfig<coshf16> {
static constexpr llvm::StringRef Name = "coshf16";
static constexpr llvm::StringRef KernelName = "coshf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the coshf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<coshf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the cospif16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 cospif16(float16);
namespace mathtest {
template <> struct FunctionConfig<cospif16> {
static constexpr llvm::StringRef Name = "cospif16";
static constexpr llvm::StringRef KernelName = "cospif16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the cospif16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<cospif16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the exp10f16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 exp10f16(float16);
namespace mathtest {
template <> struct FunctionConfig<exp10f16> {
static constexpr llvm::StringRef Name = "exp10f16";
static constexpr llvm::StringRef KernelName = "exp10f16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the exp10f16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<exp10f16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the exp2f16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 exp2f16(float16);
namespace mathtest {
template <> struct FunctionConfig<exp2f16> {
static constexpr llvm::StringRef Name = "exp2f16";
static constexpr llvm::StringRef KernelName = "exp2f16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the exp2f16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<exp2f16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the expf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 expf16(float16);
namespace mathtest {
template <> struct FunctionConfig<expf16> {
static constexpr llvm::StringRef Name = "expf16";
static constexpr llvm::StringRef KernelName = "expf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the expf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<expf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the expm1f16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 expm1f16(float16);
namespace mathtest {
template <> struct FunctionConfig<expm1f16> {
static constexpr llvm::StringRef Name = "expm1f16";
static constexpr llvm::StringRef KernelName = "expm1f16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the expm1f16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<expm1f16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,62 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the log10f16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/Numerics.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 log10f16(float16);
namespace mathtest {
template <> struct FunctionConfig<log10f16> {
static constexpr llvm::StringRef Name = "log10f16";
static constexpr llvm::StringRef KernelName = "log10f16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the log10f16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(0.0),
/*End=*/getMaxOrInf<float16>(),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<log10f16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -51,7 +51,7 @@ int main(int argc, const char **argv) {
uint64_t Seed = 42;
uint64_t Size = 1ULL << 32;
IndexedRange<double> Range(/*Begin=*/0.0,
IndexedRange<double> Range(/*Begin=*/-1.0,
/*End=*/std::numeric_limits<double>::infinity(),
/*Inclusive=*/true);
RandomGenerator<double> Generator(SeedTy{Seed}, Size, Range);

View File

@@ -0,0 +1,62 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the log2f16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/Numerics.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 log2f16(float16);
namespace mathtest {
template <> struct FunctionConfig<log2f16> {
static constexpr llvm::StringRef Name = "log2f16";
static constexpr llvm::StringRef KernelName = "log2f16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the log2f16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(0.0),
/*End=*/getMaxOrInf<float16>(),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<log2f16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,62 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the logf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/Numerics.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 logf16(float16);
namespace mathtest {
template <> struct FunctionConfig<logf16> {
static constexpr llvm::StringRef Name = "logf16";
static constexpr llvm::StringRef KernelName = "logf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the logf16 function");
using namespace mathtest;
IndexedRange<float16> Range(/*Begin=*/float16(0.0),
/*End=*/getMaxOrInf<float16>(),
/*Inclusive=*/true);
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<logf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the sinf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 sinf16(float16);
namespace mathtest {
template <> struct FunctionConfig<sinf16> {
static constexpr llvm::StringRef Name = "sinf16";
static constexpr llvm::StringRef KernelName = "sinf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the sinf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<sinf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the sinhf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 sinhf16(float16);
namespace mathtest {
template <> struct FunctionConfig<sinhf16> {
static constexpr llvm::StringRef Name = "sinhf16";
static constexpr llvm::StringRef KernelName = "sinhf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the sinhf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<sinhf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the sinpif16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 sinpif16(float16);
namespace mathtest {
template <> struct FunctionConfig<sinpif16> {
static constexpr llvm::StringRef Name = "sinpif16";
static constexpr llvm::StringRef KernelName = "sinpif16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the sinpif16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<sinpif16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the tanf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 tanf16(float16);
namespace mathtest {
template <> struct FunctionConfig<tanf16> {
static constexpr llvm::StringRef Name = "tanf16";
static constexpr llvm::StringRef KernelName = "tanf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
// Note: The minimum accuracy at the source is 2.5 ULP, but we round it
// down to ensure conformance.
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the tanf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<tanf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the tanhf16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 tanhf16(float16);
namespace mathtest {
template <> struct FunctionConfig<tanhf16> {
static constexpr llvm::StringRef Name = "tanhf16";
static constexpr llvm::StringRef KernelName = "tanhf16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"Conformance test of the tanhf16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<tanhf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the conformance test of the tanpif16 function.
///
//===----------------------------------------------------------------------===//
#include "mathtest/CommandLineExtras.hpp"
#include "mathtest/ExhaustiveGenerator.hpp"
#include "mathtest/IndexedRange.hpp"
#include "mathtest/TestConfig.hpp"
#include "mathtest/TestRunner.hpp"
#include "mathtest/TypeExtras.hpp"
#include "llvm/ADT/StringRef.h"
#include <cstdlib>
#include <math.h>
using namespace mathtest;
extern "C" float16 tanpif16(float16);
namespace mathtest {
template <> struct FunctionConfig<tanpif16> {
static constexpr llvm::StringRef Name = "tanpif16";
static constexpr llvm::StringRef KernelName = "tanpif16Kernel";
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
// Table 69 (Full Profile), Khronos Registry [July 10, 2025].
static constexpr uint64_t UlpTolerance = 2;
};
} // namespace mathtest
int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(
argc, argv, "Conformance test of the tanpif16 function");
using namespace mathtest;
IndexedRange<float16> Range;
ExhaustiveGenerator<float16> Generator(Range);
const auto Configs = cl::getTestConfigs();
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
const bool IsVerbose = cl::IsVerbose;
bool Passed =
runTests<tanpif16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
}