[all-commits] [llvm/llvm-project] d0e6fd: [mlir] Extend the promise interface mechanism

Fabian Mora via All-commits all-commits at lists.llvm.org
Tue Sep 5 06:55:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d0e6fd99aa95ff61372ea328e9f89da2ee39c49c
      https://github.com/llvm/llvm-project/commit/d0e6fd99aa95ff61372ea328e9f89da2ee39c49c
  Author: Fabian Mora <fmora.dev at gmail.com>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M mlir/include/mlir/IR/Attributes.h
    M mlir/include/mlir/IR/Dialect.h
    M mlir/include/mlir/IR/DialectRegistry.h
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/IR/OpDefinition.h
    M mlir/include/mlir/IR/Operation.h
    M mlir/include/mlir/IR/OperationSupport.h
    M mlir/include/mlir/IR/StorageUniquerSupport.h
    M mlir/include/mlir/IR/Types.h
    M mlir/lib/Dialect/Func/IR/FuncOps.cpp
    M mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp
    M mlir/lib/IR/Dialect.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/unittests/IR/InterfaceAttachmentTest.cpp

  Log Message:
  -----------
  [mlir] Extend the promise interface mechanism

This patch pairs a promised interface with the object (Op/Attr/Type/Dialect) requesting the promise, ie:
```
declarePromisedInterface<MyAttr, MyInterface>();
```
Allowing to make fine grained promises. It also adds a mechanism to query if `Op/Attr/Type` has an specific promise returning true if the promise is there or if an implementation has been added. Finally it adds a couple of `Attr|TypeConstraints` that can be used in ODS to query if the promise or an implementation is there.

This patch tries to solve 2 issues:
1. Different entities cannot use the same promise.
```
declarePromisedInterface<MyInterface>();
// Resolves a promise.
MyAttr1::attachInterface<MyInterface>(ctx);
// Doesn't resolves a promise, as the previous attachment removed the promise.
MyAttr2::attachInterface<MyInterface>(ctx);
```
2. Is not possible to query if a promise has been declared.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D158464




More information about the All-commits mailing list