[Mlir-commits] [mlir] [mlir][gpu][RFC] Add a source language enum attribute to gpu.func and gpu.launch ops (PR #133163)

Valentin Clement バレンタイン クレメン llvmlistbot at llvm.org
Wed Mar 26 14:12:41 PDT 2025


================
@@ -351,6 +351,23 @@ def GPU_OptionalDimSizeHintAttr : ConfinedAttr<OptionalAttr<DenseI32ArrayAttr>,
   [AttrConstraint<Or<[IsNullAttr.predicate, DenseArrayCount<3>.predicate]>,
     "with 3 elements (if present)">]>;
 
+// Source language of the gpu.func or gpu.launc_func operations.
+def GPU_KernelSourceLangOpenACC : I32EnumAttrCase<"OpenACC", 0, "openacc">;
+def GPU_KernelSourceLangOpenMP : I32EnumAttrCase<"OpenMP", 1, "openmp">;
+def GPU_KernelSourceLangCUDAFortran
+    : I32EnumAttrCase<"CUDAFortran", 2, "cuda_fortran">;
+
+def GPU_KernelSourceLang
+    : I32EnumAttr<"KernelSourceLang", "Source language of a kernel",
+                  [GPU_KernelSourceLangOpenACC, GPU_KernelSourceLangOpenMP,
+                   GPU_KernelSourceLangCUDAFortran,
+]> {
----------------
clementval wrote:

The attribute is meant to be optional and the enum can be populated with any needed source language.

What would you suggest otherwise? Keep the attribute downstream?

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


More information about the Mlir-commits mailing list