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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 15 10:43:18 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD mlir/python/mlir/dialects/gpu/__init__.py mlir/test/python/dialects/gpu/dialect.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- python/mlir/dialects/gpu/__init__.py	2025-10-15 17:40:53.000000 +0000
+++ python/mlir/dialects/gpu/__init__.py	2025-10-15 17:42:40.248929 +0000
@@ -36,10 +36,11 @@
 
 FUNCTION_TYPE_ATTRIBUTE_NAME = "function_type"
 SYM_NAME_ATTRIBUTE_NAME = "sym_name"
 ARGUMENT_ATTRIBUTE_NAME = "arg_attrs"
 RESULT_ATTRIBUTE_NAME = "res_attrs"
+
 
 @_ods_cext.register_operation(_Dialect, replace=True)
 class GPUFuncOp(GPUFuncOp):
     __doc__ = GPUFuncOp.__doc__
 
@@ -81,19 +82,19 @@
         if body_builder is not None:
             with InsertionPoint(self.add_entry_block()):
                 body_builder(self)
         if known_block_size is not None:
             if isinstance(known_block_size, list):
-                self.attributes[KNOWN_BLOCK_SIZE_ATTRIBUTE_NAME] = (
-                    DenseI32ArrayAttr.get(known_block_size)
-                )
+                self.attributes[
+                    KNOWN_BLOCK_SIZE_ATTRIBUTE_NAME
+                ] = DenseI32ArrayAttr.get(known_block_size)
             else:
                 self.attributes[KNOWN_BLOCK_SIZE_ATTRIBUTE_NAME] = known_block_size
         if known_grid_size is not None:
             if isinstance(known_grid_size, list):
-                self.attributes[KNOWN_GRID_SIZE_ATTRIBUTE_NAME] = (
-                    DenseI32ArrayAttr.get(known_grid_size)
+                self.attributes[KNOWN_GRID_SIZE_ATTRIBUTE_NAME] = DenseI32ArrayAttr.get(
+                    known_grid_size
                 )
             else:
                 self.attributes[KNOWN_GRID_SIZE_ATTRIBUTE_NAME] = known_grid_size
 
     @property

``````````

</details>


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


More information about the Mlir-commits mailing list