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/110742] [14 Regression] cc1plus ICE "Floating point exception" during SLP and profiled bootstrap
Date: Thu, 20 Jul 2023 11:08:09 +0000	[thread overview]
Message-ID: <bug-110742-4-fhXIEV0Ewm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110742-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsandifo at gcc dot gnu.org

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we have those external def nodes for existing vectors in the IL.  Obviously
we cannot change the layout of those - where can we specify that?  I
see is_compatible_layout or change_layout_cost.  But start_choosing_layouts
already assigns layout 0 to it where I thought this would effectively
prevent changes?

Oddly in forward_pass we first have partition.layout == 0 && layout_i == 0
but still do stuff.

$38 = 0x3d8f690 = {{node_begin = 0, node_end = 1, layout = 0, in_degree = 0,
out_degree = 1}, {
    node_begin = 1, node_end = 2, layout = 1, in_degree = 1, out_degree = 0},
{node_begin = 2, 
    node_end = 3, layout = 2, in_degree = 0, out_degree = 0}}

later we ask if changing layout from 0 to 1 is OK.

I suppose the bug is in get_result_with_layout itself which assumes
changing vect_constant_def/vect_external_def is fine and thus pushes
the edge permute to the node?

I wonder if I fix that say with the following, if I also need to adjust
costs somewhere?

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 693621ca990..1d79c77e8ce 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -5198,7 +5198,10 @@ vect_optimize_slp_pass::get_result_with_layout (slp_tree
node,
     return result;

   if (SLP_TREE_DEF_TYPE (node) == vect_constant_def
-      || SLP_TREE_DEF_TYPE (node) == vect_external_def)
+      || (SLP_TREE_DEF_TYPE (node) == vect_external_def
+         && (to_layout_i == 0
+             /* We can't permute vector defs.  */
+             || SLP_TREE_VEC_DEFS (node).is_empty ())))
     {
       /* If the vector is uniform or unchanged, there's nothing to do.  */
       if (to_layout_i == 0 || vect_slp_tree_uniform_p (node))

I'll also note that we do

          /* Handle externals and constants optimistically throughout.
             But treat existing vectors as fixed since we do not handle
             permuting them.  */
          unsigned int node_i = m_partitioned_nodes[rpo_i];
          auto &vertex = m_vertices[node_i];
          if ((SLP_TREE_DEF_TYPE (vertex.node) == vect_external_def
               && !SLP_TREE_VEC_DEFS (vertex.node).exists ())
              || SLP_TREE_DEF_TYPE (vertex.node) == vect_constant_def)
            vertex.partition = -1;

in create_partitions ().

I'm testing the above change now.

  parent reply	other threads:[~2023-07-20 11:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 15:47 [Bug c++/110742] New: [14 Regression] cc1plus ICE "Floating point exception" during profiled bootstrap since commit 08b99fe8ad6 thiago.bauermann at linaro dot org
2023-07-19 15:50 ` [Bug c++/110742] " thiago.bauermann at linaro dot org
2023-07-19 16:09 ` [Bug rtl-optimization/110742] [14 Regression] cc1plus ICE "Floating point exception" during profiled bootstrap since commit g:08b99fe8ad6 pinskia at gcc dot gnu.org
2023-07-19 16:13 ` [Bug tree-optimization/110742] " pinskia at gcc dot gnu.org
2023-07-19 17:07 ` pinskia at gcc dot gnu.org
2023-07-19 17:12 ` pinskia at gcc dot gnu.org
2023-07-19 18:50 ` pinskia at gcc dot gnu.org
2023-07-19 18:51 ` pinskia at gcc dot gnu.org
2023-07-19 18:53 ` [Bug tree-optimization/110742] [14 Regression] cc1plus ICE "Floating point exception" during SLP and profiled bootstrap pinskia at gcc dot gnu.org
2023-07-19 18:55 ` pinskia at gcc dot gnu.org
2023-07-19 19:02 ` pinskia at gcc dot gnu.org
2023-07-19 21:19 ` thiago.bauermann at linaro dot org
2023-07-20 10:35 ` rguenth at gcc dot gnu.org
2023-07-20 11:08 ` rguenth at gcc dot gnu.org [this message]
2023-07-21  7:29 ` cvs-commit at gcc dot gnu.org
2023-07-21  7:29 ` rguenth at gcc dot gnu.org
2023-07-21 21:35 ` thiago.bauermann at linaro dot 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-110742-4-fhXIEV0Ewm@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).