5 Commits

Author SHA1 Message Date
Rolf Morel
063e0bd52a
[MLIR][DLTI] Enable types as keys in DLTI-query utils (#105995)
Enable support for query functions - including transform.dlti.query - to
take types as keys. As the data layout specific attributes already
supported types as keys, this change enables querying such attributes in
the expected way.
2024-08-27 04:41:15 -07:00
Rolf Morel
34a88bbc34
[MLIR][DLTI] Introduce DLTIQueryInterface and impl for DLTI attrs (#104595)
This new interface is supposed to capture the core functionality of
DLTI: querying for values at keys. As such this new interface unifies
the ability to query DLTI attributes in a single method: query(). All
existing DLTI interfaces exposing their own query methods now 1) now
extend this new interface and 2) provide a default implementation for
`query()`.

As DLTIQueryInterface::query() returns an attribute, it naturally
enables recursive queries on nested DLTI attrs. A utility function,
`dlti::query()`, implements the logic for nested lookups.

A new `#dlti.map` attribute is introduced to capture the most generic
form of a finite DLTI-mapping. One of the benefits is that it allows for
more easily encoding hierachical information that is suitably queryable,
i.e. by means of nested attributes.

In line with the above, `transform.dlti.query` is modified so as to take
an arbitrary number of keys and to perform a nested lookup using the
above utility function.
2024-08-20 12:22:30 +02:00
Rolf Morel
2ad3bcded8
[MLIR][DLTI][Transform] Introduce transform.dlti.query - 2nd attempt (#102652)
This transform op makes it possible to query attributes associated to IR
by means of the DLTI dialect.

The op takes both a `key` and a target `op` to perform the query at.
Facility functions automatically find the closest ancestor op which
defines the appropriate DLTI interface or has an attribute implementing
a DLTI interface. By default the lookup uses the data layout interfaces
of DLTI. If the optional `device` parameter is provided, the lookup
happens with respect to the interfaces for TargetSystemSpec and
TargetDeviceSpec.

This op uses new free-standing functions in the `dlti` namespace to not
only look up specifications via the `DataLayoutSpecOpInterface` and on
`ModuleOp`s but also on any ancestor op that has an appropriate DLTI
attribute.
2024-08-12 11:57:28 +01:00
Renato Golin
7752fec607 Revert "[MLIR][DLTI][Transform] Introduce transform.dlti.query (#101561)"
This reverts commit 8f21ff9bd89fb7c8bbfdc4426b65dcd9ababf3ce.

Crashed CI builds
2024-08-09 18:11:36 +01:00
Rolf Morel
8f21ff9bd8
[MLIR][DLTI][Transform] Introduce transform.dlti.query (#101561)
This transform op makes it possible to query attributes associated to IR
by means of the DLTI dialect.

The op takes both a `key` and a target `op` to perform the query at.
Facility functions automatically find the closest ancestor op which
defines the appropriate DLTI interface or has an attribute implementing
a DLTI interface. By default the lookup uses the data layout interfaces
of DLTI. If the optional `device` parameter is provided, the lookup
happens with respect to the interfaces for TargetSystemSpec and
TargetDeviceSpec.

This op uses new free-standing functions in the `dlti` namespace to not
only look up specifications via the `DataLayoutSpecOpInterface` and on
`ModuleOp`s but also on any ancestor op that has an appropriate DLTI
attribute.
2024-08-09 17:09:25 +01:00