From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 8052F3858D39 for ; Tue, 28 Feb 2023 23:06:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8052F3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1030.google.com with SMTP id q31-20020a17090a17a200b0023750b69614so11129212pja.5 for ; Tue, 28 Feb 2023 15:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LGWJG3gLmmvNfia4EMOJeH8p2MPBmEjgebMQcYFCnt0=; b=B09U9ukCOwg9kM6S1Jv4IBu1gObPi3eT/Ntao6y7mKkPSD46FmDeYuOENDpbMqOO9S qUpc8AdlYuH46YnvVtNIGxCyoj1S3DKO2HPbV8IXsa6SLp/Ag5RtbNgdX8/fAcqzdQNg 0VqgcNV0BzF0pjGizPxnfDz//UFWkx7refpW0o8vzCpDzpQe/61uJwcOxZ0mYt6rwV+2 EZWtpmwzogE0wSoFrxQKLP88hLqCI7u/IlbbFzoNvCYyKsglVWw16onKjp7uHPFU8VCq IAt7Np8fI/Z9gZAum66Zex2Ku0IdAf9HvnPuDfZ/FXnYF0DgWtA9CKK7IOKcNcjbd1/o bFIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc: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=LGWJG3gLmmvNfia4EMOJeH8p2MPBmEjgebMQcYFCnt0=; b=pXk+TmD50so3ygM+6uMTTjnCtTfzIf6uLGbxR1muPv3Tr7MT+sq9nofjcQIpZnG5Rs I/U3kYO7Oyz7kcz6mDd7JWCMbL1x5uVF1CNZYyPzwGIqYV5rvjl/i3yU+s1a4cFU3Ljd lXH06R/8Dj61zGvTZuI3+Y4SA49WDwdqDsl+Y63G2sg8Q2qY44jGATvgUrmvph3zSQT5 OVNtmZ7ncCn5ZgTmpMNoCasHkRx9O/oYWuAGrsx8mnIBTVCqEA0BenmgpEUWt4b6SM3E rr9Osb7SpniX1FRX9CSWRvSPfcxj8SX8ELWq4AKqI7njMzUPzT1RbHdSNocNggmL1pjH zgqg== X-Gm-Message-State: AO0yUKUCLtZzlF5OEsVVeSwFlWqBqdI0+heEIO/w1pR1N5N3Cknk/Rge CAwm7cwBYVvYcF8EbOE2EVp+UW/HsgacSZKKwqo= X-Google-Smtp-Source: AK7set9tCl2uNLqW2vCInVqLcVApsXxmw/RrB2n9kLfq6T+v6xzBR0Ja/stjD5/V3SBZN2LKPsAlAYLDD4jwDHxqqSM= X-Received: by 2002:a17:90a:9c06:b0:236:736d:2581 with SMTP id h6-20020a17090a9c0600b00236736d2581mr1722590pjp.8.1677625617374; Tue, 28 Feb 2023 15:06:57 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Pinski Date: Tue, 28 Feb 2023 15:06:45 -0800 Message-ID: Subject: Re: [PATCH] amdgcn: Enable SIMD vectorization of math functions To: Kwok Cheung Yeung Cc: gcc-patches , ams@codesourcery.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Tue, Feb 28, 2023 at 3:02=E2=80=AFPM Kwok Cheung Yeung wrote: > > Hello > > This patch implements the TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION > target hook for the AMD GCN architecture, such that when vectorized, > calls to builtin standard math functions such as asinf, exp, pow etc. > are converted to calls to the recently added vectorized math functions > for GCN in Newlib. The -fno-math-errno flag is required in addition to > the usual vectorization optimization flags for this to occur, and some > of the math functions (the larger double-precision ones) require a large > stack size to function properly. > > This patch requires the GCN vector math functions in Newlib to function > - these were included in the recent 4.3.0.20230120 snapshot. As this was > a minimum requirement starting from the patch 'amdgcn, libgomp: Manually > allocated stacks', this should not be a problem. > > I have added new testcases in the testsuite that compare the output of > the vectorized math functions against the scalar, passing if they are > sufficiently close. With the testcase for standalone GCN (without > libgomp) in gcc.target/gcn/, there is a problem since gcn-run currently > cannot set the stack size correctly in DejaGnu testing, so I have made > it a compile test for now - it is still useful to check that calls to > the correct functions are being made. The runtime correctness is still > covered by the libgomp test. I thought we were moving towards using the simd attribute instead and moving away from these kind of patches. Though since gcn is a special target that including math.h normally does not happen for offloading this might be still usefull. > > Okay for trunk? We are in stage 4 of GCC 13 release cycle, I suspect we want to wait until GCC 13 branches off to apply this. Thanks, Andrew Pinski > > Thanks > > Kwok