Skip to content

[Support] Use explicit inline element count for AccelerationStructureDescs SmallVectors#1252

Merged
bogner merged 1 commit into
llvm:mainfrom
Traverse-Research:blasdesc-smallvector-default-inline
May 29, 2026
Merged

[Support] Use explicit inline element count for AccelerationStructureDescs SmallVectors#1252
bogner merged 1 commit into
llvm:mainfrom
Traverse-Research:blasdesc-smallvector-default-inline

Conversation

@MarijnS95

Copy link
Copy Markdown
Collaborator

Problem

AccelerationStructureDescs declares its lists with the default SmallVector inline element count:

struct AccelerationStructureDescs {
  llvm::SmallVector<BLASDesc> BLAS;
  llvm::SmallVector<TLASDesc> TLAS;
};

BLASDesc holds a std::string plus two further default-inlined SmallVectors (Triangles, AABBs), so its size compounds. Under MSVC's debug STL (/MDd, _ITERATOR_DEBUG_LEVEL=2), std::string and the nested inline storage grow enough that sizeof(BLASDesc) exceeds 256 bytes, tripping LLVM's assertion in CalculateSmallVectorDefaultInlinedElements:

You are trying to use a default number of inlined elements for SmallVector<T> but sizeof(T) is really big! Please use an explicit number of inlined elements with SmallVector<T, N> ...

This breaks any Debug build with MSVC on Windows (Pipeline.h is included widely). Release / RelWithDebInfo builds -- including CI -- keep the types under the limit, so the failure isn't visible there.

Fix

Give the lists an explicit inline element count, as the assertion recommends. Only BLASDesc trips the assert today; TLASDesc has the same shape and sits just under the threshold, so it gets the same treatment for consistency and to avoid a latent break when fields are added. No functional change -- this only sets inline storage capacity.

…Descs SmallVectors

BLASDesc and TLASDesc each hold a std::string plus default-inlined
SmallVectors of large element types. In MSVC Debug builds (/MDd,
_ITERATOR_DEBUG_LEVEL=2) the debug STL inflates std::string, which
cascades through the nested SmallVectors and pushes sizeof(BLASDesc)
past LLVM's CalculateSmallVectorDefaultInlinedElements static_assert
(sizeof(T) <= 256). Release/RelWithDebInfo builds stay under the limit,
which is why CI never caught it.

Specify an explicit inline element count so SmallVector does not try to
derive a default for the oversized element type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bogner

bogner commented May 29, 2026

Copy link
Copy Markdown
Contributor

Merging this to get the post-commit CI green

@bogner bogner merged commit bebdfbd into llvm:main May 29, 2026
23 of 27 checks passed

@V-FEXrt V-FEXrt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MarijnS95 MarijnS95 deleted the blasdesc-smallvector-default-inline branch May 29, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants