Skip to content

Commit 102994f

Browse files
committed
fixup! [mlir][vector] Fix emulation of "narrow" type vector.store
Incorporate comments from Alan
1 parent 52ebd48 commit 102994f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,9 @@ struct ConvertVectorStore final : OpConversionPattern<vector::StoreOp> {
597597
// corresponding index must be 0.
598598
// FIXME: There's no way to tell for dynamic shapes, so we should bail out.
599599
// However, that makes some tests fail, so we need to audit first.
600+
auto trailingDim = op.getBase().getType().getShape().back();
600601
bool trailingDimsMatch =
601-
ShapedType::isDynamic(op.getBase().getType().getShape().back())
602-
? true
603-
: op.getBase().getType().getShape().back() == origElements;
602+
ShapedType::isDynamic(trailingDim) || trailingDim == origElements;
604603

605604
auto stridedMetadata =
606605
rewriter.create<memref::ExtractStridedMetadataOp>(loc, op.getBase());

mlir/test/Dialect/Vector/vector-emulate-narrow-type.mlir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ func.func @vector_store_i4(%arg0: vector<8xi4>, %arg1: index, %arg2: index) {
442442
// FIXME: This example assumes that the store happens at a byte boundary, but
443443
// that's not guaranteed. Below is a counter-example with specific dimensions:
444444
// vector.store %arg0, %0[0, 3] : memref<2x13xi4>, vector<8xi4>
445+
// TODO: Revisit post #136797
445446

446447
func.func @vector_store_i4_dynamic(%arg0: vector<8xi4>, %arg1: index, %arg2: index, %arg3: index, %arg4: index) {
447448
%0 = memref.alloc(%arg1, %arg2) : memref<?x?xi4>

0 commit comments

Comments
 (0)