Skip to content

Commit 195744c

Browse files
authored
[mlir][VectorOps][nfc] Add result pretty printing to vector.vscale (llvm#83439)
This will now print the value of `vector.vscale` as `%vscale` in IR dumps which makes it easier to spot where things are scalable. One test that depended on the value names has also been fixed.
1 parent 199bbe2 commit 195744c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

mlir/include/mlir/Dialect/Vector/IR/VectorOps.td

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2809,7 +2809,8 @@ def Vector_SplatOp : Vector_Op<"splat", [
28092809
// call to the function. For that, it might be useful to have a
28102810
// 'vector.scale.global' and a 'vector.scale.local' operation.
28112811
def VectorScaleOp : Vector_Op<"vscale",
2812-
[Pure]> {
2812+
[Pure, DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>]
2813+
> {
28132814
let summary = "Load vector scale size";
28142815
let description = [{
28152816
The `vscale` op returns the scale of the scalable vectors, a positive
@@ -2825,6 +2826,13 @@ def VectorScaleOp : Vector_Op<"vscale",
28252826
}];
28262827
let results = (outs Index:$res);
28272828
let assemblyFormat = "attr-dict";
2829+
2830+
let extraClassDefinition = [{
2831+
void $cppClass::getAsmResultNames(
2832+
::llvm::function_ref<void(mlir::Value, mlir::StringRef)> setNameFn) {
2833+
setNameFn(getResult(), "vscale");
2834+
}
2835+
}];
28282836
}
28292837

28302838
//===----------------------------------------------------------------------===//

mlir/test/Dialect/Linalg/transform-op-peel-and-vectorize.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func.func @matmul(%A: tensor<1024x512xf32>,
1919
// CHECK-DAG: %[[C16:.*]] = arith.constant 16 : index
2020
// CHECK: %[[VSCALE:.*]] = vector.vscale
2121
// CHECK: %[[STEP:.*]] = arith.muli %[[VSCALE]], %[[C16]] : index
22-
// CHECK: %2 = scf.for {{.*}} %[[C0]] to %[[C1024]] step %[[C8]] iter_args(%arg4 = %arg2) -> (tensor<1024x2000xf32>) {
22+
// CHECK: scf.for {{.*}} %[[C0]] to %[[C1024]] step %[[C8]] iter_args(%arg4 = %arg2) -> (tensor<1024x2000xf32>) {
2323

2424
// Main loop after vectorisation (without masking)
2525

0 commit comments

Comments
 (0)