[llvm] [Offload] Implement the remaining initial Offload API (PR #122106)

Callum Fare via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 7 09:28:11 PST 2025


================
@@ -0,0 +1,45 @@
+//===-- Kernel.td - Kernel definitions for Offload ---------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains Offload API definitions related to the kernel handle
+//
+//===----------------------------------------------------------------------===//
+
+def : Function {
+    let name = "olCreateKernel";
+    let desc = "Create a kernel from the function identified by `KernelName` in the given program.";
+    let details = [
+        "The created kernel has an initial reference count of 1."
+    ];
+    let params = [
+        Param<"ol_program_handle_t", "Program", "handle of the program", PARAM_IN>,
+        Param<"const char*", "KernelName", "name of the kernel entry point in the program", PARAM_IN>,
+        Param<"ol_kernel_handle_t*", "Kernel", "output pointer for the created kernel", PARAM_OUT>
+    ];
+    let returns = [];
+}
+
+def : Function {
----------------
callumfare wrote:

I can remove the kernel handle type as discussed, but one slight disadvantage is that if we make the queue optional for kernel launches then we'd need to additionally pass a device parameter to `olLaunchKernel` so the implementation can create or access the implicit default queue when the queue parameter is null. Not a big deal really but just mentioning it fyi.

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


More information about the llvm-commits mailing list