This is an archive of the discontinued LLVM Phabricator instance.

[mlir][LLVM] Convert access group metadata to using attributes instead of ops
ClosedPublic

Authored by zero9178 on Jul 14 2023, 4:37 AM.

Details

Summary

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.

Diff Detail

Event Timeline

zero9178 created this revision.Jul 14 2023, 4:37 AM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
zero9178 requested review of this revision.Jul 14 2023, 4:37 AM
gysit added inline comments.Jul 14 2023, 4:59 AM
mlir/lib/Target/LLVMIR/LoopAnnotationImporter.h
35–38

nit: node

mlir/lib/Target/LLVMIR/LoopAnnotationTranslation.cpp
248

nit: accessGroupAttr

zero9178 updated this revision to Diff 540365.Jul 14 2023, 5:08 AM
zero9178 marked 2 inline comments as done.

Address review comments

zero9178 updated this revision to Diff 540372.Jul 14 2023, 5:23 AM

Reword doc, don't forget about LLVMIRIntrinsicGen

gysit accepted this revision.Jul 14 2023, 5:53 AM

Thanks LGTM!

This revision is now accepted and ready to land.Jul 14 2023, 5:53 AM
zero9178 updated this revision to Diff 540387.Jul 14 2023, 5:58 AM

clang-format

This revision was landed with ongoing or failed builds.Jul 14 2023, 6:00 AM
This revision was automatically updated to reflect the committed changes.