Skip to content

Commit d25a1f8

Browse files
authored
[mlir][Vector][NFC] Add vector-transform-options flag to ConvertVectorToLLVMPass (#123491)
This flag enables the configuration of some transformation such as the lowering of contractions and transposes. The default configuration preserves the existing behavior.
1 parent d540ebf commit d25a1f8

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

mlir/include/mlir/Conversion/Passes.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,11 @@ def ConvertVectorToLLVMPass : Pass<"convert-vector-to-llvm"> {
14391439
Option<"x86Vector", "enable-x86vector",
14401440
"bool", /*default=*/"false",
14411441
"Enables the use of X86Vector dialect while lowering the vector "
1442-
"dialect.">
1442+
"dialect.">,
1443+
Option<"vectorTransformsOptions", "vector-transform-options",
1444+
"vector::VectorTransformsOptions",
1445+
/*default=*/"vector::VectorTransformsOptions()",
1446+
"Options to lower some operations like contractions and transposes.">,
14431447
];
14441448
}
14451449

mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVMPASS_H_
1010

1111
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
12+
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
1213

1314
namespace mlir {
1415
class Pass;

mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ void ConvertVectorToLLVMPass::runOnOperation() {
6969
populateVectorToVectorCanonicalizationPatterns(patterns);
7070
populateVectorBitCastLoweringPatterns(patterns);
7171
populateVectorBroadcastLoweringPatterns(patterns);
72-
populateVectorContractLoweringPatterns(patterns, VectorTransformsOptions());
72+
populateVectorContractLoweringPatterns(patterns, vectorTransformsOptions);
7373
populateVectorMaskOpLoweringPatterns(patterns);
7474
populateVectorShapeCastLoweringPatterns(patterns);
7575
populateVectorInterleaveLoweringPatterns(patterns);
76-
populateVectorTransposeLoweringPatterns(patterns,
77-
VectorTransformsOptions());
76+
populateVectorTransposeLoweringPatterns(patterns, vectorTransformsOptions);
7877
// Vector transfer ops with rank > 1 should be lowered with VectorToSCF.
7978
populateVectorTransferLoweringPatterns(patterns, /*maxTransferRank=*/1);
8079
populateVectorMaskMaterializationPatterns(patterns,

0 commit comments

Comments
 (0)