[all-commits] [llvm/llvm-project] 34da78: [mlir][vector] Fix incorrect byte-alignment assump...
Mehdi Amini via All-commits
all-commits at lists.llvm.org
Fri May 29 15:12:12 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 34da785839f7ddabfa735655d1c6e45c7f85b353
https://github.com/llvm/llvm-project/commit/34da785839f7ddabfa735655d1c6e45c7f85b353
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2026-05-30 (Sat, 30 May 2026)
Changed paths:
M mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp
M mlir/test/Dialect/Vector/flatten-memref-and-emulate-narrow-types.mlir
A mlir/test/Dialect/Vector/vector-emulate-narrow-type-unaligned-dynamic-store.mlir
M mlir/test/Dialect/Vector/vector-emulate-narrow-type-unaligned.mlir
M mlir/test/Dialect/Vector/vector-emulate-narrow-type.mlir
Log Message:
-----------
[mlir][vector] Fix incorrect byte-alignment assumption in ConvertVectorStore (#189235)
When `ConvertVectorStore` emits the narrow-type emulation for a
`vector.store` into a 2-D memref, it previously assumed that if the
trailing dimension of the memref exactly matches the vector size
(`trailingDimsMatch`), then the last-dimension index must be zero and no
sub-byte alignment adjustment is needed. This assumption is wrong: a
valid store such as
vector.store %v, %src[%c0, %c1] : memref<3x4xi2>, vector<4xi2>
has a non-zero column index (%c1 == 1) even though trailingDim (4)
equals the vector size (4). The incorrect shortcut caused the pattern to
fall into the "aligned" path and emit a plain bitcast + store at byte
offset 0, silently dropping elements [1], [2], [3] of the first byte and
overwriting the wrong memory.
Fix: use `linearizedInfo.intraDataOffset` when it can be folded, so
constant non-zero offsets emit the required partial RMW stores. If the
offset is dynamic, reject the generic unaligned lowering instead of
assuming byte alignment; callers that can guarantee container-element
alignment should use the existing `assumeAligned` path.
The regression coverage includes the original constant-index case,
dynamic unaligned stores that now fail legalization, and existing
dynamic-row cases where the low-order offset is provably aligned.
Fixes #131528
Assisted-by: Claude Code
Assisted-by: Codex
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list