From: Matthias Kretz <m.kretz@gsi.de>
To: Matthias Kretz via Libstdc++ <libstdc++@gcc.gnu.org>,
<gcc-patches@gcc.gnu.org>, Alexandre Oliva <oliva@adacore.com>
Subject: Re: [PATCH] libstdc++: Correct NTTP and simd_mask ctor call
Date: Fri, 2 Jun 2023 10:50:33 +0200 [thread overview]
Message-ID: <4768566.iIbC2pHGDl@minbar> (raw)
In-Reply-To: <orwn0m1cyf.fsf@lxoliva.fsfla.org>
Hello Alexandre,
On Friday, 2 June 2023 10:32:40 CEST Alexandre Oliva wrote:
> On May 26, 2023, Matthias Kretz via Libstdc++ <libstdc++@gcc.gnu.org> wrote:
> > OK for master and all backports (after 11.4 is done)?
> > tested on powerpc64le-linux-gnu and x86_64-pc-linux-gnu
> >
> > * testsuite/experimental/simd/pr109822_cast_functions.cc: New
> > test.
>
> This testcase fails to compile on PowerPC targets without VSX: 64-bit
> integer and floating-point types cannot be vectorized.
Yes, and the simd implementation already encodes that both in
__vectorized_sizeof<T>() and __intrinsic_type<T>.
> I wonder if the test is malformed (and should be amended to test for
> available simd types), or whether a patch like this would be desirable
> to make simd constructs more portable. I'm not sure about the
> requirements.
The test is correct. The stdx::simd implementation has a latent bug (my
dejagnu boards included only POWER7-POWER9; I'm at POWER5-POWER10 by now). The
_S_store function is trying to work around bad code-gen but fails to notice
that long long vectors can't be used.
I'm looking at that function again, also in light of recent improvements wrt.
code-gen, and will remove that assumption, that long long is vectorizable.
__intrinsic_type_t<T> should never be T, but always the type that can be
passed to corresponding platform intrinsics. There are traits for the
implementation to detect whether the intrinsics types are available.
- Matthias
>
>
> [libstdc++] [simd] [ppc] use nonvector intrinsic fallback types
>
> From: Alexandre Oliva <oliva@adacore.com>
>
> Compiling such tests as pr109822_cast_functions.cc on powerpc targets
> that don't support VSX fails because some intrinsic types that are
> expected to be vectorizable are not defined without VSX.
>
> Introduce fallback non-vector types to enable the code to compile.
>
>
> for libstdc++-v3/ChangeLog
>
> * include/experimental/bits/simd.h: Introduce fallback
> non-vector intrinsic_type_impl specializations for PowerPC
> without VSX.
> ---
> libstdc++-v3/include/experimental/bits/simd.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/libstdc++-v3/include/experimental/bits/simd.h
> b/libstdc++-v3/include/experimental/bits/simd.h index
> 834fe923065bd..2691823e869e8 100644
> --- a/libstdc++-v3/include/experimental/bits/simd.h
> +++ b/libstdc++-v3/include/experimental/bits/simd.h
> @@ -2431,9 +2431,14 @@ template <typename _Tp>
> #define _GLIBCXX_SIMD_PPC_INTRIN(_Tp)
> \ template <>
> \ struct __intrinsic_type_impl<_Tp> { using type = __vector _Tp; }
> +#define _GLIBCXX_SIMD_PPC_INTRIN_NOVEC(_Tp)
\
> + template <>
> \ + struct __intrinsic_type_impl<_Tp> { using type = _Tp; }
> _GLIBCXX_SIMD_PPC_INTRIN(float);
> #ifdef __VSX__
> _GLIBCXX_SIMD_PPC_INTRIN(double);
> +#else
> +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(double);
> #endif
> _GLIBCXX_SIMD_PPC_INTRIN(signed char);
> _GLIBCXX_SIMD_PPC_INTRIN(unsigned char);
> @@ -2444,12 +2449,19 @@ _GLIBCXX_SIMD_PPC_INTRIN(unsigned int);
> #if defined __VSX__ || __SIZEOF_LONG__ == 4
> _GLIBCXX_SIMD_PPC_INTRIN(signed long);
> _GLIBCXX_SIMD_PPC_INTRIN(unsigned long);
> +#else
> +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(signed long);
> +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(unsigned long);
> #endif
> #ifdef __VSX__
> _GLIBCXX_SIMD_PPC_INTRIN(signed long long);
> _GLIBCXX_SIMD_PPC_INTRIN(unsigned long long);
> +#else
> +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(signed long long);
> +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(unsigned long long);
> #endif
> #undef _GLIBCXX_SIMD_PPC_INTRIN
> +#undef _GLIBCXX_SIMD_PPC_INTRIN_NOVEC
>
> template <typename _Tp, size_t _Bytes>
> struct __intrinsic_type<_Tp, _Bytes, enable_if_t<__is_vectorizable_v<_Tp>
> && _Bytes <= 16>>
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
stdₓ::simd
──────────────────────────────────────────────────────────────────────────
next prev parent reply other threads:[~2023-06-02 8:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 11:10 Matthias Kretz
2023-05-26 15:46 ` Jonathan Wakely
2023-06-02 8:32 ` Alexandre Oliva
2023-06-02 8:50 ` Matthias Kretz [this message]
2023-06-02 9:30 ` Alexandre Oliva
2023-06-02 9:41 ` Matthias Kretz
2023-06-02 12:06 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4768566.iIbC2pHGDl@minbar \
--to=m.kretz@gsi.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
--cc=oliva@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).