[Mlir-commits] [mlir] [MLIR][DLTI] Introduce DLTIQueryInterface and impl for DLTI attrs (PR #104595)
Rolf Morel
llvmlistbot at llvm.org
Sun Aug 18 04:10:44 PDT 2024
================
@@ -33,6 +33,17 @@ DataLayoutSpecInterface getDataLayoutSpec(Operation *op);
/// DataLayoutOpInterface, a method on ModuleOp, or an attribute implementing
/// the interface, on `op` and else on `op`'s ancestors in turn.
TargetSystemSpecInterface getTargetSystemSpec(Operation *op);
+
+/// Retrieve the first `DLTIQueryInterface`-implementing attribute that is
+/// attached to `op` or such an attr on as close as possible an ancestor. The
+/// op the attribute is attached to is returned as well.
+std::pair<DLTIQueryInterface, Operation *> getClosestQueryable(Operation *op);
----------------
rolfmorel wrote:
If someone were to want to reimplement `query` themselves, this (kind of) function would probably be useful. Having said that, a more natural way to extend the DLTI dialect is to just implement your own attributes. If they implement the `DLTIQueryInterface`, their attributes will automatically work with `dlti::query` - which is presumably the main way everyone would like to engage with target information.
I have pushed a new commit that no longer exposes this utility function (and removes two that were introduced in https://github.com/llvm/llvm-project/pull/101561). If people would like to call utility functions like the above, they could always re-expose them.
https://github.com/llvm/llvm-project/pull/104595
More information about the Mlir-commits
mailing list