Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions compiler/src/iree/compiler/Codegen/Common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ iree_compiler_cc_library(
"MaterializeEncodingPatterns.cpp",
"MaterializeTuningSpecs.cpp",
"MaterializeVectorMasking.cpp",
"MaterializeVectorTileSizes.cpp",
"MathTransform.cpp",
"MemrefCopyToLinalg.cpp",
"NormalizeLoopBounds.cpp",
Expand Down
1 change: 1 addition & 0 deletions compiler/src/iree/compiler/Codegen/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ iree_cc_library(
"MaterializeEncodingPatterns.cpp"
"MaterializeTuningSpecs.cpp"
"MaterializeVectorMasking.cpp"
"MaterializeVectorTileSizes.cpp"
"MathTransform.cpp"
"MemrefCopyToLinalg.cpp"
"NormalizeLoopBounds.cpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ namespace mlir::iree_compiler {
#include "iree/compiler/Codegen/Common/Passes.h.inc"

namespace {
// Returns the vector sizes from the local lowering config or try to infer them
// from the tensor shapes and tiled loops in the IR.

// Returns the vector sizes from the local lowering config, materialized
// tile size attributes, or tries to infer them from the tensor shapes and
// tiled loops in the IR.
static std::optional<SizesAndScalableFlags>
getVectorSizes(Operation *op, bool useConfiguredVectorSizes) {
// Get vector sizes from the lowering config, if available in the op itself.
Expand Down Expand Up @@ -80,6 +82,15 @@ getVectorSizes(Operation *op, bool useConfiguredVectorSizes) {
LDBG() << "Failed to get configured vector sizes, fall back to inference";
}

// Try to get vector sizes from materialized tile size attribute.
if (auto tileSizesAttr =
op->getAttrOfType<DenseI64ArrayAttr>(kVectorTileSizesAttrName)) {
LDBG() << "Use vector sizes from materialized tile size attribute";
SmallVector<int64_t> vectorSizes(tileSizesAttr.asArrayRef());
SmallVector<bool> scalableFlags(vectorSizes.size(), false);
return std::make_pair(vectorSizes, scalableFlags);
}

// Try to infer the vector sizes from the IR.
std::optional<SmallVector<int64_t>> vectorSizes;
SmallVector<bool> scalableFlags;
Expand Down
Loading
Loading