public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction
@ 2023-05-31  9:50 mkretz at gcc dot gnu.org
  2023-05-31  9:51 ` [Bug libstdc++/110054] " mkretz at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2023-05-31  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110054
           Summary: stdx::simd masked store should not use non-temporal
                    store instruction
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mkretz at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64-*-*, i?86-*-*

test case: https://compiler-explorer.com/z/h1qd3bajG

where(k, v).copy_to(ptr, ...)

compiles to MASKMOVDQU which is a non-temporal store. All other stores in simd
are normal (temporal) stores. A non-temporal store only makes sense if the user
explicitly asked for this behavior. Otherwise the performance hit can be
significant, because the relevant cache line(s) need to be evicted before the
write-combining write to memory.

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
@ 2023-05-31  9:51 ` mkretz at gcc dot gnu.org
  2023-05-31 11:54 ` amonakov at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2023-05-31  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-05-31
           Assignee|unassigned at gcc dot gnu.org      |mkretz at gcc dot gnu.org
     Ever confirmed|0                           |1

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
  2023-05-31  9:51 ` [Bug libstdc++/110054] " mkretz at gcc dot gnu.org
@ 2023-05-31 11:54 ` amonakov at gcc dot gnu.org
  2023-06-06 13:45 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-05-31 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
This is a correctness issue as well due to lack of SFENCE.

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
  2023-05-31  9:51 ` [Bug libstdc++/110054] " mkretz at gcc dot gnu.org
  2023-05-31 11:54 ` amonakov at gcc dot gnu.org
@ 2023-06-06 13:45 ` cvs-commit at gcc dot gnu.org
  2023-06-06 14:14 ` mkretz at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-06 13:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS 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:27e45b7597d6fb1a71927d658a0294797b720c0a

commit r14-1577-g27e45b7597d6fb1a71927d658a0294797b720c0a
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 2 13:44:22 2023 +0200

    libstdc++: Replace use of incorrect non-temporal store

    The call to the base implementation sometimes didn't find a matching
    signature because the _Abi parameter of _SimdImpl* was "wrong" after
    conversion. It has to call into <new ABI tag>::_SimdImpl instead of the
    current ABI tag's _SimdImpl. This also reduces the number of possible
    template instantiations.

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/110054
            * include/experimental/bits/simd_builtin.h (_S_masked_store):
            Call into deduced ABI's SimdImpl after conversion.
            * include/experimental/bits/simd_x86.h (_S_masked_store_nocvt):
            Don't use _mm_maskmoveu_si128. Use the generic fall-back
            implementation. Also fix masked stores without SSE2, which
            were not doing anything before.

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-06-06 13:45 ` cvs-commit at gcc dot gnu.org
@ 2023-06-06 14:14 ` mkretz at gcc dot gnu.org
  2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2023-06-06 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Fixed on master. Will backport later.

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-06-06 14:14 ` mkretz at gcc dot gnu.org
@ 2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
  2024-05-08 16:14 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:63b73f14be97a9fe8621ec1a523b6dd19bde72dc

commit r13-8705-g63b73f14be97a9fe8621ec1a523b6dd19bde72dc
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 2 13:44:22 2023 +0200

    libstdc++: Replace use of incorrect non-temporal store

    The call to the base implementation sometimes didn't find a matching
    signature because the _Abi parameter of _SimdImpl* was "wrong" after
    conversion. It has to call into <new ABI tag>::_SimdImpl instead of the
    current ABI tag's _SimdImpl. This also reduces the number of possible
    template instantiations.

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/110054
            * include/experimental/bits/simd_builtin.h (_S_masked_store):
            Call into deduced ABI's SimdImpl after conversion.
            * include/experimental/bits/simd_x86.h (_S_masked_store_nocvt):
            Don't use _mm_maskmoveu_si128. Use the generic fall-back
            implementation. Also fix masked stores without SSE2, which
            were not doing anything before.

    (cherry picked from commit 27e45b7597d6fb1a71927d658a0294797b720c0a)

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
@ 2024-05-08 16:14 ` cvs-commit at gcc dot gnu.org
  2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
  2024-05-10 14:25 ` mkretz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-08 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:e60ec9b0e02e8647c289d204342e992e91750011

commit r12-10422-ge60ec9b0e02e8647c289d204342e992e91750011
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 2 13:44:22 2023 +0200

    libstdc++: Replace use of incorrect non-temporal store

    The call to the base implementation sometimes didn't find a matching
    signature because the _Abi parameter of _SimdImpl* was "wrong" after
    conversion. It has to call into <new ABI tag>::_SimdImpl instead of the
    current ABI tag's _SimdImpl. This also reduces the number of possible
    template instantiations.

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/110054
            * include/experimental/bits/simd_builtin.h (_S_masked_store):
            Call into deduced ABI's SimdImpl after conversion.
            * include/experimental/bits/simd_x86.h (_S_masked_store_nocvt):
            Don't use _mm_maskmoveu_si128. Use the generic fall-back
            implementation. Also fix masked stores without SSE2, which
            were not doing anything before.

    (cherry picked from commit 27e45b7597d6fb1a71927d658a0294797b720c0a)

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-05-08 16:14 ` cvs-commit at gcc dot gnu.org
@ 2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
  2024-05-10 14:25 ` mkretz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-10 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:db0c654ae689e92d8ba0421815a820278b777b06

commit r11-11427-gdb0c654ae689e92d8ba0421815a820278b777b06
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Fri Jun 2 13:44:22 2023 +0200

    libstdc++: Replace use of incorrect non-temporal store

    The call to the base implementation sometimes didn't find a matching
    signature because the _Abi parameter of _SimdImpl* was "wrong" after
    conversion. It has to call into <new ABI tag>::_SimdImpl instead of the
    current ABI tag's _SimdImpl. This also reduces the number of possible
    template instantiations.

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/110054
            * include/experimental/bits/simd_builtin.h (_S_masked_store):
            Call into deduced ABI's SimdImpl after conversion.
            * include/experimental/bits/simd_x86.h (_S_masked_store_nocvt):
            Don't use _mm_maskmoveu_si128. Use the generic fall-back
            implementation. Also fix masked stores without SSE2, which
            were not doing anything before.

    (cherry picked from commit 27e45b7597d6fb1a71927d658a0294797b720c0a)

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

* [Bug libstdc++/110054] stdx::simd masked store should not use non-temporal store instruction
  2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
@ 2024-05-10 14:25 ` mkretz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-05-10 14:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Fixed on all branches.

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

end of thread, other threads:[~2024-05-10 14:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31  9:50 [Bug libstdc++/110054] New: stdx::simd masked store should not use non-temporal store instruction mkretz at gcc dot gnu.org
2023-05-31  9:51 ` [Bug libstdc++/110054] " mkretz at gcc dot gnu.org
2023-05-31 11:54 ` amonakov at gcc dot gnu.org
2023-06-06 13:45 ` cvs-commit at gcc dot gnu.org
2023-06-06 14:14 ` mkretz at gcc dot gnu.org
2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
2024-05-08 16:14 ` cvs-commit at gcc dot gnu.org
2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
2024-05-10 14:25 ` mkretz 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).