From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 821513858D33 for ; Wed, 1 Mar 2023 08:18:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 821513858D33 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-lj1-x236.google.com with SMTP id j17so13047084ljq.11 for ; Wed, 01 Mar 2023 00:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677658713; 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=fw8uMcGeTFtVXDPzWPCYQpm2sayCCFfRrItjON+PJNk=; b=HUH9ixWcZtIV0cUWwmKt1pbwisIQQiQb5lGcLiN378B5+/LnysNFOKSQUEKQcGXgTK TjBgqxXxSHoClIEte3X49QZ0YoPS2+XD0Mb53P5ddGiDGuondI6A+FMBBRpc0/p+d4YF XjHLs6rh7VgREVdFx69swP3Ac8JprRfTkSeHeKFxACmfA4/SujrkABVZnM0XhnYfsvS7 ibPBA6TlmDZJGd+O3CPt5WzeJaodFikCssbdgPynLtACPq6pZhuzJPvGIN5r0nykib0q 9mfkCLupDTyELlJsRxF6LxULdrRnzHYKksNEvZ1kWGQvhrBVgH0aq3BOvwoDSAGvoGCt gt7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677658713; 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=fw8uMcGeTFtVXDPzWPCYQpm2sayCCFfRrItjON+PJNk=; b=pNz7oH/ApL5cDhYz0JqbqKL1GMbU5JzR2Mj2fLkmYvcThcT7Li+KIvkxUjpl2a60GG eoLyfDj3WbCn7OnRLdRQZ196unhfqx31kOd+DVfgWP7r46Igwb3VB08nT+YYF+LRioOU fFyq4VdfLYNIV1jUdPh+MP+/FW6FYOQqpAB1gwgDpM71eIhKTBwGjrIfVwYWaHTy8X7F OO1ENndk5KeejvPAaX/IKI05rUZdaNn69tROE2lnPHz7jERbUkNaVIVjR3Xk44GHj1to sn/NVae7fejHLuHM1vY3GqM4gP2/DCXbfoY9PvfvekFX5JqwOzVXwzSgw0If6EgS3xV4 6Lcg== X-Gm-Message-State: AO0yUKUO6YpBgH/WBzjtToF/XK9k9up/e2wrMInFXhHwnRaw4tf1G0nl V+NBafxYQalAhWCIZnLS0QRrJ2QV9Y3z/aQKDgo= X-Google-Smtp-Source: AK7set9f47FvNPF2hpvS+3RZ2KrLWpi+YgN4a/dzp/rZOEH45pwT5Fxd2Qftb1OY9im4uGOHTQWLq264gg7E2KqlQK0= X-Received: by 2002:a05:651c:1614:b0:293:27a9:ef34 with SMTP id f20-20020a05651c161400b0029327a9ef34mr6637323ljq.0.1677658712687; Wed, 01 Mar 2023 00:18:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Wed, 1 Mar 2023 09:18:18 +0100 Message-ID: Subject: Re: [PATCH] amdgcn: Enable SIMD vectorization of math functions To: Andrew Pinski Cc: Kwok Cheung Yeung , 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 Wed, Mar 1, 2023 at 12:07 AM Andrew Pinski via Gcc-patches wrote: > > 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 larg= e > > 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 wa= s > > a minimum requirement starting from the patch 'amdgcn, libgomp: Manuall= y > > 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. Yes, this particular target hook is considered legacy. See how for example glibc provides a math-vector-fortran.h file announcing them to the fortran compiler in case you were wondering how to target non-C family frontends. Richard. > > > > > 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