public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
@ 2024-04-25  5:09 mmatti at linux dot vnet.ibm.com
  2024-04-25  5:10 ` [Bug math/31682] " mmatti at linux dot vnet.ibm.com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-25  5:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

            Bug ID: 31682
           Summary: [PowerPC] Floating point exception error for math test
                    test-ceil-except-2 test-floor-except-2
                    test-trunc-except-2
           Product: glibc
           Version: 2.40
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: mmatti at linux dot vnet.ibm.com
  Target Milestone: ---

The following math test fail with the error Didn't expect signal from child:
got `Floating point exception'. This failure is observed only on PPC32 big
endian.

FAIL: math/test-ceil-except-2
FAIL: math/test-floor-except-2
FAIL: math/test-trunc-except-2

How to reproduce :

$ ./configure --prefix=/usr --build=powerpc-unknown-linux-gnu --enable-addons

$ make

$ make check

## --------------------- ##
## Platform information. ##
## --------------------- ##

uname -m = ppc64
uname -r = 5.18.0-2-powerpc64
uname -s = Linux
uname -v = #1 SMP Debian 5.18.5-1 (2022-06-16)

Architecture:            ppc64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Big Endian


The above mentioned failures are observed after the following commits

commit 637bfc392f406c6c77f59494ed34949a6161bceb
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Apr 3 16:39:17 2024 -0300

    math: x86 ceill traps when FE_INEXACT is enabled (BZ 31600)

commit 932544efa469568525455bcb53d4eabeba0eb295
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Apr 3 16:39:18 2024 -0300

    math: x86 floor traps when FE_INEXACT is enabled (BZ 31601)

commit 44ccc2465c6af5bd811d8258bf744aaafd5392fc
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Apr 3 16:39:19 2024 -0300

    math: x86 trunc traps when FE_INEXACT is enabled (BZ 31603)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
@ 2024-04-25  5:10 ` mmatti at linux dot vnet.ibm.com
  2024-04-25  5:11 ` mmatti at linux dot vnet.ibm.com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-25  5:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

Manjunath S Matti <mmatti at linux dot vnet.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bergner at linux dot ibm.com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
  2024-04-25  5:10 ` [Bug math/31682] " mmatti at linux dot vnet.ibm.com
@ 2024-04-25  5:11 ` mmatti at linux dot vnet.ibm.com
  2024-04-25 12:58 ` adhemerval.zanella at linaro dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-25  5:11 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

Manjunath S Matti <mmatti at linux dot vnet.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
  2024-04-25  5:10 ` [Bug math/31682] " mmatti at linux dot vnet.ibm.com
  2024-04-25  5:11 ` mmatti at linux dot vnet.ibm.com
@ 2024-04-25 12:58 ` adhemerval.zanella at linaro dot org
  2024-04-25 13:12 ` adhemerval.zanella at linaro dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-04-25 12:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
I am using cfarm203 (POWER8) to try to reproduce it without much success. This
is similar to your environment, but with a more recent kernel.

I am targeting both powerpc-linux-gnu, which enables the generic implementation
for powerpc (round_to_integer_double); and powerpc-linux-gnu-power4, which
enables the ifunc variant that routes to the __ceil_power5plus and uses the
builint (frip). Neither show any regression.

Could you check what might be happening in your system?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
                   ` (2 preceding siblings ...)
  2024-04-25 12:58 ` adhemerval.zanella at linaro dot org
@ 2024-04-25 13:12 ` adhemerval.zanella at linaro dot org
  2024-04-26 15:56 ` mmatti at linux dot vnet.ibm.com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-04-25 13:12 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

--- Comment #2 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
I also have tested a powerpc-linux-gnu-power8, which should be similar to
powerpc-linux-gnu-power4.

The missing test case, which I don't have a way to check, is a power9+ build.
It enables some mffs optimization (sysdeps/powerpc/fpu/fenv_libc.h).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
                   ` (3 preceding siblings ...)
  2024-04-25 13:12 ` adhemerval.zanella at linaro dot org
@ 2024-04-26 15:56 ` mmatti at linux dot vnet.ibm.com
  2024-04-26 17:52 ` adhemerval.zanella at linaro dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-26 15:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

--- Comment #3 from Manjunath S Matti <mmatti at linux dot vnet.ibm.com> ---
I see this error on one of our CI build systems. I am debugging further, but
looks like the problem is around here (round_to_integer.h:102)


Program received signal SIGFPE, Arithmetic exception.
0x6ff4eb3c in round_to_integer_float (mode=CEIL, x=8388610) at
../sysdeps/powerpc/fpu/round_to_integer.h:102
102           r += 0x1p+23;
(gdb) bt
#0  0x6ff4eb3c in round_to_integer_float (mode=CEIL, x=8388610) at
../sysdeps/powerpc/fpu/round_to_integer.h:102
#1  __ceilf (x=8388610) at ../sysdeps/powerpc/fpu/s_ceilf.c:30
#2  0x6ffc14ac in ?? ()
#3  0x6ffc16c8 in ?? ()
#4  0x6ffc1ba4 in ?? ()
#5  0x6ffc20b8 in ?? ()
#6  0x6ffc1790 in ?? ()
#7  0x6fcbb964 in __libc_start_call_main (main=0xfffeea00,
main@entry=0x6ffc1728, argc=-70968, argc@entry=1878917412, argv=0xfffeed98,
argv@entry=0xfffeed94, auxvec=0x1,
    auxvec@entry=0xfffeee28) at ../sysdeps/nptl/libc_start_call_main.h:58
#8  0x6fcbbba0 in generic_start_main (init=0x0, fini=0x0, stack_end=<optimized
out>, rtld_fini=<optimized out>, auxvec=0xfffeee28, argv=0xfffeed94,
argc=<optimized out>, main=0x6ffc1728)
    at ../csu/libc-start.c:360
#9  __libc_start_main_impl (argc=<optimized out>, argv=0xfffeed94,
ev=<optimized out>, auxvec=0xfffeee28, rtld_fini=<optimized out>,
stinfo=<optimized out>, stack_on_entry=<optimized out>)
    at ../sysdeps/unix/sysv/linux/powerpc/libc-start.c:115
#10 0x00000000 in ?? ()

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
                   ` (4 preceding siblings ...)
  2024-04-26 15:56 ` mmatti at linux dot vnet.ibm.com
@ 2024-04-26 17:52 ` adhemerval.zanella at linaro dot org
  2024-04-27  8:23 ` mmatti at linux dot vnet.ibm.com
  2024-05-09 12:39 ` adhemerval.zanella at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-04-26 17:52 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Ok, I think I know what might be happening.  You are probably running the tests
on a POWER9 chip, where __fesetround_inline_nocheck will use the __fe_mffscrn
(either through _ARCH_PWR9 or by the hwcap).  For generic powerpc
ceil/floor/trunc the macro is supposed to *not* change the Floating-Point
Inexact Exception Enable bit, however since
e68b1151f7460d5fa88c3a567c13f66052da79a7 it now clears it due mffscrni usage
(which clear bits 56:63 (VE, OE, UE, ZE, XE, NI, RN), different than mtfsfi).

Check if the following fix helps:

diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
index f9167056a8..afcf8d2e61 100644
--- a/sysdeps/powerpc/fpu/fenv_libc.h
+++ b/sysdeps/powerpc/fpu/fenv_libc.h
@@ -182,19 +182,13 @@ __fesetround_inline (int round)
   return 0;
 }

-/* Same as __fesetround_inline, however without runtime check to use DFP
-   mtfsfi syntax (as relax_fenv_state) or if round value is valid.  */
+/* Same as __fesetround_inline, but it does not change the floating-point
+   exceptions bits, and without runtime check to use DFP mtfsfi syntax
+   (as relax_fenv_state), or if round value is valid.  */
 static inline void
 __fesetround_inline_nocheck (const int round)
 {
-#ifdef _ARCH_PWR9
-  __fe_mffscrn (round);
-#else
-  if (__glibc_likely (GLRO(dl_hwcap2) & PPC_FEATURE2_ARCH_3_00))
-    __fe_mffscrn (round);
-  else
-    asm volatile ("mtfsfi 7,%0" : : "n" (round));
-#endif
+  asm volatile ("mtfsfi 7,%0" : : "n" (round));
 }

 #define FPSCR_MASK(bit) (1 << (31 - (bit)))

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
                   ` (5 preceding siblings ...)
  2024-04-26 17:52 ` adhemerval.zanella at linaro dot org
@ 2024-04-27  8:23 ` mmatti at linux dot vnet.ibm.com
  2024-05-09 12:39 ` adhemerval.zanella at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-27  8:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

--- Comment #5 from Manjunath S Matti <mmatti at linux dot vnet.ibm.com> ---
(In reply to Adhemerval Zanella from comment #4)
> Ok, I think I know what might be happening.  You are probably running the
> tests on a POWER9 chip, where __fesetround_inline_nocheck will use the
> __fe_mffscrn (either through _ARCH_PWR9 or by the hwcap).  For generic
> powerpc ceil/floor/trunc the macro is supposed to *not* change the
> Floating-Point Inexact Exception Enable bit, however since
> e68b1151f7460d5fa88c3a567c13f66052da79a7 it now clears it due mffscrni usage
> (which clear bits 56:63 (VE, OE, UE, ZE, XE, NI, RN), different than mtfsfi).
> 
> Check if the following fix helps:
> 
> diff --git a/sysdeps/powerpc/fpu/fenv_libc.h
> b/sysdeps/powerpc/fpu/fenv_libc.h
> index f9167056a8..afcf8d2e61 100644
> --- a/sysdeps/powerpc/fpu/fenv_libc.h
> +++ b/sysdeps/powerpc/fpu/fenv_libc.h
> @@ -182,19 +182,13 @@ __fesetround_inline (int round)
>    return 0;
>  }
> 
> -/* Same as __fesetround_inline, however without runtime check to use DFP
> -   mtfsfi syntax (as relax_fenv_state) or if round value is valid.  */
> +/* Same as __fesetround_inline, but it does not change the floating-point
> +   exceptions bits, and without runtime check to use DFP mtfsfi syntax
> +   (as relax_fenv_state), or if round value is valid.  */
>  static inline void
>  __fesetround_inline_nocheck (const int round)
>  {
> -#ifdef _ARCH_PWR9
> -  __fe_mffscrn (round);
> -#else
> -  if (__glibc_likely (GLRO(dl_hwcap2) & PPC_FEATURE2_ARCH_3_00))
> -    __fe_mffscrn (round);
> -  else
> -    asm volatile ("mtfsfi 7,%0" : : "n" (round));
> -#endif
> +  asm volatile ("mtfsfi 7,%0" : : "n" (round));
>  }
> 
>  #define FPSCR_MASK(bit) (1 << (31 - (bit)))

The change fixes this issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug math/31682] [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2
  2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
                   ` (6 preceding siblings ...)
  2024-04-27  8:23 ` mmatti at linux dot vnet.ibm.com
@ 2024-05-09 12:39 ` adhemerval.zanella at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-05-09 12:39 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31682

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.40.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-09 12:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25  5:09 [Bug math/31682] New: [PowerPC] Floating point exception error for math test test-ceil-except-2 test-floor-except-2 test-trunc-except-2 mmatti at linux dot vnet.ibm.com
2024-04-25  5:10 ` [Bug math/31682] " mmatti at linux dot vnet.ibm.com
2024-04-25  5:11 ` mmatti at linux dot vnet.ibm.com
2024-04-25 12:58 ` adhemerval.zanella at linaro dot org
2024-04-25 13:12 ` adhemerval.zanella at linaro dot org
2024-04-26 15:56 ` mmatti at linux dot vnet.ibm.com
2024-04-26 17:52 ` adhemerval.zanella at linaro dot org
2024-04-27  8:23 ` mmatti at linux dot vnet.ibm.com
2024-05-09 12:39 ` adhemerval.zanella at linaro dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).