From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 685C03858D37 for ; Fri, 21 Apr 2023 09:48:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 685C03858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EEC511480; Fri, 21 Apr 2023 02:48:53 -0700 (PDT) Received: from [10.57.68.178] (unknown [10.57.68.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2DE3F3F5A1; Fri, 21 Apr 2023 02:48:08 -0700 (PDT) Message-ID: Date: Fri, 21 Apr 2023 10:28:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [RFC 0/X] Implement GCC support for AArch64 libmvec Content-Language: en-US To: "gcc-patches@gcc.gnu.org" , "jakub@redhat.com" , Richard Biener , richard.sandiford@arm.com References: From: "Andre Vieira (lists)" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,NICE_REPLY_A,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 20/04/2023 17:13, Richard Sandiford wrote: > "Andre Vieira (lists)" writes: >> On 20/04/2023 15:51, Richard Sandiford wrote: >>> "Andre Vieira (lists)" writes: >>>> Hi all, >>>> >>>> This is a series of patches/RFCs to implement support in GCC to be able >>>> to target AArch64's libmvec functions that will be/are being added to glibc. >>>> We have chosen to use the omp pragma '#pragma omp declare variant ...' >>>> with a simd construct as the way for glibc to inform GCC what functions >>>> are available. >>>> >>>> For example, if we would like to supply a vector version of the scalar >>>> 'cosf' we would have an include file with something like: >>>> typedef __attribute__((__neon_vector_type__(4))) float __f32x4_t; >>>> typedef __attribute__((__neon_vector_type__(2))) float __f32x2_t; >>>> typedef __SVFloat32_t __sv_f32_t; >>>> typedef __SVBool_t __sv_bool_t; >>>> __f32x4_t _ZGVnN4v_cosf (__f32x4_t); >>>> __f32x2_t _ZGVnN2v_cosf (__f32x2_t); >>>> __sv_f32_t _ZGVsMxv_cosf (__sv_f32_t, __sv_bool_t); >>>> #pragma omp declare variant(_ZGVnN4v_cosf) \ >>>> match(construct = {simd(notinbranch, simdlen(4))}, device = >>>> {isa("simd")}) >>>> #pragma omp declare variant(_ZGVnN2v_cosf) \ >>>> match(construct = {simd(notinbranch, simdlen(2))}, device = >>>> {isa("simd")}) >>>> #pragma omp declare variant(_ZGVsMxv_cosf) \ >>>> match(construct = {simd(inbranch)}, device = {isa("sve")}) >>>> extern float cosf (float); >>>> >>>> The BETA ABI can be found in the vfabia64 subdir of >>>> https://github.com/ARM-software/abi-aa/ >>>> This currently disagrees with how this patch series implements 'omp >>>> declare simd' for SVE and I also do not see a need for the 'omp declare >>>> variant' scalable extension constructs. I will make changes to the ABI >>>> once we've finalized the co-design of the ABI and this implementation. >>> >>> I don't see a good reason for dropping the extension("scalable"). >>> The problem is that since the base spec requires a simdlen clause, >>> GCC should in general raise an error if simdlen is omitted. >> Where can you find this in the specs? I tried to find it but couldn't. >> >> Leaving out simdlen in a 'omp declare simd' I assume is OK, our vector >> ABI defines behaviour for this. But I couldn't find what it meant for a >> omp declare variant, obviously can't be the same as for declare simd, as >> that is defined to mean 'define a set of clones' and only one clone can >> be associated to a declare variant. > > I was going from https://www.openmp.org/spec-html/5.0/openmpsu25.html , > which says: > > The simd trait can be further defined with properties that match the > clauses accepted by the declare simd directive with the same name and > semantics. The simd trait must define at least the simdlen property and > one of the inbranch or notinbranch properties. > > (probably best to read it in the original -- it's almost incomprehensible > without markup) > I'm guessing the keyword here is 'trait' which I'm guessing is different from a omp declare simd directive, which is why it's not required to have a simdlen clause in an omp declare simd (see Jakub's comment). But for declare variants I guess it does require you to? It doesn't 'break' anything, just means I need to add support for parsing the extension clause as was originally planned. > Richard