[Mlir-commits] [flang] [mlir] [mlir] Align num elements type to LLVM ArrayType (PR #93230)
Mehdi Amini
llvmlistbot at llvm.org
Thu May 23 14:35:33 PDT 2024
================
@@ -632,7 +632,7 @@ llvm::Constant *mlir::LLVM::detail::getLLVMConstant(
llvm::ElementCount::get(numElements, /*Scalable=*/isScalable), child);
if (llvmType->isArrayTy()) {
auto *arrayType = llvm::ArrayType::get(elementType, numElements);
- SmallVector<llvm::Constant *, 8> constants(numElements, child);
+ std::vector<llvm::Constant *> constants(numElements, child);
----------------
joker-eph wrote:
The comment in SmallVectorBase says:
```
/// The template parameter specifies the type which should be used to hold the
/// Size and Capacity of the SmallVector, so it can be adjusted.
/// Using 32 bit size is desirable to shrink the size of the SmallVector.
/// Using 64 bit size is desirable for cases like SmallVector<char>, where a
/// 32 bit size would limit the vector to ~4GB. SmallVectors are used for
/// buffering bitcode output - which can exceed 4GB.
```
And the size is picked with:
```
template <class T>
using SmallVectorSizeType =
std::conditional_t<sizeof(T) < 4 && sizeof(void *) >= 8, uint64_t,
uint32_t>;
```
Unfortunately this isn't something that can be tweaked apparently :(
You're allocating 16GB of memory with this vector, no wonder the test is slow :)
https://github.com/llvm/llvm-project/pull/93230
More information about the Mlir-commits
mailing list