Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions mlir/include/mlir/Dialect/Affine/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class FuncOp;

namespace affine {
class AffineForOp;
class AffineParallelOp;

/// Fusion mode to attempt. The default mode `Greedy` does both
/// producer-consumer and sibling fusion.
Expand Down Expand Up @@ -108,6 +109,13 @@ std::unique_ptr<OperationPass<func::FuncOp>> createLoopUnrollPass(
std::unique_ptr<OperationPass<func::FuncOp>>
createLoopUnrollAndJamPass(int unrollJamFactor = -1);

/// Creates a memory banking pass to explicitly partition the memories used
/// inside affine parallel operations
std::unique_ptr<OperationPass<func::FuncOp>> createParallelBankingPass(
int unrollFactor = -1,
const std::function<unsigned(AffineParallelOp)> &getBankingFactor =
nullptr);

/// Creates a pass to pipeline explicit movement of data across levels of the
/// memory hierarchy.
std::unique_ptr<OperationPass<func::FuncOp>> createPipelineDataTransferPass();
Expand Down
9 changes: 9 additions & 0 deletions mlir/include/mlir/Dialect/Affine/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,15 @@ def AffineParallelize : Pass<"affine-parallelize", "func::FuncOp"> {
];
}

def AffineParallelBanking : Pass<"affine-parallel-banking", "func::FuncOp"> {
let summary = "Partition the memories used in affine parallel loops into banks";
let constructor = "mlir::affine::createParallelBankingPass()";
let options = [
Option<"bankingFactor", "banking-factor", "unsigned", /*default=*/"1",
"Use this banking factor for all memories being partitioned">
];
}

def AffineLoopNormalize : Pass<"affine-loop-normalize", "func::FuncOp"> {
let summary = "Apply normalization transformations to affine loop-like ops";
let constructor = "mlir::affine::createAffineLoopNormalizePass()";
Expand Down
2 changes: 2 additions & 0 deletions mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_mlir_dialect_library(MLIRAffineTransforms
LoopTiling.cpp
LoopUnroll.cpp
LoopUnrollAndJam.cpp
ParallelBanking.cpp
PipelineDataTransfer.cpp
ReifyValueBounds.cpp
SuperVectorize.cpp
Expand Down Expand Up @@ -39,5 +40,6 @@ add_mlir_dialect_library(MLIRAffineTransforms
MLIRValueBoundsOpInterface
MLIRVectorDialect
MLIRVectorUtils
MLIRSCFDialect
)

Loading
Loading