From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 91F7A3848020 for ; Wed, 9 Jun 2021 20:13:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 91F7A3848020 Received: by mail-pl1-x62d.google.com with SMTP id e1so13259182pld.13 for ; Wed, 09 Jun 2021 13:13:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=co8WMKXATCuW76NDPVmAsxas6tX7Ao1yhEbD8+51VEg=; b=BTnvXK25jMo+dqAaOZFW//aWCcPitd1CHHxfxMl5X7oP0iigi64ogrNWkvd/cJFAp7 YFnNcfNXfz/oMBaC9mLk9sIHhL1HLpnnNm6FZ0tgWHZ9uTYLDTetHpnJRD/MvPxPk/Y8 aHDEvC00WoEUBLp+dDytkm5pEc3LK5cvvnQ/0U5MBfZ1D8yJlS5m6PvNlIU8ymMWs4CM SHLOpMyMSHEVjLQEnoBKn/uMV+3N+3T9I/Ffw9pujk4AsBZ/YfHILAb0DZxr2nv7T7dW 3FY6Ieup0WJJwVhH9/Y3kzzk2AJFrAY2jySJCi/U1nMvn85wkFODh8YL1HYJbhC9Hu/g jdwA== X-Gm-Message-State: AOAM531M7IyBydELoQRJJ4Wtvse6hvjDxZbLeNlJm6Zz6zILyX62wjKK 20rly22Pa8IWXnFPnjQ/xP79Gfhus0RTNeAaRJPz0g== X-Google-Smtp-Source: ABdhPJwX3XCGyg+Y7wztaGy2k7b04ugUueC6WlrjiA5tHvO4+upw75Wy8BfWzew/lDV74BFwu+m7tGT7JwbdgNXye+Q= X-Received: by 2002:a17:90a:6289:: with SMTP id d9mr1339787pjj.84.1623269633399; Wed, 09 Jun 2021 13:13:53 -0700 (PDT) MIME-Version: 1.0 References: <20210609165451.kfbmrzepg7ei3nyr@arm.com> In-Reply-To: <20210609165451.kfbmrzepg7ei3nyr@arm.com> From: Christophe Lyon Date: Wed, 9 Jun 2021 22:13:41 +0200 Message-ID: Subject: Re: [PATCH] tree-optimization/97832 - handle associatable chains in SLP discovery To: Alex Coplan Cc: Richard Biener , Richard Sandiford , Richard Biener , GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 20:13:56 -0000 On Wed, 9 Jun 2021 at 18:56, Alex Coplan via Gcc-patches wrote: > > Hi Richi, > > On 09/06/2021 14:42, Richard Biener via Gcc-patches wrote: > > On Mon, May 31, 2021 at 5:00 PM Richard Biener wrote: > > > > > > This makes SLP discovery handle associatable (including mixed > > > plus/minus) chains better by swapping operands across the whole > > > chain. To work this adds caching of the 'matches' lanes for > > > failed SLP discovery attempts, thereby fixing a failed SLP > > > discovery for the slp-pr98855.cc testcase which results in > > > building an operand from scalars as expected. Unfortunately > > > this makes us trip over the cost threshold so I'm XFAILing the > > > testcase for now. > > > > > > For BB vectorization all this doesn't work because we have no way > > > to distinguish good from bad associations as we eventually build > > > operands from scalars and thus not fail in the classical sense. > > > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll re-do > > > last years SPEC tests as well. Now that it is stage1 I'm considering > > > to push this if there are no further comments given I plan to > > > re-use some of the machinery for vectorization of BB reductions. > > > > Now finally pushed as ce670e4faafb296d1f1a7828d20f8c8ba4686797 > > Looks like this introduces an ICE on aarch64: And on arm too, if that helps reproducing it. > > spawn -ignore SIGHUP /data/ajc/toolchain/builds/rel/gcc/xgcc -B/data/ajc/toolchain/builds/rel/gcc/ /home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.dg/pr86179.c -fdiagnostics-plain-output -O3 -S -o pr86179.s > during GIMPLE pass: vect > /home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.dg/pr86179.c: In function 'c': > /home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.dg/pr86179.c:7:6: internal compiler error: in vect_slp_analyze_node_operations, at tree-vect-slp.c:4444 > 0x1132edb vect_slp_analyze_node_operations > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4442 > 0x1132757 vect_slp_analyze_node_operations > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 > 0x1132757 vect_slp_analyze_node_operations > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 > 0x1132757 vect_slp_analyze_node_operations > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 > 0x1132757 vect_slp_analyze_node_operations > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 > 0x11355cf vect_slp_analyze_operations(vec_info*) > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4592 > 0x110cbe3 vect_analyze_loop_2 > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.c:2396 > 0x110e4af vect_analyze_loop(loop*, vec_info_shared*) > /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.c:2986 > 0x114381b try_vectorize_loop_1 > /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.c:1009 > 0x11442d3 vectorize_loops() > /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.c:1243 > Please submit a full bug report, > with preprocessed source if appropriate. > Please include the complete backtrace with any bug report. > See for instructions. > compiler exited with status 1 > FAIL: gcc.dg/pr86179.c (internal compiler error) > > Alex > > > > > > Richard. > > > > > > 2021-05-31 Richard Biener > > > > > > PR tree-optimization/97832 > > > * tree-vectorizer.h (_slp_tree::failed): New. > > > * tree-vect-slp.c (_slp_tree::_slp_tree): Initialize > > > failed member. > > > (_slp_tree::~_slp_tree): Free failed. > > > (vect_build_slp_tree): Retain failed nodes and record > > > matches in them, copying that back out when running > > > into a cached fail. Dump start and end of discovery. > > > (dt_sort_cmp): New. > > > (vect_build_slp_tree_2): Handle associatable chains > > > together doing more aggressive operand swapping. > > > > > > * gcc.dg/vect/pr97832-1.c: New testcase. > > > * gcc.dg/vect/pr97832-2.c: Likewise. > > > * gcc.dg/vect/pr97832-3.c: Likewise. > > > * g++.dg/vect/slp-pr98855.cc: XFAIL. > > > --- > > > gcc/testsuite/g++.dg/vect/slp-pr98855.cc | 4 +- > > > gcc/testsuite/gcc.dg/vect/pr97832-1.c | 17 + > > > gcc/testsuite/gcc.dg/vect/pr97832-2.c | 29 ++ > > > gcc/testsuite/gcc.dg/vect/pr97832-3.c | 50 +++ > > > gcc/testsuite/gcc.dg/vect/slp-50.c | 20 + > > > gcc/tree-vect-slp.c | 445 ++++++++++++++++++++++- > > > gcc/tree-vectorizer.h | 5 + > > > 7 files changed, 560 insertions(+), 10 deletions(-) > > > create mode 100644 gcc/testsuite/gcc.dg/vect/pr97832-1.c > > > create mode 100644 gcc/testsuite/gcc.dg/vect/pr97832-2.c > > > create mode 100644 gcc/testsuite/gcc.dg/vect/pr97832-3.c > > > create mode 100644 gcc/testsuite/gcc.dg/vect/slp-50.c