[Mlir-commits] [mlir] [mlir][DLTI] Introduce an operation interface for scoped DLTI queries (PR #222776)
Mehdi Amini
llvmlistbot at llvm.org
Fri Sep 25 05:34:36 PDT 2026
================
@@ -0,0 +1,53 @@
+//===- DLTIOpInterfaces.td - DLTI operation interfaces -----*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_DLTI_DLTIOPINTERFACES
+#define MLIR_DIALECT_DLTI_DLTIOPINTERFACES
+
+include "mlir/Interfaces/DataLayoutInterfaces.td"
+
+def DLTIQueryOpInterface : OpInterface<"DLTIQueryOpInterface"> {
+ let cppNamespace = "::mlir";
+
+ let description = [{
+ Operation interface for scoped DLTI key-value associations.
+
+ Queries and updates operate on one key at a time. The default
+ implementations use the operation's inherent `dlti` attribute. An update
+ preserves other entries in a `#dlti.map`; setting a null value removes an
+ entry. Updating a non-map `dlti` attribute or using a null or empty string
+ key fails.
+ }];
+
+ let methods = [
+ InterfaceMethod<
+ /*description=*/"Returns the DLTI value associated with the key.",
+ /*retTy=*/"::mlir::FailureOr<::mlir::Attribute>",
+ /*methodName=*/"queryDlti",
+ /*args=*/(ins "::mlir::DataLayoutEntryKey":$key),
+ /*methodBody=*/"",
+ /*defaultImplementation=*/[{
+ return ::mlir::dlti::detail::queryDlti($_op.getOperation(), key);
+ }]
+ >,
+ InterfaceMethod<
+ /*description=*/"Creates, replaces, or removes a DLTI key-value "
+ "association.",
+ /*retTy=*/"::mlir::LogicalResult",
+ /*methodName=*/"setDlti",
+ /*args=*/(ins "::mlir::DataLayoutEntryKey":$key,
+ "::mlir::Attribute":$value),
+ /*methodBody=*/"",
+ /*defaultImplementation=*/[{
+ return ::mlir::dlti::detail::setDlti($_op.getOperation(), key, value);
+ }]
+ >
+ ];
+}
----------------
joker-eph wrote:
[DLTIQueryInterface](https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Interfaces/DataLayoutInterfaces.td#L23-L44) is an attribute interface, this is an OpInterface.
https://github.com/llvm/llvm-project/pull/222776
More information about the Mlir-commits
mailing list