Skip to content

Commit 05ceaf0

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 05ceaf0

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 (!isa<IndexType, IntegerType, FloatType>(value.getType()))
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
@@ -682,5 +682,21 @@ func.func @vec_vecdim_reduction_rejected(%in: memref<256x512xf32>, %out: memref<
682682
return
683683
}
684684

685+
// -----
686+
687+
// Non scalar type is not regarded as the uniform in the vectorization
688+
685689
// CHECK-LABEL: @vec_vecdim_reduction_rejected
686690
// CHECK-NOT: vector
691+
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)