Skip to content

[SYCL][HIP] add missing nearbyint and rint #16373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions libdevice/cmath_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,14 @@ DEVICE_EXTERN_C_INLINE
float rintf(float x) { return __nv_rintf(x); }
#endif // __NVPTX__

#ifdef __AMDGCN__
extern "C" SYCL_EXTERNAL float __ocml_nearbyint_f32(float);
DEVICE_EXTERN_C_INLINE
float nearbyintf(float x) { return __ocml_nearbyint_f32(x); }

extern "C" SYCL_EXTERNAL float __ocml_rint_f32(float);
DEVICE_EXTERN_C_INLINE
float rintf(float x) { return __ocml_rint_f32(x); }
#endif // __AMDGCN__

#endif // __SPIR__ || __SPIRV__ || __NVPTX__ || __AMDGCN__
10 changes: 10 additions & 0 deletions libdevice/cmath_wrapper_fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ DEVICE_EXTERN_C_INLINE
double rint(double x) { return __nv_rint(x); }
#endif // __NVPTX__

#ifdef __AMDGCN__
extern "C" SYCL_EXTERNAL double __ocml_nearbyint_f64(double);
DEVICE_EXTERN_C_INLINE
double nearbyint(double x) { return __ocml_nearbyint_f64(x); }

extern "C" SYCL_EXTERNAL double __ocml_rint_f64(double);
DEVICE_EXTERN_C_INLINE
double rint(double x) { return __ocml_rint_f64(x); }
#endif // __AMDGCN__

#if defined(_MSC_VER)
#include <math.h>
// FLOAT PROPERTIES
Expand Down
Loading