guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: gnu: fp16: Fix build on i686-linux.


From: guix-commits
Subject: branch master updated: gnu: fp16: Fix build on i686-linux.
Date: Sat, 15 Oct 2022 17:28:14 -0400

This is an automated email from the git hooks/post-receive script.

mbakke pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new d799c8a5f6 gnu: fp16: Fix build on i686-linux.
d799c8a5f6 is described below

commit d799c8a5f666bf2b909a19b065a5651778731936
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Sat Oct 15 23:25:42 2022 +0200

    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.
---
 gnu/local.mk                                    |  1 +
 gnu/packages/maths.scm                          |  3 ++-
 gnu/packages/patches/fp16-implicit-double.patch | 23 +++++++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 1bd4722db4..78b0d72810 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/foobillard++-pkg-config.patch           \
   %D%/packages/patches/foomatic-filters-CVE-2015-8327.patch    \
   %D%/packages/patches/foomatic-filters-CVE-2015-8560.patch    \
+  %D%/packages/patches/fp16-implicit-double.patch              \
   %D%/packages/patches/fp16-system-libraries.patch             \
   %D%/packages/patches/fpc-reproducibility.patch               \
   %D%/packages/patches/freedink-engine-fix-sdl-hints.patch     \
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index ffd2a89d2f..83ce3256df 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -7690,7 +7690,8 @@ when an application performs repeated divisions by the 
same divisor.")
                 (sha256
                  (base32
                   "05mm4vrxsac35hjf5djif9r6rdxj9ippg97ia3p6q6b8lrp7srwv"))
-                (patches (search-patches "fp16-system-libraries.patch"))))
+                (patches (search-patches "fp16-implicit-double.patch"
+                                         "fp16-system-libraries.patch"))))
       (build-system cmake-build-system)
       (arguments
        `(#:imported-modules ((guix build python-build-system)
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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]