130 lines
3.7 KiB
Markdown
130 lines
3.7 KiB
Markdown
[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.2 simd 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.1 Class 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.1 Class 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*]
|