Matthias Kretz [Wednesday, 11 February 2026 16:07:29 CET]:
> Design notes:

I should add one more item:

<simd> is meant to be usable without ODR violations in applications that mix 
TUs compiled with different -m flags (different ISA extensions). Example 
scenario where this is relevant: an application dispatches on CPUID to an 
implementation that doesn't use AVX512, but some TUs were also compiled with 
AVX512 enabled (and not called).

There are two mechanisms for this:

1. Most functions are declared always_inline, thus never emitting a weak 
symbol.

2. Functions that could "get large" should not be always_inline (for 
performance and code size). These are then tagged via an _ArchTraits or 
combined _ArchTraits & _OptTraits template parameter. Thus, the weak symbol 
has a different name depending on compiler flags, avoiding ODR violations. A 
secondary goal here is to be prepared for a future where we can reflect on the 
target / target_clones attribute and dispatch accordingly. Making <simd> 
usable in FMV is also the topic of PR83875.

-- 
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Center for Heavy Ion Research               https://gsi.de
 std::simd
──────────────────────────────────────────────────────────────────────────

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to