[all-commits] [llvm/llvm-project] 120591: [mlir] Replace usages of Identifier with StringAttr

River Riddle via All-commits all-commits at lists.llvm.org
Wed Nov 10 18:06:50 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 120591e126f97924f665baacea49080642b1162f
      https://github.com/llvm/llvm-project/commit/120591e126f97924f665baacea49080642b1162f
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-11-11 (Thu, 11 Nov 2021)

  Changed paths:
    M mlir/include/mlir/CAPI/IR.h
    M mlir/include/mlir/IR/AttributeSupport.h
    M mlir/include/mlir/IR/Attributes.h
    M mlir/include/mlir/IR/BuiltinAttributes.h
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/include/mlir/IR/BuiltinTypes.h
    M mlir/include/mlir/IR/Diagnostics.h
    M mlir/include/mlir/IR/FunctionSupport.h
    M mlir/include/mlir/IR/Identifier.h
    M mlir/include/mlir/IR/Location.h
    M mlir/include/mlir/IR/OperationSupport.h
    M mlir/include/mlir/IR/StorageUniquerSupport.h
    M mlir/include/mlir/IR/SymbolTable.h
    M mlir/include/mlir/Pass/PassManager.h
    M mlir/include/mlir/Support/StorageUniquer.h
    M mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h
    M mlir/lib/Bindings/Python/IRCore.cpp
    M mlir/lib/CAPI/IR/BuiltinAttributes.cpp
    M mlir/lib/CAPI/IR/IR.cpp
    M mlir/lib/Dialect/DLTI/DLTI.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/AttributeDetail.h
    M mlir/lib/IR/Attributes.cpp
    M mlir/lib/IR/BuiltinAttributes.cpp
    M mlir/lib/IR/BuiltinDialect.cpp
    M mlir/lib/IR/Diagnostics.cpp
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/lib/IR/OperationSupport.cpp
    M mlir/lib/IR/Verifier.cpp
    M mlir/lib/Interfaces/DataLayoutInterfaces.cpp
    M mlir/lib/Parser/AttributeParser.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/lib/Target/Cpp/TranslateToCpp.cpp
    M mlir/lib/Transforms/ViewOpGraph.cpp
    M mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp
    M mlir/test/lib/IR/TestPrintNesting.cpp

  Log Message:
  -----------
  [mlir] Replace usages of Identifier with StringAttr

Identifier and StringAttr essentially serve the same purpose, i.e. to hold a string value. Keeping these seemingly identical pieces of functionality separate has caused problems in certain situations:

* Identifier has nice accessors that StringAttr doesn't
* Identifier can't be used as an Attribute, meaning strings are often duplicated between Identifier/StringAttr (e.g. in PDL)

The only thing that Identifier has that StringAttr doesn't is support for caching a dialect that is referenced by the string (e.g. dialect.foo). This functionality is added to StringAttr, as this is useful for StringAttr in generally the same ways it was useful for Identifier.

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


  Commit: 7961511ed8eb6717d0943f2b3cdd2474111a6cd6
      https://github.com/llvm/llvm-project/commit/7961511ed8eb6717d0943f2b3cdd2474111a6cd6
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-11-11 (Thu, 11 Nov 2021)

  Changed paths:
    M mlir/include/mlir/IR/Types.h
    M mlir/include/mlir/Support/TypeID.h
    M mlir/lib/Support/StorageUniquer.cpp

  Log Message:
  -----------
  [mlir] MicroOptimize a few hot StorageUniquer code paths

* Sprinkle `inline` on a few small and hot hashing/uniquing methods
* Use the faster DenseMapInfo hash functions instead of
   llvm::hash_value.

This provides a speed up of a few percent in workloads with lots of
attributes.


Compare: https://github.com/llvm/llvm-project/compare/7f153e8ba103...7961511ed8eb


More information about the All-commits mailing list