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

            Bug ID: 126544
           Summary: Quadraticness in SLP vectorisation
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: compile-time-hog
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

This needs a Python script to generate the offending form:
#!/usr/bin/env python3
"""Emit the basic block that makes BB SLP quadratic.

  python3 04-slp-quadratic.py 3200 > t.c
  gcc -O1 -ftree-slp-vectorize -fvect-cost-model=unlimited \
      -march=armv8.2-a+sve -ftime-report -S -o /dev/null t.c

At n = 3200 the "tree slp vectorization" line reads 16.73 s and 1261 MB.
Doubling n multiplies both by four.  Inserting an
__asm__ volatile ("" ::: "memory") every 64 stores splits the SLP region and
makes both perfectly linear, which is what identifies the region length as
the quadratic term.
"""
import sys

n = int(sys.argv[1]) if len(sys.argv) > 1 else 3200
print("int a[%d], b[%d], c[%d];" % (n + 8, n + 8, n + 8))
print("void f (void) {")
for i in range(n):
    print("  a[%d] = b[%d] * c[%d] + %d;" % (i, i, i, i))
print("}")

Doing this on an aarch64 machine gives this line in -ftime-report:
tree slp vectorization             :  14.57 ( 66%)   0.09 ( 47%)  14.66 ( 65%) 
1883M ( 95%)

Reply via email to