[Mlir-commits] [mlir] [MLIR][XeGPU] add xegpu.set_desc_layout transform op (PR #165615)

Tuomas Kärnä llvmlistbot at llvm.org
Tue Nov 4 12:28:23 PST 2025


================
@@ -0,0 +1,67 @@
+#  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
+
+from .._xegpu_transform_ops_gen import *
+from .._xegpu_transform_ops_gen import _Dialect
+
+try:
+    from ...ir import *
+    from .._ods_common import _cext as _ods_cext
+    from .._ods_common import (
+        MixedValues,
+        get_op_result_or_value as _get_op_result_or_value,
+        _dispatch_dynamic_index_list,
+    )
+
+except ImportError as e:
+    raise RuntimeError("Error loading imports from extension module") from e
+
+from typing import Union
+
+
+ at _ods_cext.register_operation(_Dialect, replace=True)
+class SetDescLayoutOp(SetDescLayoutOp):
+    """Specialization for SetDescLayoutOp class."""
+
+    def __init__(
+        self,
+        target: Union[Operation, Value],
+        sg_layout: MixedValues,
+        *,
+        sg_data: MixedValues = None,
+        inst_data: MixedValues = None,
+        loc=None,
+        ip=None,
+    ):
+        target_value = _get_op_result_or_value(target)
----------------
tkarna wrote:

On the transform dialect level, "Operation" is a transform op, and "Value" is a (list of) handle(s) to payload ops. I.e., this helper function essentially saves us from having to explicitly request the result value of an transform op:

```python
 desc_op_a = xegpu.GetDescOp(target=dpas_op, index=0).result  # .result can be omitted
 desc_op_a = xegpu.SetDescLayoutOp(target=desc_op_a, ...)
```

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


More information about the Mlir-commits mailing list