From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id ECD3F385DC06 for ; Wed, 27 Mar 2024 12:47:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECD3F385DC06 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ECD3F385DC06 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711543648; cv=none; b=AbjXCV2VI4FR9AW/H7C/uil8JvFJixa/UZIAvTOVJno1D1c6kkW1Fx5Ls8n3s6kIjKn278wcX197bHwqWetGqRjpDkrVTH2v+h8QO22UQW3alkhcXTlJHlM2slsHz84AHb6U25uSooZ2/s3qGW3ad0hsBAfFjDu+hLiX/Y1+Q+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711543648; c=relaxed/simple; bh=jxVzBLHwUmrp8jn3JruU6MopRvnBGqK3b7gSqazIizE=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=OcePhCfX82o/XtpFftRkb2pMyYnNODXgn1Kl9I2nNGD9/SixO9/QefT/uG/H7wWR9znW5nh+BesVbvNS9qOoioJV2ZpMSPoh7LUKnGsxhbLY4qYVoGfsqaIIsIfjmtXrclA/udLkxXJV+aqYZ5VFhmBU/KsVI4UZoAqyY/k4v1M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711543645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4CNzHvuJsiB0MIrjAEvWNia77tvYl8eF/h2E6ULPzYc=; b=gBaerAN1EhTThjDMItSt+cYNPOiQxBNzGtJlt/p7h4enp/wEP++Qc93NlPLeP7yrhHEbHH 5TB+/nyD+Tx1hY5JDsWmgR0U/G2bwSO9EhImcqEWJS4/K8O7b/kc93aYWdM5DqtzMehP+H +XiFhbcXUfrg6zD1Oi5vUf1xHxOY1Pg= Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-306-1jH5bg6JO2CAUSfwc0TpIQ-1; Wed, 27 Mar 2024 08:47:24 -0400 X-MC-Unique: 1jH5bg6JO2CAUSfwc0TpIQ-1 Received: by mail-yb1-f197.google.com with SMTP id 3f1490d57ef6-dcbee93a3e1so10148563276.3 for ; Wed, 27 Mar 2024 05:47:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711543644; x=1712148444; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4CNzHvuJsiB0MIrjAEvWNia77tvYl8eF/h2E6ULPzYc=; b=iSNXIn433HawkTg6SBDse3gCLXUudL5TIAdD/w9oUEjUsd44xFbx/r+ls9ez+SRGRK 2zcsXTD5LpXReTnukT7HNkkcKHNRBtYGY3S3Jm2N0kfyPD8N5JPENoKSkVmHYaQJ+3X5 yueraxWTe42yCjzzFMFAfkC6ar/neThDriUe2HL+hrcei4MQuozsLc8mPVT1tEBP+JN7 LVBgO/AqLjKZnsyQWLdLwPwZPDO7xhrp/T5mW7spy5gnK8eE7Trfc3fPBhMBCZqsqdQG 8HkQ0STBGpZ1OVg4Vb9swQXtM8IN2bRb6o036GewT8BKf2gi/c6Sf6MVxBYJ05TVjgZb 3+qQ== X-Forwarded-Encrypted: i=1; AJvYcCUeMyfxgV8d76lMJ3S4241JAmIsB6wOViWvVae6BCk09hDUjOm1CIA2fIUSnix+uZiIBmI6zYijkZcw1xvdGcCssLVAsPldlA== X-Gm-Message-State: AOJu0Yxhq/QbAIzxdKFgGyeVjwXjeivlSrHpU7zdGsW5rZqSGreLMcCJ 4kGcFNce592Sxt7jE0pBo6Aa+69P9nhyBuk9rVPDB/qFuqlY1Zo5o4n0bYL24ERQGXNmn7MLjD4 HvTo4B3gkqh6SJXk4T3QrdM5NmTrQMyDx6sD/Zn8uP6kQX9VQ3yAZRi8IdGgTf5parvMLdg9M3z Dj721Vy7dY5ZhnRNvk+Ln97V0OhANwkQ== X-Received: by 2002:a25:8586:0:b0:dc7:46e7:7aea with SMTP id x6-20020a258586000000b00dc746e77aeamr2177510ybk.47.1711543643787; Wed, 27 Mar 2024 05:47:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHmSQ+PZKsxFaRt0BGOpwflczwMFmolMzBHW+fzPymJ0Qclr5H4QYN5ZfkxgRBqYaOdx/ueKy8VrIPP9dqd28= X-Received: by 2002:a25:8586:0:b0:dc7:46e7:7aea with SMTP id x6-20020a258586000000b00dc746e77aeamr2177499ybk.47.1711543643470; Wed, 27 Mar 2024 05:47:23 -0700 (PDT) MIME-Version: 1.0 References: <4336515.ejJDZkT8p0@minbar> In-Reply-To: From: Jonathan Wakely Date: Wed, 27 Mar 2024 12:47:07 +0000 Message-ID: Subject: Re: [PATCH v2] libstdc++: add ARM SVE support to std::experimental::simd To: Matthias Kretz , Jonathan Wakely , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org, Srinivas Yadav Singanaboina , richard.sandiford@arm.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 27 Mar 2024 at 12:13, Richard Sandiford wrote: > > Matthias Kretz writes: > > 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 is an alias for > > simd > > > > fixed_size_simd is supposed to be ABI-stable anyway (passed via > > the stack, alignof == sizeof). > > > > 2. with -msve-vector-bits=512: > > > > native_simd is an alias for > > simd> > > > > simd> is an alias for > > simd> > > > > 3. with -msve-vector-bits=256: > > > > native_simd is an alias for > > simd> > > > > simd> is an alias for > > simd> > > > > 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). > > Ah, thanks for the explanation. I think the global native_float alias > is problematic for reasons that you touched on in your later message. > I'll reply more about that there. But in other respects this looks good. > > > Does that make __ARM_FEATURE_SVE_BITS usage indirect enough? > > In principle, the only use of __ARM_FEATURE_SVE_BITS should be to determine > the definition of native_simd (with the caveats above). But current > GCC restrictions might make that impractical. > > > 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. > > Ah, ok. If this is a deliberate experiment for evidence-gathering > purposes, rather than a long-term commitment, then I agree the barrier > should be lower. Yes, that's definitely what this code is for. The more feedback and impl-experience we can get now with the std::experimental::simd version, the better std::simd will be when that happens. In practice, we probably won't ever actually remove the header even when the experiment is over (e.g. we still have with std::tr1::shared_ptr!), but we are likely to consider it unmaintained and deprecated once it's superseded by std::simd. > So yeah, I'll withdraw my objection. I've no problem with this going > into GCC 14 on the basis above. Thanks again to you and Srinivas for > working on this. > > Richard >