Skip to content

[SLP] SLP ignores command line options and creates oversized vectors #147733

Open
@ashermancinelli

Description

@ashermancinelli

The SLP vectorizer is creating vectors that exceed the maximum register size specified by -slp-max-reg-size, the "prefer-vector-width"="N" metadata, and the -force-vector-width=N command line option.

https://godbolt.org/z/KMj67594P

I see a few checks like this in SLPVectorizer.cpp

// Lines 1804-1809
if (MaxVectorRegSizeOption.getNumOccurrences())
  MaxVecRegSize = MaxVectorRegSizeOption;
else
  MaxVecRegSize = 
    TTI->getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector)
        .getFixedValue();

// Line 2072
unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const {
  unsigned MaxVF = MaxVFOption.getNumOccurrences() ?
    MaxVFOption : TTI->getMaximumVF(ElemWidth, Opcode);
  return MaxVF ? MaxVF : UINT_MAX;
}

Is this expected behavior? Is there another way to force slp to use a given max vector width?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions