Skip to content

Commit ed004d8

Browse files
committed
merge main
2 parents 922f9a0 + be5c660 commit ed004d8

File tree

11 files changed

+353
-177
lines changed

11 files changed

+353
-177
lines changed

cmake/llvm-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8345289ded788f4df79f59df76df0c0437c3df64
1+
f06563a5c0d239a6b98f74db522681613254ad08

include/gc/Analysis/MatmulConfigAnalysis.h

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define MLIR_ANALYSIS_MATMULCONFIGANALYSIS_H
1111

1212
#include "gc/Dialect/Linalgx/LinalgxOps.h"
13+
#include "gc/Dialect/Linalgx/Utils.h"
1314
#include "mlir/Dialect/DLTI/DLTI.h"
1415
#include "mlir/Dialect/Linalg/IR/Linalg.h"
1516
#include "mlir/Interfaces/DataLayoutInterfaces.h"
@@ -55,13 +56,17 @@ getOprandDimType(linalg::LinalgOp &linalgOp) {
5556
SmallVector<DimType>{DimType::M, DimType::K},
5657
SmallVector<DimType>{DimType::K, DimType::N},
5758
SmallVector<DimType>{DimType::M, DimType::N}};
58-
} else if (llvm::isa<linalgx::Mm2DVnniOp>(linalgOp)) {
59+
} else if (linalgx::isGenericPackedMatmulOp(
60+
linalgOp.getOperation(), linalgx::PackingType::VNNI_MM2D) ||
61+
llvm::isa<linalgx::Mm2DVnniOp>(linalgOp)) {
5962
return SmallVector<SmallVector<DimType>>{
6063
SmallVector<DimType>{DimType::M, DimType::K},
6164
SmallVector<DimType>{DimType::N, DimType::K, DimType::K, DimType::N,
6265
DimType::K},
6366
SmallVector<DimType>{DimType::M, DimType::N, DimType::M, DimType::N}};
64-
} else if (llvm::isa<linalgx::Mm4DVnniOp>(linalgOp)) {
67+
} else if (linalgx::isGenericPackedMatmulOp(
68+
linalgOp.getOperation(), linalgx::PackingType::VNNI_MM4D) ||
69+
llvm::isa<linalgx::Mm4DVnniOp>(linalgOp)) {
6570
return SmallVector<SmallVector<DimType>>{
6671
SmallVector<DimType>{DimType::M, DimType::K, DimType::M, DimType::K},
6772
SmallVector<DimType>{DimType::N, DimType::K, DimType::K, DimType::N,
@@ -92,18 +97,34 @@ getOprandDimType(linalg::LinalgOp &linalgOp) {
9297
SmallVector<DimType>{DimType::Batch, DimType::M, DimType::K},
9398
SmallVector<DimType>{DimType::Batch, DimType::N, DimType::K},
9499
SmallVector<DimType>{DimType::Batch, DimType::M, DimType::N}};
100+
} else if (linalgx::isGenericPackedMatmulOp(linalgOp.getOperation(),
101+
linalgx::PackingType::MM4D)) {
102+
return SmallVector<SmallVector<DimType>>{
103+
SmallVector<DimType>{DimType::M, DimType::K, DimType::M, DimType::K},
104+
SmallVector<DimType>{DimType::N, DimType::K, DimType::K, DimType::N},
105+
SmallVector<DimType>{DimType::M, DimType::N, DimType::M, DimType::N}};
95106
}
96107
return failure();
97108
}
98109

99110
// The analysis to extract the matmul configuration from the given linalg op
100111
struct MatmulConfigAnalysis {
101112
public:
102-
explicit MatmulConfigAnalysis(Operation *root);
103-
MatmulConfig getConfig() { return config; }
113+
// Extract the matmul configuration from the given linalg op
114+
MatmulConfigAnalysis(Operation *root) : root(root){};
115+
116+
// Get the matmul configuration
117+
MatmulConfig getConfig();
118+
119+
void setAllowIndivisibleInnerBlock(bool allow) {
120+
allowIndivisibleInnerBlock = allow;
121+
}
104122

105123
private:
106-
MatmulConfig config;
124+
MatmulConfig config = MatmulConfig{1, 1, 1, 1, 1, 1, 1, 1, 1};
125+
Operation *root;
126+
bool hasConfig = false;
127+
bool allowIndivisibleInnerBlock = true;
107128
};
108129

109130
} // namespace gc

include/gc/Analysis/TargetDescriptionAnalysis.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
#ifndef MLIR_ANALYSIS_TARGETDESCRIPTIONANALYSIS_H
1010
#define MLIR_ANALYSIS_TARGETDESCRIPTIONANALYSIS_H
1111

12-
#include "gc/Dialect/Linalgx/LinalgxOps.h"
1312
#include "mlir/Dialect/DLTI/DLTI.h"
14-
#include "mlir/Dialect/Linalg/IR/Linalg.h"
13+
#include "mlir/IR/BuiltinDialect.h"
14+
#include "mlir/IR/BuiltinTypes.h"
15+
#include "mlir/IR/PatternMatch.h"
1516
#include "mlir/Interfaces/DataLayoutInterfaces.h"
17+
#include "mlir/Support/LLVM.h"
1618
#include "llvm/ADT/StringRef.h"
1719

1820
namespace mlir {

include/gc/Transforms/Passes.td

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,17 @@ def IterativeTilingAndFusion : Pass<"iterative-tiling-and-fusion",
7878
"Set default TileSize for the certain type of op, saying `matmul:{32,32}`">,
7979
];
8080
}
81-
def DeepTileContractionNamedOp
82-
: Pass<"deep-tile-contraction-named-op", "func::FuncOp"> {
83-
let summary = "Tile linalg contraction named operation deeply";
81+
def DeepTileContractionOp
82+
: Pass<"deep-tile-contraction-op", "func::FuncOp"> {
83+
let summary = "Tile linalg contraction operation deeply";
8484
let description =
85-
[{The pass tries to tile the linalg contraction named op deeply.}];
85+
[{The pass tries to tile the linalg contraction op deeply.}];
8686
let dependentDialects = [
8787
"func::FuncDialect",
8888
"arith::ArithDialect",
8989
"tensor::TensorDialect",
9090
"linalg::LinalgDialect",
91+
"linalgx::LinalgxDialect",
9192
];
9293
}
9394

0 commit comments

Comments
 (0)