From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 54EF8386D625 for ; Thu, 6 Jun 2024 03:01:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 54EF8386D625 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 54EF8386D625 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717642907; cv=none; b=SnxaNdBEDYQEL+Ot9l8pVY2Eedsw9x6zPMFpZ6sZ4zNFriWDWtoLQsA3dXVwV2slIBPoSs8mR3o0R2gX7CHvAJRWV7U876kx9KpAEewSoiJ8vH5iS5RGoAt4X/6LTdAtGTp3t67op8iGmuaU78Ncy37MuWQwZoZ5AS3lNA2pu/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717642907; c=relaxed/simple; bh=HKEpmQV4fx5H1ZpjSPoL7ZfPh+zhWm4k+I8gdZQGLVM=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=rBsqYdHYou9MODhKs6x3tMtlGOEWIiqkcPHi9Zou940QsTCHgKNyWrSu4xs1o2tIlBqM1PcRMj/dB7/puxu3+v2YUJWJH3DeqAOO/KZtqGU5cRs3RFu/zjkrrkHefx6LcScyV43Kvo6tW3D6Y0QZryXlxuSsg0ouBSvr8nhFoJk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1f68834bfdfso4173895ad.3 for ; Wed, 05 Jun 2024 20:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717642904; x=1718247704; darn=gcc.gnu.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=ShyGkv2qeIO6T3MuGq84PNGTcPL/TMN2Q8jmgLvSv+w=; b=L1plOrNtN7A3ogagUbJCp9QV/YA4tdh9EeB+lhFx0bOszAVCoZ4a4vi5astS46zc3N 7QITtu3G0PNlxrETkWo3Rxyk/4AYVowA8Z/h6RkEFusFoDcCNs4dv9p05XKMHI7PYG8A OKpY24gjE5R7KOuYQExGdeULEFTAT0rnVXlq41ZcXztHjFfTXow+zBjb8qPULczIZlsS lfmBNwZoPn4FdMWAHm1HAL6f7M+0fIxPUSTEPzz2978KDvSm9ND7SLsCrfmyY2oiAtZW l8K3PNfjs1FTqnQyLt0nXWZ86tDZ3G5rJUqDQHDLyL9mgnCblmm/jFz+uJIusx+NrZwR 32Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717642904; x=1718247704; 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=ShyGkv2qeIO6T3MuGq84PNGTcPL/TMN2Q8jmgLvSv+w=; b=NojpFCWeVmFCl2iN0z5F4+rsnWYFumlw8aEe6quD0qMvTqiTmPzOpHoa2wmjIJhpeb tPhzKm/x5KTQ5wqxLoIF3+5Et05rMMCXUyNziqx1L/7zqlHGm6sWIKNFK8a1YEMFaayZ Jog6ghPTNp5loSZmQXnVgs84XjLNUnt+7RYMNAafkDBpUqIvr1UOYjUEmZ6u48JhqlUV 26pU1o0hwi7YCtbm65IIFHnzzBPY91uhjEXYIRHvj5xRpdgU9Xfe6/qagwMzM0mqqYz3 zBq3l67DgIOgIVLdgodkxn9YiOTTUbjIV6xytcQa3nMbAxxUyp8cTWoUaaZ90zFmHif6 E1Yw== X-Gm-Message-State: AOJu0YzBsQ1AppmRvbT7uLKgIBI/VjulqHtf1BzdN+hGN3FBrW1jmgEA muzgG+El6SY38drTXksLuAqg0GwCr7FJnC15A5tN6cqEZ30ZB3ZBTJnxUNrpsUuXemZtP/3PWbC ysnKRQqzAls3GsmjxQ91T6T3pmIE= X-Google-Smtp-Source: AGHT+IG5hWLPDzG/sX0tLqNUeCXKYk4RSaVlC7XG+nj/NmLgvSWniiZnbCZlkRf+geypqCxXq2PE6XnZOxwU7kHp1ms= X-Received: by 2002:a17:903:24f:b0:1f6:7346:cf78 with SMTP id d9443c01a7336-1f6a5a86ebcmr49761475ad.65.1717642903975; Wed, 05 Jun 2024 20:01:43 -0700 (PDT) MIME-Version: 1.0 References: <20240528094731.5210D3884507@sourceware.org> In-Reply-To: <20240528094731.5210D3884507@sourceware.org> From: YunQiang Su Date: Thu, 6 Jun 2024 11:01:31 +0800 Message-ID: Subject: Re: [PATCH] tree-optimization/115254 - don't account single-lane SLP against discovery limit To: Richard Biener Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,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: Richard Biener =E4=BA=8E2024=E5=B9=B45=E6=9C=8828=E6=97= =A5=E5=91=A8=E4=BA=8C 17:47=E5=86=99=E9=81=93=EF=BC=9A > > The following avoids accounting single-lane SLP to the discovery > limit. As the two testcases show this makes discovery fail, > unfortunately even not the same across targets. The following > should fix two FAILs for GCN as a side-effect. > > Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. > > PR tree-optimization/115254 > * tree-vect-slp.cc (vect_build_slp_tree): Only account > multi-lane SLP to limit. > > * gcc.dg/vect/slp-cond-2-big-array.c: Expect 4 times SLP. > * gcc.dg/vect/slp-cond-2.c: Likewise. With this patch, MIPS/MSA still has only 3 times SLP. I am digging the problem > --- > .../gcc.dg/vect/slp-cond-2-big-array.c | 2 +- > gcc/testsuite/gcc.dg/vect/slp-cond-2.c | 2 +- > gcc/tree-vect-slp.cc | 31 +++++++++++-------- > 3 files changed, 20 insertions(+), 15 deletions(-) > > diff --git a/gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c b/gcc/tests= uite/gcc.dg/vect/slp-cond-2-big-array.c > index cb7eb94b3a3..9a9f63c0b8d 100644 > --- a/gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c > +++ b/gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c > @@ -128,4 +128,4 @@ main () > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "ve= ct" } } */ > +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "ve= ct" } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/slp-cond-2.c b/gcc/testsuite/gcc.d= g/vect/slp-cond-2.c > index 1dcee46cd95..08bbb3dbec6 100644 > --- a/gcc/testsuite/gcc.dg/vect/slp-cond-2.c > +++ b/gcc/testsuite/gcc.dg/vect/slp-cond-2.c > @@ -128,4 +128,4 @@ main () > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "ve= ct" } } */ > +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "ve= ct" } } */ > diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc > index 0dd9a4daf6a..bbfde8849c1 100644 > --- a/gcc/tree-vect-slp.cc > +++ b/gcc/tree-vect-slp.cc > @@ -1725,21 +1725,26 @@ vect_build_slp_tree (vec_info *vinfo, > SLP_TREE_SCALAR_STMTS (res) =3D stmts; > bst_map->put (stmts.copy (), res); > > - if (*limit =3D=3D 0) > + /* Single-lane SLP doesn't have the chance of run-away, do not account > + it to the limit. */ > + if (stmts.length () > 1) > { > - if (dump_enabled_p ()) > - dump_printf_loc (MSG_NOTE, vect_location, > - "SLP discovery limit exceeded\n"); > - /* Mark the node invalid so we can detect those when still in use > - as backedge destinations. */ > - SLP_TREE_SCALAR_STMTS (res) =3D vNULL; > - SLP_TREE_DEF_TYPE (res) =3D vect_uninitialized_def; > - res->failed =3D XNEWVEC (bool, group_size); > - memset (res->failed, 0, sizeof (bool) * group_size); > - memset (matches, 0, sizeof (bool) * group_size); > - return NULL; > + if (*limit =3D=3D 0) > + { > + if (dump_enabled_p ()) > + dump_printf_loc (MSG_NOTE, vect_location, > + "SLP discovery limit exceeded\n"); > + /* Mark the node invalid so we can detect those when still in u= se > + as backedge destinations. */ > + SLP_TREE_SCALAR_STMTS (res) =3D vNULL; > + SLP_TREE_DEF_TYPE (res) =3D vect_uninitialized_def; > + res->failed =3D XNEWVEC (bool, group_size); > + memset (res->failed, 0, sizeof (bool) * group_size); > + memset (matches, 0, sizeof (bool) * group_size); > + return NULL; > + } > + --*limit; > } > - --*limit; > > if (dump_enabled_p ()) > dump_printf_loc (MSG_NOTE, vect_location, > -- > 2.35.3 --=20 YunQiang Su