CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
122 lines
2.4 KiB
C++
122 lines
2.4 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <hip_test_common.hh>
|
|
#include <new>
|
|
|
|
// Test __HIP_DEVICE_COMPILE__ is defined after math_functions.h
|
|
// is included.
|
|
__device__ __host__ inline void throw_std_bad_alloc() {
|
|
#ifndef __HIP_DEVICE_COMPILE__
|
|
throw std::bad_alloc();
|
|
#else
|
|
std::size_t kHuge = static_cast<std::size_t>(-1);
|
|
new int[kHuge];
|
|
#endif
|
|
}
|
|
|
|
__global__ void FloatMathPreciseKernel() {
|
|
int iX;
|
|
float fX, fY;
|
|
acosf(1.0f);
|
|
acoshf(1.0f);
|
|
asinf(0.0f);
|
|
asinhf(0.0f);
|
|
atan2f(0.0f, 1.0f);
|
|
atanf(0.0f);
|
|
atanhf(0.0f);
|
|
cbrtf(0.0f);
|
|
fX = ceilf(0.0f);
|
|
fX = copysignf(1.0f, -2.0f);
|
|
cosf(0.0f);
|
|
coshf(0.0f);
|
|
cospif(0.0f);
|
|
cyl_bessel_i0f(0.0f);
|
|
cyl_bessel_i1f(0.0f);
|
|
erfcf(0.0f);
|
|
erfcinvf(2.0f);
|
|
erfcxf(0.0f);
|
|
erff(0.0f);
|
|
erfinvf(1.0f);
|
|
exp10f(0.0f);
|
|
exp2f(0.0f);
|
|
expf(0.0f);
|
|
expm1f(0.0f);
|
|
fX = fabsf(1.0f);
|
|
fdimf(1.0f, 0.0f);
|
|
fdividef(0.0f, 1.0f);
|
|
fX = floorf(0.0f);
|
|
fmaf(1.0f, 2.0f, 3.0f);
|
|
fX = fmaxf(0.0f, 0.0f);
|
|
fX = fminf(0.0f, 0.0f);
|
|
fmodf(0.0f, 1.0f);
|
|
frexpf(0.0f, &iX);
|
|
hypotf(1.0f, 0.0f);
|
|
ilogbf(1.0f);
|
|
isfinite(0.0f);
|
|
fX = isinf(0.0f);
|
|
fX = isnan(0.0f);
|
|
j0f(0.0f);
|
|
j1f(0.0f);
|
|
jnf(-1.0f, 1.0f);
|
|
ldexpf(0.0f, 0);
|
|
lgammaf(1.0f);
|
|
llrintf(0.0f);
|
|
llroundf(0.0f);
|
|
log10f(1.0f);
|
|
log1pf(-1.0f);
|
|
log2f(1.0f);
|
|
logbf(1.0f);
|
|
logf(1.0f);
|
|
lrintf(0.0f);
|
|
lroundf(0.0f);
|
|
modff(0.0f, &fX);
|
|
fX = nanf("1");
|
|
fX = nearbyintf(0.0f);
|
|
nextafterf(0.0f, 0.0f);
|
|
norm3df(1.0f, 0.0f, 0.0f);
|
|
norm4df(1.0f, 0.0f, 0.0f, 0.0f);
|
|
normcdff(0.0f);
|
|
normcdfinvf(1.0f);
|
|
fX = 1.0f;
|
|
normf(1, &fX);
|
|
powf(1.0f, 0.0f);
|
|
rcbrtf(1.0f);
|
|
remainderf(2.0f, 1.0f);
|
|
remquof(1.0f, 2.0f, &iX);
|
|
rhypotf(0.0f, 1.0f);
|
|
fY = rintf(1.0f);
|
|
rnorm3df(0.0f, 0.0f, 1.0f);
|
|
rnorm4df(0.0f, 0.0f, 0.0f, 1.0f);
|
|
fX = 1.0f;
|
|
rnormf(1, &fX);
|
|
fY = roundf(0.0f);
|
|
rsqrtf(1.0f);
|
|
scalblnf(0.0f, 1);
|
|
scalbnf(0.0f, 1);
|
|
signbit(1.0f);
|
|
sincosf(0.0f, &fX, &fY);
|
|
sincospif(0.0f, &fX, &fY);
|
|
sinf(0.0f);
|
|
sinhf(0.0f);
|
|
sinpif(0.0f);
|
|
sqrtf(0.0f);
|
|
tanf(0.0f);
|
|
tanhf(0.0f);
|
|
tgammaf(2.0f);
|
|
fY = truncf(0.0f);
|
|
y0f(1.0f);
|
|
y1f(1.0f);
|
|
ynf(1, 1.0f);
|
|
}
|
|
|
|
HIP_TEST_CASE(Unit_TestIncludeMathPreciseFloat) {
|
|
hipError_t err;
|
|
err = hipLaunchKernel(reinterpret_cast<void*>(FloatMathPreciseKernel), dim3(1, 1, 1),
|
|
dim3(1, 1, 1), 0, 0, 0);
|
|
REQUIRE(err == hipSuccess);
|
|
}
|