aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-10-15 23:25:42 +0200
committerMarius Bakke <marius@gnu.org>2022-10-15 23:26:59 +0200
commitd799c8a5f666bf2b909a19b065a5651778731936 (patch)
tree60e570af81227c3c0e30553182408a3e59c0ebf4 /gnu/packages/patches
parent5d58d2068423e2358044737fc27e5c4b875a5d20 (diff)
downloadguix-d799c8a5f666bf2b909a19b065a5651778731936.tar.gz
guix-d799c8a5f666bf2b909a19b065a5651778731936.zip
gnu: fp16: Fix build on i686-linux.
* gnu/packages/patches/fp16-implicit-double.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/maths.scm (fp16)[source](patches): Add it.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/fp16-implicit-double.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/gnu/packages/patches/fp16-implicit-double.patch b/gnu/packages/patches/fp16-implicit-double.patch
new file mode 100644
index 0000000000..87ed9a6a53
--- /dev/null
+++ b/gnu/packages/patches/fp16-implicit-double.patch
@@ -0,0 +1,23 @@
+Prevent implicit conversion of float to double to avoid precision
+error on i686.
+
+ https://github.com/Maratyszcza/FP16/issues/20
+
+Taken from Debian:
+
+ https://salsa.debian.org/deeplearning-team/fp16/-/blob/master/debian/patches/ftbfs-i386.patch
+
+Index: fp16/include/fp16/fp16.h
+===================================================================
+--- fp16.orig/include/fp16/fp16.h
++++ fp16/include/fp16/fp16.h
+@@ -228,7 +228,8 @@ static inline uint16_t fp16_ieee_from_fp
+ const float scale_to_inf = fp32_from_bits(UINT32_C(0x77800000));
+ const float scale_to_zero = fp32_from_bits(UINT32_C(0x08800000));
+ #endif
+- float base = (fabsf(f) * scale_to_inf) * scale_to_zero;
++ const volatile float base_inf = fabsf(f) * scale_to_inf;
++ float base = base_inf * scale_to_zero;
+
+ const uint32_t w = fp32_to_bits(f);
+ const uint32_t shl1_w = w + w;