public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Matthias Kretz <m.kretz@gsi.de>
To: Jonathan Wakely <jwakely@redhat.com>,
	Matthias Kretz <m.kretz@gsi.de>, <libstdc++@gcc.gnu.org>,
	<gcc-patches@gcc.gnu.org>,
	Srinivas Yadav Singanaboina <vasusrinivas.vasu14@gmail.com>,
	<richard.sandiford@arm.com>
Subject: Re: [PATCH v2] libstdc++: add ARM SVE support to std::experimental::simd
Date: Wed, 27 Mar 2024 11:30:12 +0100	[thread overview]
Message-ID: <4336515.ejJDZkT8p0@minbar> (raw)
In-Reply-To: <mptbk7056p9.fsf@arm.com>

[-- Attachment #1: Type: text/plain, Size: 2670 bytes --]

On Wednesday, 27 March 2024 11:07:14 CET Richard Sandiford wrote:
> I'm still worried about:
> 
>   #if _GLIBCXX_SIMD_HAVE_SVE
>   constexpr inline int __sve_vectorized_size_bytes = __ARM_FEATURE_SVE_BITS
> / 8; #else
>   constexpr inline int __sve_vectorized_size_bytes = 0;
>   #endif
> 
> and the direct use __ARM_FEATURE_SVE_BITS elsewhere, for the reasons
> discussed here (including possible ODR problems):
> 
>   https://gcc.gnu.org/pipermail/gcc-patches/2023-December/640037.html
>   https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643734.html
> 
> Logically the vector length should be a template parameter rather than
> an invariant.  Has this been resolved?  If not, it feels like a blocker
> to me (sorry).

The vector length is always a template parameter to all user-facing API. Some 
examples

1. on aarch64 the following is independent of SVE flags (and status quo):

  simd<float> is an alias for
  simd<float, simd_abi::_VecBuiltin<16>

  fixed_size_simd<float, 4> is supposed to be ABI-stable anyway (passed via
  the stack, alignof == sizeof).

2. with -msve-vector-bits=512:

  native_simd<float> is an alias for
  simd<float, simd_abi::_SveAbi<64, 64>>

  simd<float, simd_abi::deduce_t<float, 4>> is an alias for
  simd<float, simd_abi::_SveAbi<16, 64>>

3. with -msve-vector-bits=256: 

  native_simd<float> is an alias for
  simd<float, simd_abi::_SveAbi<32, 32>>

  simd<float, simd_abi::deduce_t<float, 4>> is an alias for
  simd<float, simd_abi::_SveAbi<16, 32>>

Implementation functions are either [[gnu::always_inline]] or tagged with the 
ABI tag type and the __odr_helper template argument (to ensure not-inlined 
inline functions have unique names).

Does that make __ARM_FEATURE_SVE_BITS usage indirect enough?

Also for context, please consider that this is std::*experimental*::simd. The 
underlying ISO document will likely get retracted at some point and the whole 
API and implementation (hopefully) superseded by C++26. The main purpose of 
the spec and implementation is to gather experience.

Best,
  Matthias

-- 
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Center for Heavy Ion Research               https://gsi.de
 std::simd
──────────────────────────────────────────────────────────────────────────

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2024-03-27 10:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 15:59 [PATCH] " Srinivas Yadav
2023-12-10 13:29 ` Richard Sandiford
2023-12-11 11:02   ` Richard Sandiford
2024-01-04  7:42   ` Srinivas Yadav
2024-01-04  9:10     ` Andrew Pinski
2024-01-18  7:27       ` Matthias Kretz
2024-01-18  7:40         ` Andrew Pinski
2024-01-18  8:40           ` Matthias Kretz
2024-01-18  6:54   ` Matthias Kretz
2024-01-23 20:57     ` Richard Sandiford
2024-03-27 11:53       ` Matthias Kretz
2024-03-27 13:34         ` Richard Sandiford
2024-03-28 14:48           ` Matthias Kretz
2024-02-09 14:28   ` [PATCH v2] " Srinivas Yadav Singanaboina
2024-03-08  9:57     ` Matthias Kretz
2024-03-27  9:50       ` Jonathan Wakely
2024-03-27 10:07         ` Richard Sandiford
2024-03-27 10:30           ` Matthias Kretz [this message]
2024-03-27 12:13             ` Richard Sandiford
2024-03-27 12:47               ` Jonathan Wakely
2024-03-27 14:18         ` Matthias Kretz

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=4336515.ejJDZkT8p0@minbar \
    --to=m.kretz@gsi.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    --cc=vasusrinivas.vasu14@gmail.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).