[PATCH] D79463: [mlir] Add NamedAttrList

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 18:22:13 PDT 2020


jpienaar created this revision.
jpienaar added a reviewer: rriddle.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, bader, Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, csigg, nicolasvasilache, antiagainst, shauheen, mehdi_amini.
Herald added a reviewer: mravishankar.
Herald added a reviewer: antiagainst.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: herhut.
Herald added 1 blocking reviewer(s): rriddle.
Herald added a reviewer: aartbik.
Herald added a reviewer: ftynse.
Herald added a project: LLVM.

This is a wrapper around vector of NamedAttributes that keeps track of whether sorted and does some minimal effort to remain sorted (doing more, e.g., appending attributes in sorted order, could be done in follow up). It contains whether sorted and if a DictionaryAttr is queried, it caches the returned DictionaryAttr along with whether sorted.

Change MutableDictionaryAttr to always return a non-null Attribute even when empty (reserve null cases for errors). To this end change the getter to take a context as input so that the empty DictionaryAttr could be queried. Also create one instance of the empty dictionary attribute that could be reused without needing to lock context etc.

Update infer type op interface to use DictionaryAttr and use NamedAttrList to avoid incurring multiple conversion costs.

Fix bug in sorting helper function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79463

Files:
  mlir/include/mlir/IR/Attributes.h
  mlir/include/mlir/IR/FunctionImplementation.h
  mlir/include/mlir/IR/FunctionSupport.h
  mlir/include/mlir/IR/OpImplementation.h
  mlir/include/mlir/IR/Operation.h
  mlir/include/mlir/IR/OperationSupport.h
  mlir/include/mlir/Interfaces/InferTypeOpInterface.h
  mlir/include/mlir/Interfaces/InferTypeOpInterface.td
  mlir/lib/Analysis/CallGraph.cpp
  mlir/lib/Dialect/Affine/IR/AffineOps.cpp
  mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
  mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
  mlir/lib/Dialect/SPIRV/SPIRVCanonicalization.cpp
  mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
  mlir/lib/Dialect/Shape/IR/Shape.cpp
  mlir/lib/Dialect/Vector/VectorOps.cpp
  mlir/lib/IR/Attributes.cpp
  mlir/lib/IR/Function.cpp
  mlir/lib/IR/FunctionImplementation.cpp
  mlir/lib/IR/MLIRContext.cpp
  mlir/lib/IR/Operation.cpp
  mlir/lib/IR/OperationSupport.cpp
  mlir/lib/IR/SymbolTable.cpp
  mlir/lib/Interfaces/InferTypeOpInterface.cpp
  mlir/lib/Parser/Parser.cpp
  mlir/lib/Pass/IRPrinting.cpp
  mlir/test/lib/Dialect/Test/TestDialect.cpp
  mlir/test/lib/Dialect/Test/TestPatterns.cpp
  mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
  mlir/tools/mlir-tblgen/OpFormatGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79463.262278.patch
Type: text/x-patch
Size: 60178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200506/5b46f454/attachment.bin>


More information about the llvm-commits mailing list