[Mlir-commits] [mlir] [mlir][python] Add pythonic interface for GPUFuncOp (PR #163596)

Guray Ozen llvmlistbot at llvm.org
Wed Oct 15 10:04:07 PDT 2025


================
@@ -64,3 +65,65 @@ def testObjectAttr():
     # CHECK: #gpu.object<#nvvm.target, kernels = <[#gpu.kernel_metadata<"kernel", () -> ()>]>, "BC\C0\DE5\14\00\00\05\00\00\00b\0C0$MY\BEf">
     print(o)
     assert o.kernels == kernelTable
+
+
+# CHECK-LABEL: testGPUFuncOp
+ at run
+def testGPUFuncOp():
+    module = Module.create()
+    with InsertionPoint(module.body):
+        gpu_module_name = StringAttr.get("gpu_module")
+        gpumodule = gpu.GPUModuleOp(gpu_module_name)
+        block = gpumodule.bodyRegion.blocks.append()
+
+        def builder(func: gpu.GPUFuncOp) -> None:
+            _ = gpu.GlobalIdOp(gpu.Dimension.x)
+            _ = gpu.ReturnOp([])
----------------
grypp wrote:

nit: remove "_ ="

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


More information about the Mlir-commits mailing list