[Openmp-commits] [flang] [llvm] [mlir] [openmp] [MLIR][OpenMP] Add omp.fuse operation (PR #168898)

Michael Kruse via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 21 03:24:37 PST 2026


================
@@ -550,6 +550,40 @@ def TileOp : OpenMPTransformBase_Op<"tile",
   let hasVerifier = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// OpenMP fuse operation
+//===----------------------------------------------------------------------===//
+
+def FuseOp : OpenMPTransformBase_Op<"fuse"> {
+  let summary = "OpenMP fuse operation";
+  let description = [{
+    Represents the OpenMP fuse directive introduced in OpenMP 6.0.
+    
+    The construct takes a loop sequence and merges the loops specifed by the 
+    first and count attributes and generates a loop sequence with the loops
+    before the first attribute untouched, the generated fused loop, and the loops
+    after the the first + count attribute untouched mantaining the orignal
+    order. If no attributes are specified all the loops in the sequence are 
+    fused generating a single loop.
+    Each logical iteration of the fused loop executes a logical iteration of
+    each affected loop. The fused loop has the number of logical iterations 
+    equal to the affected loop with most logical iterations.
+
+    The first and count attributes are constant and known beforehand.
+  }]#clausesDescription;
+
+  let extraClassDeclaration = [{
+    IntegerAttr getFirst() {
+      return this->getOperation()->getAttrOfType<mlir::IntegerAttr>("first");
+    }
+    IntegerAttr getCount() {
+      return this->getOperation()->getAttrOfType<mlir::IntegerAttr>("count");
+    }
+  }]#clausesExtraClassDeclaration;
----------------
Meinersbur wrote:

```suggestion
  }] # clausesExtraClassDeclaration;
```

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


More information about the Openmp-commits mailing list