forked from OSchip/llvm-project
[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:
parent
eb1eb7a144
commit
8199a43a89
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue