Skip to content

Commit

Permalink
[SYCL][libdevice] Add type cast functions between half and float/inte…
Browse files Browse the repository at this point in the history
…gral type (#6930)

Signed-off-by: jinge90 <ge.jin@intel.com>
  • Loading branch information
jinge90 authored Oct 26, 2022
1 parent 430c722 commit 599b1b9
Show file tree
Hide file tree
Showing 9 changed files with 1,528 additions and 41 deletions.
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

0 comments on commit 599b1b9

Please sign in to comment.