public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/107323] [10/11/12 Regression] Loop distribute issue
Date: Fri, 21 Oct 2022 07:07:37 +0000	[thread overview]
Message-ID: <bug-107323-4-j1yPfEtow8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107323-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107323

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 53740
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53740&action=edit
tentative patch

When implementing that I noticed that the set of DRs we use for versioning are
_not_ enough to break the SCC.  Basically I swapped

         /* Run SCC finding algorithm again, with alias dependence edges
            skipped.  This is to topologically sort partitions according to
            compilation time known dependence.  Note the topological order
            is stored in the form of pg's post order number.  */
         num_sccs_no_alias = graphds_scc (pg, NULL, pg_skip_alias_edge);
         gcc_assert (partitions->length () == (unsigned) num_sccs_no_alias);
         /* With topological order, we can construct two subgraphs L and R.
            L contains edge <x, y> where x < y in terms of post order, while
            R contains edge <x, y> where x > y.  Edges for compilation time
            known dependence all fall in R, so we break SCCs by removing all
            (alias) edges of in subgraph L.  */
         for_each_edge (pg, pg_collect_alias_ddrs, &cbdata);

doing pg_collect_alias_ddrs first and clearing all not collected ->alias_ddrs
so we end up only ignoring those edges we version.  For the testcase
at hand the patch then ICEs at the assert

         gcc_assert (partitions->length () == (unsigned) num_sccs_no_alias);

which means that not all SCCs were broken by this.  I think the issue is
that we do

  /* Vertices are topologically sorted according to compilation time
     known dependences, so we can break strong connected components
     by removing edges of the opposite direction, i.e, edges pointing
     from vertice with smaller post number to vertice with bigger post
     number.  */
  if (g->vertices[i].post < g->vertices[j].post

originally we are comparing SCCs of the graph with all edges and the
postorder numbers of the graph with all alias_ddr edges removed (and
thus no SCCs).  That seems unreliable at best.  I notice that with
the proposed change we change that so the postorder numbers are also
for the graph with all edges which means the comment no longer holds.
Maybe it also really tries to check i < j and not the postorder numbers.

I need to look closer.

  parent reply	other threads:[~2022-10-21  7:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 19:42 [Bug tree-optimization/107323] New: Problem with GCC optimizition fatemetmhr at gmail dot com
2022-10-19 19:59 ` [Bug tree-optimization/107323] [10/11/12 Regression] Loop distribute issue pinskia at gcc dot gnu.org
2022-10-20  9:09 ` marxin at gcc dot gnu.org
2022-10-20  9:12 ` marxin at gcc dot gnu.org
2022-10-20  9:21 ` rguenth at gcc dot gnu.org
2022-10-20 11:28 ` rguenth at gcc dot gnu.org
2022-10-20 11:36 ` rguenth at gcc dot gnu.org
2022-10-21  7:07 ` rguenth at gcc dot gnu.org [this message]
2022-10-21  7:35 ` rguenth at gcc dot gnu.org
2022-10-21  9:17 ` cvs-commit at gcc dot gnu.org
2022-10-21  9:19 ` cvs-commit at gcc dot gnu.org
2022-10-21  9:20 ` [Bug tree-optimization/107323] [10/11 " rguenth at gcc dot gnu.org
2023-01-10  8:00 ` rguenth at gcc dot gnu.org
2023-01-24 15:22 ` cvs-commit at gcc dot gnu.org
2023-01-26 13:05 ` [Bug tree-optimization/107323] [10 " cvs-commit at gcc dot gnu.org
2023-01-26 13:06 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107323-4-j1yPfEtow8@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).