[Mlir-commits] [mlir] [acc] RegionBranchOpInterface for acc regions (PR #171533)

Slava Zakharin llvmlistbot at llvm.org
Tue Dec 9 16:50:20 PST 2025


================
@@ -389,6 +389,87 @@ void OpenACCDialect::initialize() {
   memref::GlobalOp::attachInterface<MemrefGlobalVariableModel>(*getContext());
 }
 
+//===----------------------------------------------------------------------===//
+// RegionBranchOpInterface for acc.kernels / acc.parallel / acc.serial /
+// acc.kernel_environment / acc.data / acc.host_data / acc.loop
+//===----------------------------------------------------------------------===//
+
+void KernelsOp::getSuccessorRegions(RegionBranchPoint point,
+                                    SmallVectorImpl<RegionSuccessor> &regions) {
+  if (point.isParent()) {
+    regions.push_back(RegionSuccessor(&getRegion()));
+    return;
+  }
+
+  regions.push_back(
+      RegionSuccessor(getOperation(), getOperation()->getResults()));
----------------
vzakhari wrote:

I suggest extracting this into a static templated utility function and just calling it in all methods, e.g.
```
template <typename OP>
static void getSuccessorRegionsForContainerOp(Op op, RegionBranchPoint, SmallVectorImpl<RegionSucessor> &);
```

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


More information about the Mlir-commits mailing list