9 Commits

Author SHA1 Message Date
Tobias Gysi
bd26ce47c8
[mlir][llvm] Fix loop annotation parser (#78266)
This revision moves the ArrayRef field of the LoopAnnotation attribute
to the end of the struct to enable printing and parsing of the
attribute. Previously, the parsing could fail in the presence of a start
or end loc.
2024-01-16 16:35:52 +01:00
Markus Böck
9170fa5808 [mlir][LLVM] Convert access group metadata to using attributes instead of ops
Using MLIR attributes instead of metadata has many advantages:
* No indirection: Attributes can simply refer to each other seemlessly without having to use the indirection of `SymbolRefAttr`. This also gives us correctness by construction in a lot of places as well
* Multithreading safe: The Attribute infrastructure gives us thread-safety for free. Creating operations and inserting them into a block is not thread-safe. This is a major use case for e.g. the inliner in MLIR which runs in parallel
* Easier to create: There is no need for a builder or a metadata region

This patch therefore does exactly that. It leverages the new distinct attributes to create distinct access groups in a deterministic and threadsafe manner.

Differential Revision: https://reviews.llvm.org/D155285
2023-07-14 14:57:46 +02:00
Christian Ulmann
62d7d94c2e [mlir][LLVM] Support locations in loop annotation
This commit introduces support for locations as part of the loop
annotation attribute. These locations indicate the start and the end of
the loop.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D149858
2023-05-05 07:54:22 +00:00
Tobias Gysi
6600301c2f [mlir][llvm] Improve access group import handling.
In particular, do not drop all access groups of a loop annotation
if one of them is unused. This change makes the access group import
robust against stale access group references in loop metadata.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D148791
2023-04-20 11:32:22 +00:00
Christian Ulmann
bf91cd6ea9 [mlir][llvm] Verify LLVM module before import
This commit ensures that the importing of LLVM modules first verifies
that the module is even valid. As many tests did not work with valid
LLVM IR, they were fixed as part of this commit.

Some error messages were only reachable with invalid input IR, thus they
were replaced with a failures.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D144186
2023-02-17 10:25:23 +01:00
Christian Ulmann
7f249e45ec [milr][llvm] Add remaining loop metadata support
This commit adds support for the last two loop metadata nodes produced
anywhere in the llvm-project.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D143746
2023-02-13 09:09:22 +01:00
Christian Ulmann
4d7c879d33 [mlir][llvm] Adapt loop metadata to match llvm
This commit adds support for the "llvm.loop.isvectorized" metadata and
ensures that the unroll followups match llvm's naming.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D143730
2023-02-10 14:44:15 +01:00
Christian Ulmann
e630a50223 [mlir][llvm] Fuse MD_access_group & MD_loop import
This commit moves the importing logic of access group metadata into the
loop annotation importer. These two metadata imports can be grouped
because access groups are only used in combination with
`llvm.loop.parallel_accesses`.

As a nice side effect, this commit decouples the LoopAnnotationImporter
from the ModuleImport class.

Differential Revision: https://reviews.llvm.org/D143577
2023-02-09 14:43:02 +01:00
Christian Ulmann
b83caa32dc [mlir][llvm] Add support for loop metadata import
This commit introduces functionality to import loop metadata. Loop
metadata nodes are transformed into LoopAnnotationAttrs and attached to
the corresponding branch operations.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D143376
2023-02-08 11:45:15 +01:00