public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs
@ 2024-06-21  7:39 ro at gcc dot gnu.org
  2024-06-21  7:39 ` [Bug libstdc++/115575] " ro at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ro at gcc dot gnu.org @ 2024-06-21  7:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

            Bug ID: 115575
           Summary: experimental/simd/pr115454_find_last_set.cc FAILs
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: mkretz at gcc dot gnu.org
  Target Milestone: ---
            Target: sparc-sun-solaris2.11

The new experimental/simd/pr115454_find_last_set.cc test FAILs on 32 and 64-bit
Solaris/SPARC:

FAIL: experimental/simd/pr115454_find_last_set.cc -mcpu=ultrasparc -mvis -O2
-Wno-psabi execution test

This happens even when compiling with -g3 -O0.  The test aborts:

Thread 2 received signal SIGABRT, Aborted.
[Switching to Thread 1 (LWP 1)]
0xfea79e4c in __lwp_sigqueue () from /lib/libc.so.1
(gdb) bt
#0  0xfea79e4c in __lwp_sigqueue () from /lib/libc.so.1
#1  0xfe9b75d8 in raise () from /lib/libc.so.1
#2  0xfe988840 in abort () from /lib/libc.so.1
#3  0x000132e4 in main ()
    at
/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc:48

r2 = 7 at this point.

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
@ 2024-06-21  7:39 ` ro at gcc dot gnu.org
  2024-06-21  9:24 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ro at gcc dot gnu.org @ 2024-06-21  7:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.0

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
  2024-06-21  7:39 ` [Bug libstdc++/115575] " ro at gcc dot gnu.org
@ 2024-06-21  9:24 ` redi at gcc dot gnu.org
  2024-06-21  9:59 ` mkretz at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2024-06-21  9:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It fails on x86_64-pc-linux-gnu too.

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
  2024-06-21  7:39 ` [Bug libstdc++/115575] " ro at gcc dot gnu.org
  2024-06-21  9:24 ` redi at gcc dot gnu.org
@ 2024-06-21  9:59 ` mkretz at gcc dot gnu.org
  2024-06-21 10:18 ` mkretz at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-06-21  9:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mkretz at gcc dot gnu.org
   Last reconfirmed|                            |2024-06-21
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
This is the first test of experimental/simd with 'dg-do run'. All existing
tests are compile-only. If this fails it means the new test finds an old bug.

Regarding x86_64, I only tested on a machine with AVX512. I assume your machine
fails the { target avx512f } selector and thus takes a different code path than
what I fixed for PR115454.

The huge test matrix of simd is my curse...

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-06-21  9:59 ` mkretz at gcc dot gnu.org
@ 2024-06-21 10:18 ` mkretz at gcc dot gnu.org
  2024-06-21 10:49 ` mkretz at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-06-21 10:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #3 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
As a simple "solution" I could change the target selector of 'dg-do run' to
'target avx512f', which makes the test match the original PR. And then make
this PR about find_last_set not working on all other non-AVX512 systems but
mine. ;)

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-06-21 10:18 ` mkretz at gcc dot gnu.org
@ 2024-06-21 10:49 ` mkretz at gcc dot gnu.org
  2024-06-21 11:07 ` mkretz at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-06-21 10:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #4 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
The test fails on x86_64 because the effective target selector 'avx512f' is
always true. Thus on non-AVX512 systems the test fails with 'illegal
instruction(s)'. That's a different issue than on SPARC, where it aborts with a
bogus value.

On SPARC vectorization of SIMD is actually disabled. Thus an '<int, 4>' mask is
a bitmask of 4 bits (a 'fixed_size_simd_mask'). Now, looking back at my
fixed_size implementation, the mask stores a _SanitizedBitMask. IOW, it assumes
the bit mask padding bits are always zero. Consequently, the memcpy in
'reduce2()' in the new test violates the invariant of fixed_size_simd_mask. The
test itself is the bug.

necessary changes:
1. compile with '-march=x86_64-v4' only with 'avx512f_runtime'.
2. add another constexpr-if condition in 'reduce2()' to skip fixed_size ABIs

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-06-21 10:49 ` mkretz at gcc dot gnu.org
@ 2024-06-21 11:07 ` mkretz at gcc dot gnu.org
  2024-06-21 16:06 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-06-21 11:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #5 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Still trying to somehow verify on SPARC...

diff --git a/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc
b/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc
index b47f19d3067..25a713b4e94 100644
--- a/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc
@@ -1,7 +1,7 @@
 // { dg-options "-std=gnu++17" }
 // { dg-do run { target *-*-* } }
 // { dg-require-effective-target c++17 }
-// { dg-additional-options "-march=x86-64-v4" { target avx512f } }
+// { dg-additional-options "-march=x86-64-v4" { target avx512f_runtime } }
 // { dg-require-cmath "" }

 #include <experimental/simd>
@@ -25,7 +25,9 @@ namespace stdx
 {
   using M8 = typename V<short, 8>::mask_type;
   using M4 = typename V<int, 4>::mask_type;
-  if constexpr (sizeof(M8) == sizeof(M4))
+  if constexpr (sizeof(M8) == sizeof(M4)
+                 && !std::is_same_v<M4, stdx::fixed_size_simd_mask<int, 4>>)
+    // fixed_size invariant: padding bits of masks are zero, the memcpy would
violate that
     {
       M4 k;
       __builtin_memcpy(&__data(k), &__data(M8(true)), sizeof(M4));

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-06-21 11:07 ` mkretz at gcc dot gnu.org
@ 2024-06-21 16:06 ` cvs-commit at gcc dot gnu.org
  2024-06-21 16:07 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-21 16:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Matthias Kretz <mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:77f321435b4ac37992c2ed6737ca0caa1dd50551

commit r15-1548-g77f321435b4ac37992c2ed6737ca0caa1dd50551
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 21 16:22:22 2024 +0200

    libstdc++: Fix test on x86_64 and non-simd targets

    * Running a test compiled with AVX512 instructions requires
    avx512f_runtime not just avx512f.

    * The 'reduce2' test violated an invariant of fixed_size_simd_mask and
    thus failed on all targets without 16-Byte vector builtins enabled (in
    bits/simd.h).

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115575
            * testsuite/experimental/simd/pr115454_find_last_set.cc: Require
            avx512f_runtime. Don't memcpy fixed_size masks.

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-06-21 16:06 ` cvs-commit at gcc dot gnu.org
@ 2024-06-21 16:07 ` cvs-commit at gcc dot gnu.org
  2024-06-21 16:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-21 16:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:a851931bc0d7a2b39ccc1f236015aabf24ee51f9

commit r14-10337-ga851931bc0d7a2b39ccc1f236015aabf24ee51f9
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 21 16:22:22 2024 +0200

    libstdc++: Fix test on x86_64 and non-simd targets

    * Running a test compiled with AVX512 instructions requires
    avx512f_runtime not just avx512f.

    * The 'reduce2' test violated an invariant of fixed_size_simd_mask and
    thus failed on all targets without 16-Byte vector builtins enabled (in
    bits/simd.h).

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115575
            * testsuite/experimental/simd/pr115454_find_last_set.cc: Require
            avx512f_runtime. Don't memcpy fixed_size masks.

    (cherry picked from commit 77f321435b4ac37992c2ed6737ca0caa1dd50551)

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-06-21 16:07 ` cvs-commit at gcc dot gnu.org
@ 2024-06-21 16:20 ` cvs-commit at gcc dot gnu.org
  2024-06-21 16:26 ` cvs-commit at gcc dot gnu.org
  2024-06-21 16:26 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-21 16:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:87cda03e707f9f3e049905a0f698221f3c7db148

commit r11-11531-g87cda03e707f9f3e049905a0f698221f3c7db148
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 21 16:22:22 2024 +0200

    libstdc++: Fix test on x86_64 and non-simd targets

    * Running a test compiled with AVX512 instructions requires
    avx512f_runtime not just avx512f.

    * The 'reduce2' test violated an invariant of fixed_size_simd_mask and
    thus failed on all targets without 16-Byte vector builtins enabled (in
    bits/simd.h).

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115575
            * testsuite/experimental/simd/pr115454_find_last_set.cc: Require
            avx512f_runtime. Don't memcpy fixed_size masks.

    (cherry picked from commit 77f321435b4ac37992c2ed6737ca0caa1dd50551)

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-06-21 16:20 ` cvs-commit at gcc dot gnu.org
@ 2024-06-21 16:26 ` cvs-commit at gcc dot gnu.org
  2024-06-21 16:26 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-21 16:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:c335e34ff89ec9aec1ba874dc5cece9c2303c906

commit r13-8862-gc335e34ff89ec9aec1ba874dc5cece9c2303c906
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 21 16:22:22 2024 +0200

    libstdc++: Fix test on x86_64 and non-simd targets

    * Running a test compiled with AVX512 instructions requires
    avx512f_runtime not just avx512f.

    * The 'reduce2' test violated an invariant of fixed_size_simd_mask and
    thus failed on all targets without 16-Byte vector builtins enabled (in
    bits/simd.h).

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115575
            * testsuite/experimental/simd/pr115454_find_last_set.cc: Require
            avx512f_runtime. Don't memcpy fixed_size masks.

    (cherry picked from commit 77f321435b4ac37992c2ed6737ca0caa1dd50551)

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

* [Bug libstdc++/115575] experimental/simd/pr115454_find_last_set.cc FAILs
  2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-06-21 16:26 ` cvs-commit at gcc dot gnu.org
@ 2024-06-21 16:26 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-21 16:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115575

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:169d4d1addaac7eef6cde4049aa8b4f3d81c28b0

commit r12-10575-g169d4d1addaac7eef6cde4049aa8b4f3d81c28b0
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 21 16:22:22 2024 +0200

    libstdc++: Fix test on x86_64 and non-simd targets

    * Running a test compiled with AVX512 instructions requires
    avx512f_runtime not just avx512f.

    * The 'reduce2' test violated an invariant of fixed_size_simd_mask and
    thus failed on all targets without 16-Byte vector builtins enabled (in
    bits/simd.h).

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115575
            * testsuite/experimental/simd/pr115454_find_last_set.cc: Require
            avx512f_runtime. Don't memcpy fixed_size masks.

    (cherry picked from commit 77f321435b4ac37992c2ed6737ca0caa1dd50551)

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

end of thread, other threads:[~2024-06-21 16:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-21  7:39 [Bug libstdc++/115575] New: experimental/simd/pr115454_find_last_set.cc FAILs ro at gcc dot gnu.org
2024-06-21  7:39 ` [Bug libstdc++/115575] " ro at gcc dot gnu.org
2024-06-21  9:24 ` redi at gcc dot gnu.org
2024-06-21  9:59 ` mkretz at gcc dot gnu.org
2024-06-21 10:18 ` mkretz at gcc dot gnu.org
2024-06-21 10:49 ` mkretz at gcc dot gnu.org
2024-06-21 11:07 ` mkretz at gcc dot gnu.org
2024-06-21 16:06 ` cvs-commit at gcc dot gnu.org
2024-06-21 16:07 ` cvs-commit at gcc dot gnu.org
2024-06-21 16:20 ` cvs-commit at gcc dot gnu.org
2024-06-21 16:26 ` cvs-commit at gcc dot gnu.org
2024-06-21 16:26 ` cvs-commit at gcc dot gnu.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).