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.129.124]) by sourceware.org (Postfix) with ESMTPS id 08F893860002 for ; Wed, 27 Mar 2024 12:47:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 08F893860002 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 08F893860002 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.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-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-CagsQM4BOR2dP5BaV8C-eQ-1; Wed, 27 Mar 2024 08:47:24 -0400 X-MC-Unique: CagsQM4BOR2dP5BaV8C-eQ-1 Received: by mail-yb1-f199.google.com with SMTP id 3f1490d57ef6-ddaf165a8d9so3428194276.1 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=SnGDlMMeT5u7+7Dxc+GsJrR73NesyT+4X1xnppR/WPVjV25TmoMNIy7wVMmpajWA1r DxoJwPnEwTE+3t0kynncWcquvX9tuxt4LHQPihz3cocMHxyQMlPD//55zhR2PLHAVOdJ dayCjRGNzvzvQv8HvpLXLHZrYxVcig01cszhuZoueWP+ZDh+f7qurg9TsAjfOwqgO3PS oAGur8rCNLETXubdyrZhTcXnURCNY5Hb7xTCIrlG+DYoMgWxCDZRpwg5wavG7Odsi6JS UMshvffs80kE9xgSREjdmy3upGZiIBvzXE6L6fUaBuXXh9chHzcQ/BHzTgT2+/ceC456 qi/Q== X-Forwarded-Encrypted: i=1; AJvYcCV9tAefx+mVC/Lul6QrWNGVk95nV6SvhiJ4WbE9a2UGhuH16PSS+KGiMaOFiuatfJmm2jjfs8rvCbN+0+YYUPWhBTggx/U= X-Gm-Message-State: AOJu0YxNBBd1Sglwtcb39y9pD3qzglTEF26vhVVRGepXO8fkiTaRqf8E f5Jx0IxQrJjco7wUo8pFoX5ikrVVNkFaicNM60IRckWKehi8u9/GciyK+64Me2GcqNk61cimXuL nlojiLqeXrD2PxRURpM1tdyS11Pc81eCUd4kQ/kT4R6k/e/5GeP58OSqkgYnJGE+uy52y8S6KpF 08jxZtOxESAUi5djzI0zWXWWZU52E= X-Received: by 2002:a25:8586:0:b0:dc7:46e7:7aea with SMTP id x6-20020a258586000000b00dc746e77aeamr2177508ybk.47.1711543643771; 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.1 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 >