Skip to content

[SYCL][libdevice] Add type cast functions between half and float/integral type #6930

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 11 commits into from
Oct 26, 2022
Merged
9 changes: 9 additions & 0 deletions libdevice/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@
#define DEVICE_EXTERN_C_INLINE DEVICE_EXTERN_C __attribute__((always_inline))
#endif // __LIBDEVICE_HOST_IMPL__

// Rounding mode are used internally by type convert functions in imf libdevice
// and we don't want to include system's fenv.h, so we define ourselves'.
typedef enum {
__IML_RTE, // round to nearest-even
__IML_RTZ, // round to zero
__IML_RTP, // round to +inf
__IML_RTN, // round to -inf
} __iml_rounding_mode;

#endif // __LIBDEVICE_DEVICE_H__
1 change: 1 addition & 0 deletions libdevice/device_imf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ static inline TyFP __integral2FP_host(TyINT x, int rdMode) {
fesetround(roundingOriginal);
return res;
}
#pragma STDC FENV_ACCESS OFF
#endif // __LIBDEVICE_HOST_IMPL__

template <typename Ty> static inline Ty __imax(Ty x, Ty y) {
Expand Down
Loading