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

            Bug ID: 122841
           Summary: Should get rid of max_nunits in SLP vectorization
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

max_units as given tracks the maximum number of vector elements (possibly!)
used in the SLP subgraph rooted at 'node'.

In the end this is used to calculate the unroll factor for loop vectorization
in vect_update_slp_vf_for_node, but there TYPE_VECTOR_SUBPARTS of the SLP
nodes vectype should be used.  Some, for example vectorizable_conversion, do
not appropriately manage their invariant/external node vector type and thus
we need "pessimistic" guesstimate, tracked in max_nunits, to avoid ICEing,
not knowing what actual vector type the vectorizable_* routines will enforce.

The other current use is two dead

       if (maybe_ne (unrolling_factor, 1U)
          && is_a <bb_vec_info> (vinfo))
        {
...

checks during BB SLP build.  Globally computing sth like an unroll factor
based on the SLP graph entry number of SLP lanes is broken as it doesn't
allow for an SLP graph that combines lanes in-line like a lane-reducing
SAD.

Any such consideration needs to be performed on a per-node base, like the
other existing check in vect_record_max_nunits does.

Reply via email to