[Mlir-commits] [mlir] [MLIR] Implement emulation of static indexing subbyte type vector stores (PR #115922)

Han-Chung Wang llvmlistbot at llvm.org
Wed Nov 20 10:59:43 PST 2024


================
@@ -306,6 +307,73 @@ emulatedVectorLoad(OpBuilder &rewriter, Location loc, Value base,
       newLoad);
 }
 
+/// Atomically store a subbyte-sized value to memory, with a mask.
+static void atomicStore(OpBuilder &rewriter, Location loc,
+                        TypedValue<MemRefType> emulatedMemref,
+                        Value emulatedIndex, TypedValue<VectorType> value,
+                        Value mask, int64_t scale) {
+  auto atomicOp = rewriter.create<memref::GenericAtomicRMWOp>(
+      loc, emulatedMemref, ValueRange{emulatedIndex});
+  OpBuilder builder =
+      OpBuilder::atBlockEnd(atomicOp.getBody(), rewriter.getListener());
----------------
hanhanW wrote:

Instead of creating a new builder, can we move the insertion point of the rewriter? In this case, you'll need to have a local `guard`, where it restores the state when we exit the function. E.g.,

https://github.com/llvm/llvm-project/blob/6473a36edc571cf0734a2e8d4354e332efb170e9/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp#L236-L243

https://github.com/llvm/llvm-project/pull/115922


More information about the Mlir-commits mailing list