[Mlir-commits] [mlir] [MLIR] Implement emulation of static indexing subbyte type vector stores (PR #115922)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Fri Jan 10 06:57:09 PST 2025
================
@@ -356,3 +356,140 @@ func.func @vector_maskedload_i2_constant_mask_unaligned(%passthru: vector<5xi2>)
// CHECK: %[[RESULT:.+]] = vector.extract_strided_slice %[[SELECT]]
// CHECK-SAME: {offsets = [1], sizes = [5], strides = [1]} : vector<8xi2> to vector<5xi2>
// CHECK: return %[[RESULT]] : vector<5xi2>
+
+///----------------------------------------------------------------------------------------
+/// vector.store
+///----------------------------------------------------------------------------------------
+
+func.func @vector_store_i2_const_index_two_atomic(%arg0: vector<3xi2>) {
+ %0 = memref.alloc() : memref<3x3xi2>
+ %c0 = arith.constant 0 : index
+ %c2 = arith.constant 2 : index
+ vector.store %arg0, %0[%c2, %c0] :memref<3x3xi2>, vector<3xi2>
+ return
+}
+
+// In this example, emit 2 atomic RMWs.
+// Load from bit [12:18), byte [1:2] of total 3 bytes, both bytes needs rmw.
----------------
banach-space wrote:
This is very helpful, thanks! Would you mind expanding this a bit? Suggestion:
```suggestion
// Note, sizeof(%0) = 18 bits. This is modelled as %src_as_bytes: <3xi8> (bits [0, 18) with the input values from %0, [18, 24) are masked out)
// This example stores into bits [12:18), i.e. %bytes[1] and %bytes[2]. Both stores require are atomic.
```
https://github.com/llvm/llvm-project/pull/115922
More information about the Mlir-commits
mailing list