[all-commits] [llvm/llvm-project] 86646b: [mlir] Refactor StorageUniquer to require registra...

River Riddle via All-commits all-commits at lists.llvm.org
Fri Aug 7 13:43:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 86646be3158933330bf3342e9d7e4250945bb70c
      https://github.com/llvm/llvm-project/commit/86646be3158933330bf3342e9d7e4250945bb70c
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/SDBM/SDBMDialect.h
    M mlir/include/mlir/IR/AttributeSupport.h
    M mlir/include/mlir/IR/StorageUniquerSupport.h
    M mlir/include/mlir/IR/TypeSupport.h
    M mlir/include/mlir/Support/StorageUniquer.h
    M mlir/lib/Dialect/SDBM/SDBMDialect.cpp
    M mlir/lib/Dialect/SDBM/SDBMExpr.cpp
    M mlir/lib/IR/AffineExpr.cpp
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/lib/Support/StorageUniquer.cpp

  Log Message:
  -----------
  [mlir] Refactor StorageUniquer to require registration of possible storage types

This allows for bucketing the different possible storage types, with each bucket having its own allocator/mutex/instance map. This greatly reduces the amount of lock contention when multi-threading is enabled. On some non-trivial .mlir modules (>300K operations), this led to a compile time decrease of a single conversion pass by around half a second(>25%).

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


  Commit: 9f24640b7e6e61b0f293c724155a90a5e446dd7a
      https://github.com/llvm/llvm-project/commit/9f24640b7e6e61b0f293c724155a90a5e446dd7a
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    A mlir/include/mlir/Support/ThreadLocalCache.h
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/lib/Support/StorageUniquer.cpp
    M mlir/test/EDSC/builder-api-test.cpp

  Log Message:
  -----------
  [mlir] Add a utility class, ThreadLocalCache, for storing non static thread local objects.

This class allows for defining thread local objects that have a set non-static lifetime. This internals of the cache use a static thread_local map between the various different non-static objects and the desired value type. When a non-static object destructs, it simply nulls out the entry in the static map. This will leave an entry in the map, but erase any of the data for the associated value. The current use cases for this are in the MLIRContext, meaning that the number of items in the static map is ~1-2 which aren't particularly costly enough to warrant the complexity of pruning. If a use case arises that requires pruning of the map, the functionality can be added.

This is especially useful in the context of MLIR for implementing thread-local caching of context level objects that would otherwise have very high lock contention. This revision adds a thread local cache in the MLIRContext for attributes, identifiers, and types to reduce some of the locking burden. This led to a speedup of several hundred miliseconds when compiling a conversion pass on a very large mlir module(>300K operations).

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


  Commit: dd48773396f77fd7b19adc43b23d41aef356809a
      https://github.com/llvm/llvm-project/commit/dd48773396f77fd7b19adc43b23d41aef356809a
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M mlir/include/mlir/IR/StandardTypes.h
    M mlir/include/mlir/IR/TypeSupport.h
    M mlir/include/mlir/IR/Types.h
    M mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp
    M mlir/lib/IR/StandardTypes.cpp
    M mlir/lib/IR/TypeDetail.h
    M mlir/lib/IR/Types.cpp

  Log Message:
  -----------
  [mlir][Types] Remove the subclass data from Type

Subclass data is useful when a certain amount of memory is allocated, but not all of it is used. In the case of Type, that hasn't been the case for a while and the subclass is just taking up a full `unsigned`. Removing this frees up ~8 bytes for almost every type instance.

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


  Commit: 1d6a8deb41221f73c57b57fe9add180da34af77f
      https://github.com/llvm/llvm-project/commit/1d6a8deb41221f73c57b57fe9add180da34af77f
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIRAttr.h
    M flang/include/flang/Optimizer/Dialect/FIRType.h
    M mlir/docs/Tutorials/DefiningAttributesAndTypes.md
    M mlir/docs/Tutorials/Toy/Ch-7.md
    M mlir/examples/toy/Ch7/include/toy/Dialect.h
    M mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h
    M mlir/include/mlir/Dialect/Quant/QuantTypes.h
    M mlir/include/mlir/Dialect/SPIRV/SPIRVAttributes.h
    M mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h
    M mlir/include/mlir/Dialect/Shape/IR/Shape.h
    M mlir/include/mlir/IR/AttributeSupport.h
    M mlir/include/mlir/IR/Attributes.h
    M mlir/include/mlir/IR/Location.h
    M mlir/include/mlir/IR/StandardTypes.h
    M mlir/include/mlir/IR/StorageUniquerSupport.h
    M mlir/include/mlir/IR/TypeSupport.h
    M mlir/include/mlir/IR/Types.h
    M mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/test/lib/Dialect/Test/TestTypes.h

  Log Message:
  -----------
  [mlir] Remove the need to define `kindof` on attribute and type classes.

This revision refactors the default definition of the attribute and type `classof` methods to use the TypeID of the concrete class instead of invoking the `kindof` method. The TypeID is already used as part of uniquing, and this allows for removing the need for users to define any of the type casting utilities themselves.

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


  Commit: fff39b62bb4078ce78813f25c04e0da435a8feb3
      https://github.com/llvm/llvm-project/commit/fff39b62bb4078ce78813f25c04e0da435a8feb3
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M mlir/include/mlir/IR/Attributes.h
    M mlir/include/mlir/IR/Location.h
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/Attributes.cpp
    M mlir/lib/IR/Diagnostics.cpp
    M mlir/lib/IR/Location.cpp
    M mlir/lib/Target/LLVMIR/DebugTranslation.cpp
    M mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp

  Log Message:
  -----------
  [mlir][Attribute] Remove usages of Attribute::getKind

This is in preparation for removing the use of "kinds" within attributes and types in MLIR.

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


  Commit: c8c45985fba935f28943d6218915d7fe5a5fc807
      https://github.com/llvm/llvm-project/commit/c8c45985fba935f28943d6218915d7fe5a5fc807
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h
    M mlir/include/mlir/Dialect/Quant/QuantTypes.h
    M mlir/include/mlir/IR/StandardTypes.h
    M mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp
    M mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
    M mlir/lib/Dialect/Quant/IR/TypeParser.cpp
    M mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp
    M mlir/lib/Dialect/SPIRV/LayoutUtils.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp
    M mlir/lib/Dialect/Traits.cpp
    M mlir/lib/IR/StandardTypes.cpp

  Log Message:
  -----------
  [mlir][Type] Remove usages of Type::getKind

This is in preparation for removing the use of "kinds" within attributes and types in MLIR.

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


  Commit: 82fd1392016984c81c6037e147ee2dd36cf91f4c
      https://github.com/llvm/llvm-project/commit/82fd1392016984c81c6037e147ee2dd36cf91f4c
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M flang/lib/Optimizer/Dialect/FIRDialect.cpp

  Log Message:
  -----------
  [flang] Update FirOpsDialect constructor to pass its TypeID


Compare: https://github.com/llvm/llvm-project/compare/164a02d0fa46...82fd13920169


More information about the All-commits mailing list