Files
cppdraft_translate/cppdraft/simd/expos/abi.md
2025-10-25 03:02:53 +03:00

130 lines
3.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[simd.expos.abi]
# 29 Numerics library [[numerics]](./#numerics)
## 29.10 Data-parallel types [[simd]](simd#expos.abi)
### 29.10.2 Exposition-only types, variables, and concepts [[simd.expos]](simd.expos#abi)
#### 29.10.2.2 simd ABI tags [simd.expos.abi]
[🔗](#itemdecl:1)
`template<class T> using native-abi = see below;
template<class T, simd-size-type N> using deduce-abi-t = see below;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16425)
An [*ABI tag*](#def:ABI_tag "29.10.2.2simd ABI tags[simd.expos.abi]") is a type that indicates a choice of size and binary
representation for objects of data-parallel type[.](#1.sentence-1)
[*Note [1](#note-1)*:
The intent is for the size and binary representation to depend on the target
architecture and compiler flags[.](#1.sentence-2)
The ABI tag, together with a given element type, implies the width[.](#1.sentence-3)
— *end note*]
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16434)
[*Note [2](#note-2)*:
The ABI tag is orthogonal to selecting the machine instruction set[.](#2.sentence-1)
The selected machine instruction set limits the usable ABI tag types, though
(see [[simd.overview]](simd.overview "29.10.7.1Class template basic_­vec overview"))[.](#2.sentence-2)
The ABI tags enable users to safely pass objects of data-parallel type between
translation unit boundaries (e.g., function calls or I/O)[.](#2.sentence-3)
— *end note*]
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16443)
An implementation defines ABI tag types as necessary for the following aliases[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16446)
*deduce-abi-t*<T, N> is defined if
- [(4.1)](#4.1)
T is a vectorizable type,
- [(4.2)](#4.2)
N is greater than zero, and
- [(4.3)](#4.3)
N is not larger than an implementation-defined maximum[.](#4.sentence-1)
The implementation-defined maximum forN is not smaller than 64 and can differ depending on T[.](#4.sentence-2)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16456)
Where present, *deduce-abi-t*<T, N> names an ABI tag type such
that
- [(5.1)](#5.1)
*simd-size-v*<T, *deduce-abi-t*<T, N>> equals N,
- [(5.2)](#5.2)
basic_vec<T, *deduce-abi-t*<T, N>> is
enabled ([[simd.overview]](simd.overview "29.10.7.1Class template basic_­vec overview")), and
- [(5.3)](#5.3)
basic_mask<sizeof(T), *deduce-abi-t*<*integer-from*<sizeof(T)>, N>> is enabled[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16469)
*native-abi*<T> is an implementation-defined alias for an ABI tag[.](#6.sentence-1)
basic_vec<T, *native-abi*<T>> is an enabled specialization[.](#6.sentence-2)
[*Note [3](#note-3)*:
The intent is to use the ABI tag producing the most efficient data-parallel
execution for the element type T on the currently targeted system[.](#6.sentence-3)
For target architectures with ISA extensions, compiler flags can change the type
of the *native-abi*<T> alias[.](#6.sentence-4)
— *end note*]
[*Example [1](#example-1)*:
Consider a target architecture supporting the ABI tags __simd128 and__simd256, where hardware support for __simd256 exists only for
floating-point types[.](#6.sentence-5)
The implementation therefore defines *native-abi*<T> as an alias
for
- [(6.1)](#6.1)
__simd256 if T is a floating-point type, and
- [(6.2)](#6.2)
__simd128 otherwise[.](#6.sentence-6)
— *end example*]