From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 4880738582A5 for ; Thu, 8 Feb 2024 14:49:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4880738582A5 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4880738582A5 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707403759; cv=none; b=HjyGT6qk3PG79fkb6Y9QwgNHKCCcX3OnafYFJFSKwiW15HtiFym0m6lLO0NGnu/PuJMYPRWoueq/M8d2WbK2TGFTDMPGHoJBrG9fRClbaZzSWSSinHu03Ew1UDTYOjfURv/uMiVWUe0CXRvu4oED2VVMBEgG0uYFOtzXEoownqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707403759; c=relaxed/simple; bh=MEqNKBYnnRmTzI3vVOfm1y4A5DtBKbjbfIczlTqoXcY=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=wCpe+O8CzceQrlIFG7pUKOdJ3PWUKVp3qgdZG17WMX/xrb12ayzsuojmGDV+SG4cyWsS1vkEw+wm+NSZ7hbdhtfVKVSViGUtTHzanTcV63BlYXE1iLV8Q2hKu1d1Qmzwup6d8PKhOrEknR3BL4dG8NXUG43L70EX69iDeiB+MTY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.4.150] (unknown [10.168.4.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1107722130; Thu, 8 Feb 2024 14:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707403756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EiLnf+SMkH+WF4RUrG7uR+V4zCJh2+Ftgl8v+YPqtuM=; b=qjs/hTiKKMA6vMY7VqOwu7SDjxafYp8IW8P9jA0ZT13CWoeVdHC8SGo8d2plg3h0fRLz8n Qu+loqK7aJGV9IADoAH7SisTqFFsdBgsG048V5NQRsWgCFuqLKp9BvPlx0najEy8oSfeza mqlu3QxwkneYpNveqb3NyN0lF7VlPrU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707403756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EiLnf+SMkH+WF4RUrG7uR+V4zCJh2+Ftgl8v+YPqtuM=; b=O7yj3MuVc4hJINm0MPQJ0BeNH4TjAhPgvseGB317mSgiEVHMu6mV/6rI9CpO3eSw5laHJG PcnkExGsNMBczjBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707403756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EiLnf+SMkH+WF4RUrG7uR+V4zCJh2+Ftgl8v+YPqtuM=; b=qjs/hTiKKMA6vMY7VqOwu7SDjxafYp8IW8P9jA0ZT13CWoeVdHC8SGo8d2plg3h0fRLz8n Qu+loqK7aJGV9IADoAH7SisTqFFsdBgsG048V5NQRsWgCFuqLKp9BvPlx0najEy8oSfeza mqlu3QxwkneYpNveqb3NyN0lF7VlPrU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707403756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EiLnf+SMkH+WF4RUrG7uR+V4zCJh2+Ftgl8v+YPqtuM=; b=O7yj3MuVc4hJINm0MPQJ0BeNH4TjAhPgvseGB317mSgiEVHMu6mV/6rI9CpO3eSw5laHJG PcnkExGsNMBczjBw== Date: Thu, 8 Feb 2024 15:49:15 +0100 (CET) From: Richard Biener To: Tamar Christina cc: "gcc-patches@gcc.gnu.org" , nd , "jlaw@ventanamicro.com" Subject: RE: [PATCH]middle-end: add two debug counters for early-break vectorization debugging In-Reply-To: Message-ID: <19034q2n-93o9-q330-75pp-63985n19s8p9@fhfr.qr> References: <97679482-3qr1-o849-8863-2368oq337s5r@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-3.10 / 50.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,gnu.org:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%] X-Spam-Level: X-Spam-Score: -3.10 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 Thu, 8 Feb 2024, Tamar Christina wrote: > > -----Original Message----- > > From: Richard Biener > > Sent: Thursday, February 8, 2024 2:16 PM > > To: Tamar Christina > > Cc: gcc-patches@gcc.gnu.org; nd ; jlaw@ventanamicro.com > > Subject: Re: [PATCH]middle-end: add two debug counters for early-break > > vectorization debugging > > > > On Thu, 8 Feb 2024, Tamar Christina wrote: > > > > > Hi All, > > > > > > This adds two new debug counter to aid in debugging early break code. > > > > > > - vect_force_last_exit: when reached will always force the final loop exit. > > > - vect_skip_exit: when reached will skip selecting the current candidate exit > > > as the loop exit. > > > > > > The first counter essentially allows you to turn off the PEELED case and the > > > second counter to pick a different exit, which may mean you pick no exit at > > > all. > > > > > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. > > > > > > Ok for master? > > > > > > Thanks, > > > Tamar > > > > > > gcc/ChangeLog: > > > > > > * dbgcnt.def (vect_force_last_exit, vect_skip_exit): New. > > > * tree-vect-loop.cc (vec_init_loop_exit_info): Use them. > > > > > > --- inline copy of patch -- > > > diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def > > > index > > ed9f062eac2c28c52df76b39d4312dd9fde1c800..8f7bebf93fceabdf6ae86c2df5 > > 91eae4848b8a5c 100644 > > > --- a/gcc/dbgcnt.def > > > +++ b/gcc/dbgcnt.def > > > @@ -213,5 +213,7 @@ DEBUG_COUNTER (stv_conversion) > > > DEBUG_COUNTER (tail_call) > > > DEBUG_COUNTER (tree_sra) > > > DEBUG_COUNTER (treepre_insert) > > > +DEBUG_COUNTER (vect_force_last_exit) > > > DEBUG_COUNTER (vect_loop) > > > +DEBUG_COUNTER (vect_skip_exit) > > > DEBUG_COUNTER (vect_slp) > > > diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc > > > index > > eed2268e9bae7e7ad36d13da03e0b54eab26ef6f..854e9d78bc71721e6559a6bc > > 5dff78c813603a78 100644 > > > --- a/gcc/tree-vect-loop.cc > > > +++ b/gcc/tree-vect-loop.cc > > > @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see > > > #include "tree-eh.h" > > > #include "case-cfn-macros.h" > > > #include "langhooks.h" > > > +#include "dbgcnt.h" > > > > > > /* Loop Vectorization Pass. > > > > > > @@ -977,6 +978,20 @@ vec_init_loop_exit_info (class loop *loop) > > > if (exits.length () == 1) > > > return exits[0]; > > > > > > + /* Check to see if we've been asked to force the last exit. */ > > > + if (!dbg_cnt (vect_force_last_exit)) > > > + { > > > + basic_block bb = ip_normal_pos (loop); > > > + if (!bb) > > > + return NULL; > > > + > > > + edge exit = EDGE_SUCC (bb, 0); > > > + if (exit->dest == loop->latch) > > > + return EDGE_SUCC (bb, 1); > > > + > > > + return exit; > > > > Err, that's quite odd. Why not just below do > > > > > + } > > > + > > > /* If we have multiple exits we only support counting IV at the moment. > > > Analyze all exits and return the last one we can analyze. */ > > > class tree_niter_desc niter_desc; > > > @@ -998,6 +1013,7 @@ vec_init_loop_exit_info (class loop *loop) > > > && exit->src == single_pred (loop->latch) > > > && (integer_nonzerop (may_be_zero) > > > || COMPARISON_CLASS_P (may_be_zero)))) > > > + && dbg_cnt (vect_skip_exit) > > > > && (dbg_cnt (vect_force_last_exit) > > || exit->src == single_pred (loop->latch)) > > > > (also computed above already)? It's also oddly named, it's more like > > vect_allow_peeled_exit or so. > > Because this isn't deterministic. If a loop has n exits the above always forces > you to pick the final one regardless of n, rather than just skip consideration of an exit. Well, you can always do (before the loop) bool force_last_exit = dbg_cnt (vect_force_last_exit); to evaluate it only once. I think for debug counters we should avoid introducing more lines of code when possible (the above big odd blob). > And in that case is there a point in analyzing all the exits just to throw away the information? > > Doing in inside the consideration check would only skip one exit unless I'm misunderstanding. > > > > > It's also seemingly redundant with vect_skip_exit, no? > > > > Note the counter gets incremented even if we'd not consider the exit > > because we have a later candidate already. > > > > I fear it's going to be quite random even with the debug counter. > > It is, I think the first counter is more useful. But in general the reason I kept the second counter > which kinda does what was suggested in the RFC I sent before was that it should in theory at > least allow us to test forcing of a PEELED case. Since we generally prefer the non-PEELED case > if possible. > > At least that was the intention. For the PEELED case I wondered if a --param vect-allow-early-exit-peeled defaulted to 1 would make more sense. Of course it doesn't do this per loop. > Thanks, > Tamar > > > > > Can you see whether it really helps you? > > > > > && (!candidate > > > || dominated_by_p (CDI_DOMINATORS, exit->src, > > > candidate->src))) > > > > > > > > > > > > > > > > > > > -- > > Richard Biener > > SUSE Software Solutions Germany GmbH, > > Frankenstrasse 146, 90461 Nuernberg, Germany; > > GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg) > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)