From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by sourceware.org (Postfix) with ESMTPS id 016153858D28 for ; Tue, 20 Feb 2024 18:19:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 016153858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 016153858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708453193; cv=none; b=OjWbr+d4MZ4jkjHzqOS9IS+VtXhZLKOIiQ53sDKn6du0bwS8qVHWM0aiWr8VlvDuuHUPdP0gnKiM5W2WU3MT82GZVTuN1YcuxcOjz8f8QfJMOReXsVPwkbijbXGLlH/DPUeK4lbZ9lp8vXo+lbTPA5CusYIeFzp/Gae9BAvQPHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708453193; c=relaxed/simple; bh=+/1YvpS9MFXJx9IawT6v2asYpLU9JeuLoTDj1qcTTdg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=F4nu/M79Qxz9rpzuLaw1tFt8iGBq2ZZcFYUP7Yg4p3ux7wTSTMA+dPtzBpLfKoB413U9wcp4cxiXXUk0E3KmIXAZkkcYKaJpycTnpsOsainkxNylyO0K2TSU6xffBX9dwxPg67gnoUoinCGw7G5RZYck/s0gnLEeVarzmNki274= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-59a8ee08c23so2119187eaf.2 for ; Tue, 20 Feb 2024 10:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708453190; x=1709057990; darn=sourceware.org; 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=V7jHq0KpUhvszGYoEytKT9o7YtvMMsswTzCKidQj3W4=; b=MdI54cDLWww12kpUiciaB3HeuRbnZrIarzHQ5S39Hb/Kf+XdktkUPubh3wLWC98ni/ lehcDjssDKGDcCvrDbySuyJP01QIaRhdkvfDzxEK+eIo95PvGQbCYFVagZvt5VBsH+p9 pxe4+vpLcPRTFp34wVaUw2H6m5e9NLsS0aIJqtRGZQemm8HawHP7v2cNRD7D9wUuiKoq sH3x8mEerA3PzEfFi/HYS3hxg/v28nDcWaTyQGmyP7WhplTLjaBP2RoSA8223m2atEdz zHlRC7moDDOyISrReRGHUJELlyu/t6TmMVOs8c/E13ZXSskJUiwfu0/xD33+aOz1bUVq KTrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708453190; x=1709057990; 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=V7jHq0KpUhvszGYoEytKT9o7YtvMMsswTzCKidQj3W4=; b=P1am0x7+qiNvvtIKGMeDoV18bvk96e6iPgjpDAQNAk0mioKkqvVml6rR4N6EbScq6F rum288t+U64chLENhqC9v05xiq7Qjg2Yq/BjSvaxF3+O/oKUkbhMVn5/JTrnS1a95Jgi kFazoi72iNPH3Z7PvberJad+AT7kZo8tvc5l05jpDMRe+w9X/VLeTnirNJh4YDnzohuj WPPVDBEkD+WJkbmT3qw5b06dCul1raZIiwR65//KphQSuEJRSnOFuAzqqnNDmS2pRXrD saB7k8EcFvS5dv/Vc/cXg898pHNdvxfy1GswK3N5j3OB6Ig+ROyI6Drp3EV5rlusuxj3 Dflw== X-Forwarded-Encrypted: i=1; AJvYcCWWsaITyLP6xNiAEK8DfXuDFx//yzVGsL8w9ge/bzJ3Auqql4vuB7F9HOuR8sUcOkwPaL6oGgqmz38OppQH9guzSrJB1SadC+U+ X-Gm-Message-State: AOJu0YwtTi+7Df8M5f9BAEvJEqoTCxJDX64YZpkXvCOuiOAgpC1LoHlX V51OW5hfIYIwm8Low35aOzkVwyEJVcRPAh9Vof+ZZaiAC/e8vyqdA17Dr4sJLBiItIslfWuOZ/A CkDJ2YdHtjbizgFtACH88vWy3pHzReLvY X-Google-Smtp-Source: AGHT+IGFApgKEJuM92z7HNeeMpVDgj9D00rrXypBTXn0a1xXMTNaPu6y7R5Y5EXrlXmw4yDvLFSO410/8E7pEmq80kE= X-Received: by 2002:a05:6870:7818:b0:21f:1679:d6a4 with SMTP id hb24-20020a056870781800b0021f1679d6a4mr2918474oab.30.1708453190427; Tue, 20 Feb 2024 10:19:50 -0800 (PST) MIME-Version: 1.0 References: <20240220165805.3629140-1-skpgkp2@gmail.com> In-Reply-To: From: Noah Goldstein Date: Tue, 20 Feb 2024 18:19:38 +0000 Message-ID: Subject: Re: [PATCH] x86_64: Exclude SSE, AVX and FMA4 variants in libm multiarch To: "H.J. Lu" Cc: Sunil Pandey , libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Tue, Feb 20, 2024 at 6:14=E2=80=AFPM H.J. Lu wrote= : > > On Tue, Feb 20, 2024 at 10:07=E2=80=AFAM Noah Goldstein wrote: > > > > On Tue, Feb 20, 2024 at 6:05=E2=80=AFPM H.J. Lu w= rote: > > > > > > On Tue, Feb 20, 2024 at 9:56=E2=80=AFAM Noah Goldstein wrote: > > > > > > > > On Tue, Feb 20, 2024 at 5:51=E2=80=AFPM Sunil Pandey wrote: > > > > > > > > > > > > > > > > > > > > On Tue, Feb 20, 2024 at 9:34=E2=80=AFAM Noah Goldstein wrote: > > > > >> > > > > >> On Tue, Feb 20, 2024 at 4:58=E2=80=AFPM Sunil K Pandey wrote: > > > > >> > > > > > >> > When glibc is built with FMA and AVX2 enabled by default, the = resulting > > > > >> > glibc binaries won't run on SSE or FMA4 processors. Exclude S= SE, AVX and > > > > >> > FMA4 variants in libm multiarch when both FMA and AVX2 are ena= bled by > > > > >> > default. Disallow glibc build with only AVX2 or FMA enabled a= s all AVX2 > > > > >> > processors, including VMs, should also support FMA and vice ve= rsa. > > > > >> > > > > > >> > When glibc is built with SSE4.1 enabled by default, only keep = SSE4.1 > > > > >> > variant. > > > > >> Not avx2 + FMA as well? > > > > > > > > > > > > > > > Correct. Logic is as follows > > > > > If (build with AVX2+FMA): Keep AVX2+FMA variants only. > > > > > else if (build with SSE4.1): Keep SSE4.1 variants only. > > > > What if someone builds with sse4.1 as a minimum but then > > > > runs on avx2+ machines? > > > > > > Only SSE4.1 variant will be used in this case. Both SSE4.1 > > > and AVX versions only have a single instruction. This matches > > > the compiler builtin function of SS4.1 and AVX. > > > > if they are all the same, whats the rationale for having an > > avx version at all? > > They aren't the same. For ceil, it is > > roundsd $10, %xmm0, %xmm0 > ret > > vs > > vroundsd $10, %xmm0, %xmm0, %xmm0 > ret > > You get the same things with > > return __builtin_ceil (x); I mean if they are equal quality sse4.1 / avx, why not just remove the avx impls are using sse4.1 impls on avx targets? > > > -- > H.J.