[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 Richard Sandiford changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #14 from Richard Sandiford --- Finally fixed.
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #13 from GCC Commits --- The trunk branch has been updated by Richard Sandiford : https://gcc.gnu.org/g:0394ae31e832c5303f3b4aad9c66710a30c097f0 commit r14-9165-g0394ae31e832c5303f3b4aad9c66710a30c097f0 Author: Richard Sandiford Date: Sat Feb 24 11:58:22 2024 + vect: Tighten check for impossible SLP layouts [PR113205] During its forward pass, the SLP layout code tries to calculate the cost of a layout change on an incoming edge. This is taken as the minimum of two costs: one in which the source partition keeps its current layout (chosen earlier during the pass) and one in which the source partition switches to the new layout. The latter can sometimes be arranged by the backward pass. If only one of the costs is valid, the other cost was ignored. But the PR shows that this is not safe. If the source partition has layout 0 (the normal layout), we have to be prepared to handle the case in which that ends up being the only valid layout. Other code already accounts for this restriction, e.g. see the code starting with: /* Reject the layout if it would make layout 0 impossible for later partitions. This amounts to testing that the target supports reversing the layout change on edges to later partitions. gcc/ PR tree-optimization/113205 * tree-vect-slp.cc (vect_optimize_slp_pass::forward_cost): Reject the proposed layout if it does not allow a source partition with layout 2 to keep that layout. gcc/testsuite/ PR tree-optimization/113205 * gcc.dg/torture/pr113205.c: New test.
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #12 from Richard Sandiford --- Created attachment 57511 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57511=edit Candidate patch Sorry for the very slow response on this. I'm testing the attached.
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 Richard Sandiford changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |rsandifo at gcc dot gnu.org Status|NEW |ASSIGNED
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #11 from Jakub Jelinek --- Richard S., any comments on this?
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #10 from Richard Biener --- Btw, I was hoping Richard would chime in here ...
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #9 from Sérgio Basto --- Thank you it worked , MLT was built successfully on Fedora Rawhide
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #7 from Jakub Jelinek --- -fno-tree-slp-vectorize, either on the command line for the affected compilation unit or __attribute__((optimize ("no-tree-slp-vectorize"))) on the problematic routine. --- Comment #8 from Andrew Pinski --- (In reply to Sérgio Basto from comment #6) > and any workaround to build mlt on x86_64 ,exist ? > > I tried disable lto, hardening and also disable strict symbols (-Wl,-z,defs > ) and still not build neither in koji nor in my machine `-fno-tree-slp-vectorize` should work around it ... but that only works around the issue on the trunk which will be fixed by the time release happens.
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #7 from Jakub Jelinek --- -fno-tree-slp-vectorize, either on the command line for the affected compilation unit or __attribute__((optimize ("no-tree-slp-vectorize"))) on the problematic routine.
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 --- Comment #6 from Sérgio Basto --- and any workaround to build mlt on x86_64 ,exist ? I tried disable lto, hardening and also disable strict symbols (-Wl,-z,defs ) and still not build neither in koji nor in my machine
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 Sérgio Basto changed: What|Removed |Added CC||sergio at serjux dot com --- Comment #5 from Sérgio Basto --- (In reply to Matthias Klose from comment #0) > seen with trunk 20240101 on x86_64-linux-gnu, building the mlt package. It > claims to be not reproducible, but always fails to build. I notice that mlt just fail to build on x86_64 https://koji.fedoraproject.org/koji/taskinfo?taskID=112893731 HTH
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 Richard Biener changed: What|Removed |Added CC||rguenth at gcc dot gnu.org, ||rsandifo at gcc dot gnu.org See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=110935 --- Comment #4 from Richard Biener --- OK, so this should already reproduce before the change when removing the invariant add (p + 8000). The issue seems to be that SLP build ends up with an unsupported load permutation when we try with V2SImode vectorization after V4SImode is scrapped because of cost issues. We have t.c:18:10: note: node 0x6471a48 (max_nunits=2, refcnt=2) vector(2) int t.c:18:10: note: op template: _3 = MEM[(int *)i.0_1 + 4B]; t.c:18:10: note:stmt 0 _3 = MEM[(int *)i.0_1 + 4B]; t.c:18:10: note:stmt 1 _5 = MEM[(int *)i.0_1 + 12B]; t.c:18:10: note:stmt 2 _4 = MEM[(int *)i.0_1 + 8B]; t.c:18:10: note:stmt 3 _2 = *i.0_1; t.c:18:10: note:load permutation { 1 3 2 0 } I'm not sure whether that's a supported situation. Changing the code to be more graceful like diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index b6cce55ce90..a12214bc1ad 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -5343,8 +5343,8 @@ vect_optimize_slp_pass::backward_pass () } } - gcc_assert (min_layout_cost.is_possible ()); - partition.layout = min_layout_i; + if (min_layout_cost.is_possible ()) + partition.layout = min_layout_i; } } then yields t.c:18:10: note: SLP optimize permutations: t.c:18:10: note:1: { 1, 3, 2, 0 } t.c:18:10: note: SLP optimize partitions: t.c:18:10: note:- t.c:18:10: note:partition 0 (layout 0): t.c:18:10: note: nodes: t.c:18:10: note:- 0x5f0d9b0: t.c:18:10: note:weight: 1.00 t.c:18:10: note:out weight: 1.00 (degree 1) t.c:18:10: note:op template: _20 = (int) _19; t.c:18:10: note: edges: t.c:18:10: note:- 0x5f0d9b0 --> [2] 0x5f0d928 t.c:18:10: note: layout 0: rejected t.c:18:10: note: layout 1: rejected t.c:18:10: note:- t.c:18:10: note:partition 1 (layout 1): t.c:18:10: note: nodes: t.c:18:10: note:- 0x5f0da38: t.c:18:10: note:weight: 1.00 t.c:18:10: note:out weight: 1.00 (degree 1) t.c:18:10: note:op template: _3 = MEM[(int *)i.0_1 + 4B]; t.c:18:10: note: edges: t.c:18:10: note:- 0x5f0da38 --> [2] 0x5f0d928 t.c:18:10: note: layout 0: rejected t.c:18:10: note: layout 1: rejected t.c:18:10: note:- t.c:18:10: note:partition 2 (layout 1): t.c:18:10: note: nodes: t.c:18:10: note:- 0x5f0d928: t.c:18:10: note:weight: 1.00 t.c:18:10: note:out weight: 1.00 (degree 1) t.c:18:10: note:op template: _21 = _3 * _20; t.c:18:10: note: edges: t.c:18:10: note:- 0x5f0d928 --> [3] 0x5f0d8a0 t.c:18:10: note:- 0x5f0d9b0 [0] --> 0x5f0d928 t.c:18:10: note:- 0x5f0da38 [1] --> 0x5f0d928 t.c:18:10: note: layout 0: rejected t.c:18:10: note: layout 1: rejected t.c:18:10: note:- t.c:18:10: note:partition 3 (layout 1): t.c:18:10: note: nodes: t.c:18:10: note:- 0x5f0d8a0: t.c:18:10: note:weight: 1.00 t.c:18:10: note:op template: _22 = (unsigned int) _21; t.c:18:10: note: edges: t.c:18:10: note:- 0x5f0d928 [2] --> 0x5f0d8a0 t.c:18:10: note: layout 0: t.c:18:10: note: {depth: 1.00, total: 1.00} t.c:18:10: note:+ {depth: 0.00, total: 0.00} t.c:18:10: note:+ {depth: 0.00, total: 0.00} t.c:18:10: note:= {depth: 1.00, total: 1.00} t.c:18:10: note: layout 1: (*) t.c:18:10: note: {depth: 0.00, total: 0.00} t.c:18:10: note:+ {depth: 0.00, total: 0.00} t.c:18:10: note:+ {depth: 0.00, total: 0.00} t.c:18:10: note:= {depth: 0.00, total: 0.00} t.c:18:10: note: inserting permutation node in place of 0x5f0d9b0 t.c:18:10: note: recording new base alignment for i.0_1 ... t.c:18:10: note: vectorizing permutation op0[3] op0[0] op0[2] op0[1] t.c:18:10: note: vectorizing permutation op0[3] op0[0] op0[2] op0[1] t.c:18:10: note: as vops0[1][1] vops0[0][0], vops0[1][0] vops0[0][1] t.c:18:10: missed: unsupported vect permute { 1 2 } t.c:18:10: note: Building vector operands of 0x5f0db48 from scalars instead ... t.c:18:10: note: removing SLP instance operations starting from: _25 = _24 + _40; t.c:18:10: missed: not vectorized: bad operation in basic block. t.c:18:10: note: *
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 Jakub Jelinek changed: What|Removed |Added Priority|P3 |P1
[Bug middle-end/113205] [14 Regression] internal compiler error: in backward_pass, at tree-vect-slp.cc:5346 since r14-3220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113205 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |NEW Keywords|needs-bisection,| |needs-reduction | Summary|[14 Regression] internal|[14 Regression] internal |compiler error: in |compiler error: in |backward_pass, at |backward_pass, at |tree-vect-slp.cc:5346 |tree-vect-slp.cc:5346 since ||r14-3220 Ever confirmed|0 |1 Last reconfirmed||2024-01-08 --- Comment #3 from Jakub Jelinek --- char a; char *b, *c; int d, e, f, g, h; int *i; void foo (void) { unsigned p; d = i[0]; e = i[1]; f = i[2]; g = i[3]; p = d * b[0]; p += f * c[h]; p += e * b[h]; p += g * c[h]; a = (p + 8000) >> (__SIZEOF_INT__ * __CHAR_BIT__ / 2); } is reduced from mlt, ICEs at -O2 since r14-3220-gf049868d8db773da4be61d82025e97453d6e9f2b.