Bug 101028 - [12 Regression] SLP compile-time hog since r12-1329-gce670e4faafb296d
Summary: [12 Regression] SLP compile-time hog since r12-1329-gce670e4faafb296d
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 12.0
: P1 normal
Target Milestone: 12.0
Assignee: Not yet assigned to anyone
URL:
Keywords: compile-time-hog
Depends on:
Blocks: spec
  Show dependency treegraph
 
Reported: 2021-06-11 10:54 UTC by Martin Liška
Modified: 2021-12-10 09:37 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-06-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2021-06-11 10:54:25 UTC
The following is causing hog (reduced from imagick SPEC benchmark):

$ cat 1.i
void ConvertImageCommand();
void MagickCommandGenesis();
void MogrifyImages();
void TracePath();

typedef struct {
  double x, y;
} PointInfo;

typedef struct {
  PointInfo point;
} PrimitiveInfo;

int TraceBezier_alpha, TraceBezier_i;
double TraceBezier_weight;
PointInfo *TraceBezier_points;
PrimitiveInfo *TraceBezier_primitive_info;
void DrawImage() { TracePath(); }

void TracePath() {
  double *coefficients;
  PointInfo point;
  long j;
  for (; TraceBezier_i; TraceBezier_i++) {
    point.x = point.y = TraceBezier_alpha = 1.0;
    j = 0;
    for (; j < 4; j++) {
      point.x += TraceBezier_alpha * coefficients[j] *
                 TraceBezier_primitive_info->point.x;
      point.y += TraceBezier_alpha * TraceBezier_primitive_info->point.y;
      TraceBezier_alpha *= TraceBezier_weight;
      TraceBezier_primitive_info++;
    }
    TraceBezier_points[TraceBezier_i] = point;
    TraceBezier_weight += 1.0;
  }
}

void ConvertMain() { MagickCommandGenesis(ConvertImageCommand); }
void ConvertImageCommand() { MogrifyImages(); }
void MogrifyImages() { DrawImage(); }

int main() { return ConvertMain; }

$ gcc 1.i -flto=auto -Ofast  -shared -fPIC
...

likely never finishes :)
Comment 1 GCC Commits 2021-06-11 12:31:05 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:b9ec5ebb605936684e95b8dcc12e43ba7d8f2cb4

commit r12-1388-gb9ec5ebb605936684e95b8dcc12e43ba7d8f2cb4
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jun 11 13:36:26 2021 +0200

    tree-optimization/101028 - fix endless SLP reassoc discovery
    
    This fixes a missing clearing of mismatched lanes from the
    fatal fail path in SLP reassoc discovery in the most conservative
    way.
    
    2021-06-11  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/101028
            * tree-vect-slp.c (vect_build_slp_tree_2): When SLP
            reassoc discovery fails fatally, mark appropriate lanes
            in matches[] so.
    
            * gcc.dg/pr101028.c: New testcase.
Comment 2 Richard Biener 2021-06-11 12:33:41 UTC
Fixed.
Comment 3 Tamar Christina 2021-06-21 08:50:42 UTC
This seems to have caused a compile time hog in SPECCPU 2006's 416.gamess as well which is not fixed by the subsequent commit.

I'm attempting to reduce but it's taking a while since each test takes around 8 mins..

Compiling with

-mcpu=native -Ofast -fomit-frame-pointer -flto=auto --param ipa-cp-eval-threshold=1 --param ipa-cp-unit-growth=80 -funconstrained-commons -std=legacy -fno-inline-functions-called-once

and compile never finishes (have yet to reduce flags)