[Mlir-commits] [mlir] [MLIR][DLTI][Transform] Introduce transform.dlti.query (PR #101561)

Rolf Morel llvmlistbot at llvm.org
Wed Aug 7 10:39:49 PDT 2024


================
@@ -0,0 +1,61 @@
+//===- DLTITransformOps.td - DLTI transform ops ------------*- 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 DLTI_TRANSFORM_OPS
+#define DLTI_TRANSFORM_OPS
+
+include "mlir/Dialect/Transform/IR/TransformDialect.td"
+include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.td"
+include "mlir/Dialect/Transform/IR/TransformTypes.td"
+include "mlir/Interfaces/SideEffectInterfaces.td"
+include "mlir/IR/OpBase.td"
+
+def QueryOp : Op<Transform_Dialect, "dlti.query", [
+  TransformOpInterface, TransformEachOpTrait,
+  DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
+]> {
+  let summary = "Return attribute (as param) associated to key via DTLI";
+  let description = [{
+    This op queries data layout and target information associated to payload
+    IR by way of the DLTI dialect. A lookup is performed for the given `key`
+    at the `target` op, with the DLTI dialect determining which interfaces and
+    attributes are consulted.
+
+    When only `key` is provided, the lookup occurs with respect to the data
----------------
rolfmorel wrote:

With the current state of DLTI, Data Layout info is always keyed by a single name. For querying Target Information, you must always specify a device ID in addition to a key to look up w.r.t. that device. So currently, whether a second key, `deviceId`, is provided is enough to indicate which type of DLTI info the user wants to query. (If this were no longer to be the case going forward, I would advocate for having both types of DLTI info implement a `DLTIQueryInterface`, or the like, probably supporting any number of keys so that nested dictionary lookups become possible.)

As for the `::$deviceId::$key` syntax: I too would prefer for the leading `::` to go. It's currently there to help the parser. With a custom parser, I am sure `$deviceId::$key` syntax is possible as well. As more changes for DLTI are planned, I was hoping to address this in later PRs (e.g. when would allow nested dictionary lookups).

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


More information about the Mlir-commits mailing list