[Mlir-commits] [mlir] [mlir][OpenACC] Barrier seq loops that reuse gang-private slots after worker calls (PR #224437)

Delaram Talaashrafi llvmlistbot at llvm.org
Tue Sep 22 07:02:35 PDT 2026


================
@@ -2192,6 +2223,31 @@ acc::PrivatizeOp ACCCGToGPULowering::getPrivatizeForMemref(Value memref) {
   return acc::PrivatizeOp();
 }
 
+PrivateMemScope ACCCGToGPULowering::collectSharedPrivateStores(
+    Operation *root, llvm::SmallPtrSetImpl<Operation *> &storePrivatizes) {
+  PrivateMemScope storeScope = PrivateMemScope::None;
+  root->walk([&](memref::StoreOp storeOp) {
+    PrivateMemScope scope = getPrivateScopeForMemref(storeOp.getMemref());
+    if (scope != PrivateMemScope::Gang && scope != PrivateMemScope::Worker)
+      return;
+    if (acc::PrivatizeOp privatize = getPrivatizeForMemref(storeOp.getMemref()))
+      storePrivatizes.insert(privatize.getOperation());
+    // Prefer gang: a workgroup-shared slot is the stronger reuse hazard.
+    if (storeScope == PrivateMemScope::None || scope == PrivateMemScope::Gang)
----------------
delaram-talaashrafi wrote:

The scope will be gang in this case. That is not the intended output in some case, I'm going to address it in another PR.

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


More information about the Mlir-commits mailing list