Skip to content

Commit f67d451

Browse files
committed
[mlir][vector] Skip uniform vectorization for non scalar type
The code to vectorize the uniform type effectively assume the scalar type such as integer, float and index type. We should not regard other types as vectorizable uniform type because the following vectorization cannot treat the type properlty for now. See: #128277
1 parent ffc61dc commit f67d451

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,10 @@ static bool isUniformDefinition(Value value,
11061106
if (!loop.isDefinedOutsideOfLoop(value))
11071107
return false;
11081108
}
1109+
1110+
if (!value.getType().isIntOrIndexOrFloat())
1111+
return false;
1112+
11091113
return true;
11101114
}
11111115

mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,3 +684,19 @@ func.func @vec_vecdim_reduction_rejected(%in: memref<256x512xf32>, %out: memref<
684684

685685
// CHECK-LABEL: @vec_vecdim_reduction_rejected
686686
// CHECK-NOT: vector
687+
688+
689+
// -----
690+
691+
// Non scalar type is not regarded as the uniform in the vectorization
692+
func.func @vec_non_scalar_type() {
693+
%idx0 = index.constant 0
694+
%alloc_82 = memref.alloc() : memref<1xi64>
695+
affine.for %arg0 = 0 to 78 {
696+
%dim_191 = memref.dim %alloc_82, %idx0 : memref<1xi64>
697+
}
698+
return
699+
}
700+
701+
// CHECK-LABEL: @vec_non_scalar_type
702+
// CHECK-NOT: vector

0 commit comments

Comments
 (0)