[Mlir-commits] [mlir] [mlir][gpu] Loose the condition to convert scf.parallel to gpu.launch (PR #164978)

Hsiangkai Wang llvmlistbot at llvm.org
Wed Oct 29 07:14:28 PDT 2025


================
@@ -682,6 +716,18 @@ ParallelToGpuLaunchLowering::matchAndRewrite(ParallelOp parallelOp,
       Operation *clone = rewriter.clone(*op, cloningMap);
       cloningMap.map(op->getResults(), clone->getResults());
       // Check for side effects.
+      if (!isMemoryEffectFree(clone)) {
+        // Record the buffer accessed by the operations with write effects.
+        if (auto memEffectInterface =
+                dyn_cast<MemoryEffectOpInterface>(clone)) {
+          SmallVector<MemoryEffects::EffectInstance> effects;
+          memEffectInterface.getEffects(effects);
+          for (const auto &effect : effects) {
+            if (isa<MemoryEffects::Write>(effect.getEffect()))
+              writtenBuffer.insert(effect.getValue());
----------------
Hsiangkai wrote:

Checked the value before use.

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


More information about the Mlir-commits mailing list