llvm/mlir/lib/Target
Alex Zinenko f9be7a7afd [mlir] speed up construction of LLVM IR constants when possible
The translation to LLVM IR used to construct sequential constants by recurring
down to individual elements, creating constant values for them, and wrapping
them into aggregate constants in post-order. This is highly inefficient for
large constants with known data such as DenseElementsAttr. Use LLVM's
ConstantData for the innermost dimension instead. LLVM does seem to support
data constants for nested sequential constants so the outer dimensions are
still handled recursively. Nevertheless, this speeds up the translation of
large constants with equal dimensions by up to 30x.

Users are advised to rewrite large constants to use flat types before
translating to LLVM IR if more efficiency in translation is necessary. This is
not done automatically as the translation is not aware of the expectations of
the overall compilation flow about type changes and indexing, in particular for
global constants with external linkage.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D109152
2021-09-02 23:07:30 +02:00
..
Cpp [mlir] Add missing dep on MLIRTranslation 2021-09-02 16:54:46 +00:00
LLVMIR [mlir] speed up construction of LLVM IR constants when possible 2021-09-02 23:07:30 +02:00
SPIRV [Builder] Eliminate the StringRef/StringAttr forms of getSymbolRefAttr. 2021-08-30 16:05:36 -07:00
CMakeLists.txt [mlir] Add Cpp emitter 2021-09-02 13:51:05 +00:00