[Mlir-commits] [mlir] [mlir][gpu] Add optional attributes of kernelModule and kernelFunc for outlining kernels. (PR #118861)

Valentin Clement バレンタイン クレメン llvmlistbot at llvm.org
Thu Dec 5 12:44:54 PST 2024


================
@@ -1030,6 +1036,16 @@ def GPU_LaunchOp : GPU_Op<"launch", [
     static StringRef getNumWorkgroupAttributionsAttrName() {
       return "workgroup_attributions";
     }
+
+    /// Checks if the kernel func name attribute is present.
+    bool hasKernelFuncName() {
+      return getKernelFunc().has_value();
+    }
+
+    /// Checks if the kernel module name attribute is present.
+    bool hasKernelModuleName() {
+      return getKernelModule().has_value();
+    }
----------------
clementval wrote:

You don't really need this. You can check optional like 

```
if (op.getKernelFunc()) {
  // attribute is present. 
}
```

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


More information about the Mlir-commits mailing list