Add Imath support for fp16-fp32 conversions

pull/368/head
Abitofevrything 3 years ago
parent 97e0dfc8ba
commit 7bba2dd63d

@ -130,6 +130,10 @@ ifdef WHISPER_GPROF
CFLAGS += -pg
CXXFLAGS += -pg
endif
ifdef WHISPER_IMATH
CFLAGS += -DGGML_USE_IMATH
LDFLAGS += -lImath
endif
ifneq ($(filter aarch64%,$(UNAME_M)),)
endif
ifneq ($(filter armv6%,$(UNAME_M)),)

@ -158,6 +158,13 @@ ggml_fp16_t ggml_fp32_to_fp16(float f) {
#define GGML_FP16_TO_FP32(x) _cvtsh_ss(x)
#define GGML_FP32_TO_FP16(x) _cvtss_sh(x, 0)
#elif GGML_USE_IMATH
#include <Imath/half.h>
#define GGML_FP16_TO_FP32(x) imath_half_to_float(x)
#define GGML_FP32_TO_FP16(x) imath_float_to_half(x)
#else
// FP16 <-> FP32

Loading…
Cancel
Save