[Mlir-commits] [mlir] [mlir-python] Emit only dialect `EnumAttr` registrations. (PR #117918)

Jakub Kuderski llvmlistbot at llvm.org
Wed Nov 27 16:13:15 PST 2024


================
@@ -2,5 +2,21 @@
 #  See https://llvm.org/LICENSE.txt for license information.
 #  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+from ..ir import IntegerAttr, IntegerType, register_attribute_builder
 from ._amdgpu_ops_gen import *
 from ._amdgpu_enum_gen import *
+
+
+ at register_attribute_builder("builtin.AMDGPU_DPPPerm")
+def _amdgpu_dppperm(x, context):
+    return IntegerAttr.get(IntegerType.get_signless(32, context=context), int(x))
----------------
kuhar wrote:

Would be nice to add a 'reflection' function to the tablegened enum classes to get the underlying type from the enum definition

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


More information about the Mlir-commits mailing list