[mlir][ods] ODS-level Attribute Optimizations
authorMogball <jeffniu22@gmail.com>
Fri, 8 Apr 2022 16:41:31 +0000 (16:41 +0000)
committerMogball <jeffniu22@gmail.com>
Mon, 11 Apr 2022 18:34:07 +0000 (18:34 +0000)
commit15a65594c1c0321671a827582fd66a22e0dbdc6e
tree520cdcdbdc76d2bfaa70b13ad721ac4c21e9e407
parent80304c5f88f02cb189f6777313fdea146fcc595a
[mlir][ods] ODS-level Attribute Optimizations

This patch contains several ODS-level optimizations to attribute getters and getting.

1. OpAdaptors, when provided a DictionaryAttr, will instantiate an OperationName so that adaptor attribute getters can used cached identifiers.
2. Verifiers will take advantage of attributes stored in sorted order to get all required (non-optional, non-default valued, and non-derived) attributes in one pass over the attribute dictionary and verify that they are present.
3. ODS-generated attribute getters will use "subrange" lookup. Because the attributes are stored in sorted order and ODS knows which attributes are required, the number of required attributes less than and greater than each attribute can be computed. When searching for an attribute, the ends of the search range can be dropped.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D122430
mlir/include/mlir/IR/OperationSupport.h
mlir/test/Dialect/LLVMIR/global.mlir
mlir/test/IR/attribute.mlir
mlir/test/mlir-tblgen/constraint-unique.td
mlir/test/mlir-tblgen/op-attribute.td
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp