[mlir][Affine] Add pass options to supervectorizer

The only current options to create a supervectorization pass from an
external dialect is to use `createSuperVectorizePass` with the virtual
vector dimensions as a parameter, but the pass accepts other parameters.

This patch enables external users to create a supervectorizer pass
exposing all available option.

Differential Revision: https://reviews.llvm.org/D134632
This commit is contained in:
Javier Setoain 2022-09-26 10:14:01 +01:00
parent eb1eb7a144
commit 8199a43a89
3 changed files with 2 additions and 30 deletions

View File

@ -106,13 +106,6 @@ createLoopUnrollAndJamPass(int unrollJamFactor = -1);
/// memory hierarchy.
std::unique_ptr<OperationPass<func::FuncOp>> createPipelineDataTransferPass();
/// Creates a pass to vectorize loops, operations and data types using a
/// target-independent, n-D super-vector abstraction.
std::unique_ptr<OperationPass<func::FuncOp>>
createSuperVectorizePass(ArrayRef<int64_t> virtualVectorSize);
/// Overload relying on pass options for initialization.
std::unique_ptr<OperationPass<func::FuncOp>> createSuperVectorizePass();
/// Populate patterns that expand affine index operations into more fundamental
/// operations (not necessarily restricted to Affine dialect).
void populateAffineExpandIndexOpsPatterns(RewritePatternSet &patterns);

View File

@ -344,7 +344,6 @@ def AffineScalarReplacement : Pass<"affine-scalrep", "func::FuncOp"> {
def AffineVectorize : Pass<"affine-super-vectorize", "func::FuncOp"> {
let summary = "Vectorize to a target independent n-D vector abstraction";
let constructor = "mlir::createSuperVectorizePass()";
let dependentDialects = ["vector::VectorDialect"];
let options = [
ListOption<"vectorSizes", "virtual-vector-size", "int64_t",

View File

@ -616,17 +616,13 @@ namespace {
/// Base state for the vectorize pass.
/// Command line arguments are preempted by non-empty pass arguments.
struct Vectorize : public impl::AffineVectorizeBase<Vectorize> {
Vectorize() = default;
Vectorize(ArrayRef<int64_t> virtualVectorSize);
using Base::Base;
void runOnOperation() override;
};
} // namespace
Vectorize::Vectorize(ArrayRef<int64_t> virtualVectorSize) {
vectorSizes = virtualVectorSize;
}
static void vectorizeLoopIfProfitable(Operation *loop, unsigned depthInPattern,
unsigned patternDepth,
VectorizationStrategy *strategy) {
@ -1717,14 +1713,6 @@ static void vectorizeLoops(Operation *parentOp, DenseSet<Operation *> &loops,
LLVM_DEBUG(dbgs() << "\n");
}
std::unique_ptr<OperationPass<func::FuncOp>>
createSuperVectorizePass(ArrayRef<int64_t> virtualVectorSize) {
return std::make_unique<Vectorize>(virtualVectorSize);
}
std::unique_ptr<OperationPass<func::FuncOp>> createSuperVectorizePass() {
return std::make_unique<Vectorize>();
}
/// Applies vectorization to the current function by searching over a bunch of
/// predetermined patterns.
void Vectorize::runOnOperation() {
@ -1872,12 +1860,4 @@ vectorizeAffineLoopNest(std::vector<SmallVector<AffineForOp, 2>> &loops,
return vectorizeLoopNest(loops, strategy);
}
std::unique_ptr<OperationPass<func::FuncOp>>
createSuperVectorizePass(ArrayRef<int64_t> virtualVectorSize) {
return std::make_unique<Vectorize>(virtualVectorSize);
}
std::unique_ptr<OperationPass<func::FuncOp>> createSuperVectorizePass() {
return std::make_unique<Vectorize>();
}
} // namespace mlir