Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,13 @@ struct BreakDownVectorBitCast : public OpRewritePattern<vector::BitCastOp> {
VectorType castDstType = bitcastOp.getResultVectorType();
assert(castSrcType.getRank() == castDstType.getRank());

// This transformation builds on top of
// vector.{extract|insert}_strided_slice, which do not support
// extracting/inserting "scallable sub-vectors". Bail out.
if (castSrcType.isScalable())
return rewriter.notifyMatchFailure(bitcastOp,
"Scalable vectors are not supported");

// Only support rank 1 case for now.
if (castSrcType.getRank() != 1)
return failure();
Expand Down
11 changes: 11 additions & 0 deletions mlir/test/Dialect/Vector/vector-break-down-bitcast.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ func.func @bitcast_i8_to_i32(%input: vector<16xi8>) -> vector<4xi32> {
// CHECK: %[[CAST3:.+]] = vector.bitcast %[[EXTRACT3]] : vector<4xi8> to vector<1xi32>
// CHECK: %[[INSERT3:.+]] = vector.insert_strided_slice %[[CAST3]], %[[INSERT2]] {offsets = [3], strides = [1]} : vector<1xi32> into vector<4xi32>
// CHECK: return %[[INSERT3]]

// -----

// Scalable vectors are not supported!

// CHECK-LABEL: func.func @bitcast_scalable_negative
// CHECK: vector.bitcast
func.func @bitcast_scalable_negative(%input: vector<[8]xf16>) -> vector<[4]xf32> {
%0 = vector.bitcast %input : vector<[8]xf16> to vector<[4]xf32>
return %0: vector<[4]xf32>
}
Loading