[all-commits] [llvm/llvm-project] 53b946: [mlir] Refactor the representation of function-lik...
River Riddle via All-commits
all-commits at lists.llvm.org
Fri May 7 19:40:31 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 53b946aa636a31e9243b8c5bf1703a1f6eae798e
https://github.com/llvm/llvm-project/commit/53b946aa636a31e9243b8c5bf1703a1f6eae798e
Author: River Riddle <riddleriver at gmail.com>
Date: 2021-05-07 (Fri, 07 May 2021)
Changed paths:
M mlir/include/mlir/Dialect/GPU/GPUOps.td
M mlir/include/mlir/IR/BuiltinAttributes.td
M mlir/include/mlir/IR/FunctionImplementation.h
M mlir/include/mlir/IR/FunctionSupport.h
M mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
M mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
M mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
M mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
M mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
M mlir/lib/IR/BuiltinDialect.cpp
M mlir/lib/IR/FunctionImplementation.cpp
M mlir/lib/IR/FunctionSupport.cpp
M mlir/lib/Transforms/Utils/DialectConversion.cpp
M mlir/test/Dialect/LLVMIR/func.mlir
M mlir/test/IR/invalid-func-op.mlir
M mlir/test/IR/test-func-set-type.mlir
Log Message:
-----------
[mlir] Refactor the representation of function-like argument/result attributes.
The current design uses a unique entry for each argument/result attribute, with the name of the entry being something like "arg0". This provides for a somewhat sparse design, but ends up being much more expensive (from a runtime perspective) in-practice. The design requires building a string every time we lookup the dictionary for a specific arg/result, and also requires N attribute lookups when collecting all of the arg/result attribute dictionaries.
This revision restructures the design to instead have an ArrayAttr that contains all of the attribute dictionaries for arguments and another for results. This design reduces the number of attribute name lookups to 1, and allows for O(1) lookup for individual element dictionaries. The major downside is that we can end up with larger memory usage, as the ArrayAttr contains an entry for each element even if that element has no attributes. If the memory usage becomes too problematic, we can experiment with a more sparse structure that still provides a lot of the wins in this revision.
This dropped the compilation time of a somewhat large TensorFlow model from ~650 seconds to ~400 seconds.
Differential Revision: https://reviews.llvm.org/D102035
More information about the All-commits
mailing list