|
5 | 5 | [](https://github.com/GSI-HPC/simd/actions/workflows/reuse.yml) |
6 | 6 | [](https://fair-software.eu) |
7 | 7 |
|
| 8 | +## Build, install, use? |
| 9 | + |
| 10 | +Parts of this implementation are already integrated into GCC 16. |
| 11 | +If you want to try the development version you can either install this library via: |
| 12 | +```sh |
| 13 | +make prefix=~/.local install |
| 14 | +``` |
| 15 | +or simply point your compiler's include path to this repository. |
| 16 | + |
| 17 | +Alternatively you can also install into the compiler's standard library |
| 18 | +directory: |
| 19 | +```sh |
| 20 | +make install-system |
| 21 | +``` |
| 22 | +There is no support for uninstalling, since `install-system` overwrites the `std::simd` headers of libstdc++. |
| 23 | + |
| 24 | +Build your own project with C++26 (latest GCC, PRs to support Clang are |
| 25 | +welcome). Just include `<simd>` and you're good to go: |
| 26 | +```c++ |
| 27 | +#include <simd> |
| 28 | +``` |
| 29 | + |
| 30 | +To build the tests there are multiple targets available. `make help` will list all of them. |
| 31 | + |
| 32 | +## Feature macros |
| 33 | + |
| 34 | +By default all vectorizable types (including `complex`) are supported. More features can be enabled by defining the following macros: |
| 35 | + |
| 36 | +| Macro | Description | |
| 37 | +|-------|-------------| |
| 38 | +| `VIR_EXTENSIONS` | Enable several optimizations and warnings on guaranteed precondition violations. | |
| 39 | +| `VIR_PATCH_PERMUTE_DYNAMIC` | Implements [simd.permute.dynamic]. | |
| 40 | +| `VIR_PATCH_MATH` | Implements [simd.math]. | |
| 41 | +| `VIR_PATCH_IMPROVE_CX` | Implements `abs` and `norm` for `vec<complex<T>>`. Three different approaches `=1`, `=2`, and `=3` make different optimization/code-gen trade-offs. | |
| 42 | +| `VIR_PATCH_MISSED_OPT` | Enable hand-written instruction selection for optimization patterns the compiler misses. Includes ktest-based mask reductions and pshufb-based type conversions on x86. | |
| 43 | +| `VIR_PATCH_TEST_STORES` | Fix masked stores. | |
| 44 | +| `VIR_CONSTEVAL_BROADCAST` | Use `consteval` broadcast constructor for value-preserving conversions: Either the value doesn't change or the program is ill-formed. Peace of mind. | |
| 45 | + |
8 | 46 | ## Implementation status |
9 | 47 |
|
10 | 48 | | Feature | Status | |
11 | 49 | | ------- | ------ | |
12 | 50 | | [P1928R15](https://wg21.link/P1928R15) std::simd — merge data-parallel types from the Parallelism TS 2 | ✅ done (except math) | |
13 | | -| [P3430R3](https://wg21.link/P3430R3) simd issues: explicit, unsequenced, identity-element position, and members of disabled simd | ✅ done | |
14 | | -| [P3441R2](https://wg21.link/P3441R2) Rename simd_split to simd_chunk | ✅ done | |
15 | | -| [P3287R3](https://wg21.link/P3287R3) Exploration of namespaces for std::simd | ✅ done | |
16 | | -| [P2933R4](https://wg21.link/P2933R4) Extend ⟨bit⟩ header function with overloads for std::simd | ✅ done | |
17 | 51 | | [P2663R7](https://wg21.link/P2663R7) Interleaved complex values support in std::simd | ✅ done (except math) | |
18 | 52 | | [P2664R11](https://wg21.link/P2664R11) Proposal to extend std::simd with permutation API | 🟡 partial | |
19 | 53 | | [P2876R3](https://wg21.link/P2876R3) Proposal to extend std::simd with more constructors and accessors | ✅ done | |
| 54 | +| [P2929R2](https://wg21.link/P2929R2) simd_invoke | 🔴 open (still in design phase) | |
| 55 | +| [P2933R4](https://wg21.link/P2933R4) Extend ⟨bit⟩ header function with overloads for std::simd | ✅ done | |
20 | 56 | | [P2933R4](https://wg21.link/P2933R4) std::simd overloads for `<bit>` header | ✅ done (not optimized) | |
| 57 | +| [P2964R2](https://wg21.link/P2964R2) Allowing user-defined types in std::simd | 🔴 open (still in design phase) | |
| 58 | +| [P3287R3](https://wg21.link/P3287R3) Exploration of namespaces for std::simd | ✅ done | |
| 59 | +| [P3430R3](https://wg21.link/P3430R3) simd issues: explicit, unsequenced, identity-element position, and members of disabled simd | ✅ done | |
| 60 | +| [P3440R2](https://wg21.link/P3440R2) Add n_elements named constructor to std::simd | 🔴 open (still in design phase) | |
| 61 | +| [P3441R2](https://wg21.link/P3441R2) Rename simd_split to simd_chunk | ✅ done | |
21 | 62 | | [P3480R6](https://wg21.link/P3480R6) std::simd is a range | ✅ done | |
22 | 63 | | [P3691R1](https://wg21.link/P3691R1) Reconsider naming of the namespace for 'std::simd' | ✅ done | |
| 64 | +| [P3844R4](https://wg21.link/P3844R4) Reword [simd.math] for consteval conversions | ✅ done | |
23 | 65 | | [P3932R0](https://wg21.link/P3932R0) Fix LWG4470: Fix *integer-from* in [simd] | ✅ done | |
24 | | -| [P4042R0](https://wg21.link/P4042R0) Fix LWG4543: incorrect cast between `simd::vec` and `simd::mask` via conversion to and from impl-defined vector types | ✅ done | |
25 | | -| [P3440R2](https://wg21.link/P3440R2) Add n_elements named constructor to std::simd | 🔴 open (still in design phase) | |
26 | | -| [P2929R2](https://wg21.link/P2929R2) simd_invoke | 🔴 open (still in design phase) | |
27 | | -| [P2964R2](https://wg21.link/P2964R2) Allowing user-defined types in std::simd | 🔴 open (still in design phase) | |
28 | 66 | | [P3973R0](https://wg21.link/P3973R0) bit_cast_as: Element type reinterpretation for std::simd | 🔴 open (still in design phase) | |
29 | 67 | | [P3983R0](https://wg21.link/P3983R0) simd object representation | 🔴 open (still in design phase) | |
30 | 68 | | [P3985R0](https://wg21.link/P3985R0) Concepts for std::simd | 🔴 open (still in design phase) | |
31 | | -| [P3844R4](https://wg21.link/P3844R4) Reword [simd.math] for consteval conversions | ✅ done | |
32 | 69 | | [P4012R1](https://wg21.link/P4012R1) value-preserving consteval broadcast to simd::vec | ✅ done | |
33 | | -| [P4042R0](https://wg21.link/P4042R0) Fix LWG4543: incorrect cast between `simd::vec` and `simd::mask` [...] | ✅ done | |
| 70 | +| [P4042R0](https://wg21.link/P4042R0) Fix LWG4543: incorrect cast between `simd::vec` and `simd::mask` via conversion to and from impl-defined vector types | ✅ done | |
34 | 71 |
|
35 | 72 | | Issue | Status | |
36 | 73 | | ------- | ------ | |
37 | | -| [LWG4385](https://wg21.link/lwg4385) Including `<simd>` doesn't provide `std::begin/end` | ✅ done (via inclusion of `<span>`) | |
38 | | -| [LWG4409](https://wg21.link/lwg4409) Constant expression `ranges::size(r)` Constraints and Mandates in [simd] | 🔴 open | |
39 | | -| [LWG4420](https://wg21.link/lwg4420) §[simd] conversions (constructor, load, stores, gather, and scatter) are incorrectly constrained for `<stdfloat>` types | ✅ done | |
40 | | -| [LWG4470](https://wg21.link/lwg4470) The use of *integer-from*`<Bytes>` all over [simd] is incorrect for `Bytes=sizeof(complex<double>)` | ✅ done ([P3932R0](https://wg21.link/P3932R0)) | |
41 | | -| [LWG4535](https://wg21.link/lwg4535) Disallow user specialization of `<simd>` templates | ✅ done (not actionable) | |
42 | | -| [LWG4414](https://wg21.link/lwg4414) §[simd.expos.abi] *deduce-abi-t* is underspecified and incorrectly referenced from `rebind` and `resize` | ✅ done ([P3932R0](https://wg21.link/P3932R0)) | |
43 | | -| [LWG4412](https://wg21.link/lwg4412) Fix declaration of `zero_element` and `uninit_element` | ✅ done | |
44 | | -| [LWG4238](https://wg21.link/lwg4238) `simd_mask<complex<double>>::operator+/-/~` return a disabled simd specialization | ✅ done | |
| 74 | +| [LWG4230](https://wg21.link/lwg4230) `simd<complex>::real/imag` is overconstrained | ✅ done | |
45 | 75 | | [LWG4231](https://wg21.link/lwg4231) `datapar::chunk<N>` should use *simd-size-type* instead of `size_t` | ✅ done | |
46 | | -| [LWG4518](https://wg21.link/lwg4518) `simd::cat` return type requires inefficient ABI tag change/conversion | ✅ done ([P3932R0](https://wg21.link/P3932R0)) | |
47 | | -| [LWG4413](https://wg21.link/lwg4413) Unused/left-over `simd::alignment` specialization for `basic_mask` | ✅ done | |
48 | 76 | | [LWG4232](https://wg21.link/lwg4232) `datapar::resize` does not resize | ✅ done | |
49 | | -| [LWG4543](https://wg21.link/lwg4543) Incorrect cast between `simd::vec` and `simd::mask` via conversion to and from impl-defined vector types | ✅ done ([P4042R0](https://wg21.link/P4042R0)) | |
50 | | -| [LWG4390](https://wg21.link/lwg4390) `simd::basic_vec(U&&)` default template parameter | ⚪ treated as NAD | |
51 | | -| [LWG4403](https://wg21.link/lwg4403) `simd::basic_vec` CTAD misses difference type casting | ✅ done | |
52 | | -| [LWG4407](https://wg21.link/lwg4407) *constexpr-wrapper-like* needs `remove_cvref_t` in `simd::basic_vec` constructor | ✅ done | |
| 77 | +| [LWG4238](https://wg21.link/lwg4238) `simd_mask<complex<double>>::operator+/-/~` return a disabled simd specialization | ✅ done | |
| 78 | +| [LWG4280](https://wg21.link/lwg4280) `simd::partial_load` uses undefined identifier `T` | 🔴 unclear | |
| 79 | +| [LWG4375](https://wg21.link/lwg4375) `std::simd::bit_ceil` should not be `noexcept` | 🔴 unclear | |
53 | 80 | | [LWG4376](https://wg21.link/lwg4376) ABI tag in return type of [simd.mask.unary] is overconstrained | ✅ done | |
54 | | -| [LWG4230](https://wg21.link/lwg4230) `simd<complex>::real/imag` is overconstrained | ✅ done | |
55 | | -| [LWG4436](https://wg21.link/lwg4436) `simd` broadcast is overconstrained — `std::cw<0.f>` is not convertible to `simd::vec<float16_t>` | 🔴 unclear | |
| 81 | +| [LWG4382](https://wg21.link/lwg4382) The `simd::basic_mask(bool)` overload needs to be more constrained | 🔴 unclear | |
| 82 | +| [LWG4385](https://wg21.link/lwg4385) Including `<simd>` doesn't provide `std::begin/end` | ✅ done (via inclusion of `<span>`) | |
| 83 | +| [LWG4386](https://wg21.link/lwg4386) `std::simd::select(bool c, const T& a, const U& b)` is underconstrained | 🔴 unclear | |
| 84 | +| [LWG4390](https://wg21.link/lwg4390) `simd::basic_vec(U&&)` default template parameter | ⚪ treated as NAD | |
56 | 85 | | [LWG4391](https://wg21.link/lwg4391) Ambiguities of `simd::basic_vec` constructor | 🔴 unclear | |
57 | | -| [LWG4408](https://wg21.link/lwg4408) Hardening `simd::vec::operator[]` | 🔴 unclear | |
58 | 86 | | [LWG4392](https://wg21.link/lwg4392) `simd::unchecked_load` misses difference type casting | 🔴 unclear | |
59 | | -| [LWG4394](https://wg21.link/lwg4394) `simd::unchecked_load(I first, S last)` construct `span` maybe ill-formed | 🔴 unclear | |
60 | | -| [LWG4280](https://wg21.link/lwg4280) `simd::partial_load` uses undefined identifier `T` | 🔴 unclear | |
61 | 87 | | [LWG4393](https://wg21.link/lwg4393) `simd::unchecked_scatter_to` is underconstrained | 🔴 unclear | |
62 | | -| [LWG4386](https://wg21.link/lwg4386) `std::simd::select(bool c, const T& a, const U& b)` is underconstrained | 🔴 unclear | |
63 | | -| [LWG4375](https://wg21.link/lwg4375) `std::simd::bit_ceil` should not be `noexcept` | 🔴 unclear | |
| 88 | +| [LWG4394](https://wg21.link/lwg4394) `simd::unchecked_load(I first, S last)` construct `span` maybe ill-formed | 🔴 unclear | |
64 | 89 | | [LWG4402](https://wg21.link/lwg4402) List-initialization of iterators in [simd.mask.overview] | 🔴 unclear | |
65 | | -| [LWG4382](https://wg21.link/lwg4382) The `simd::basic_mask(bool)` overload needs to be more constrained | 🔴 unclear | |
66 | | - |
67 | | - |
68 | | -## Build, install, use? |
69 | | - |
70 | | -This implementation is not intended for use yet. Nevertheless, it should be |
71 | | -usable for experimenting. There is very simple build system support for |
72 | | -installation via: |
73 | | -```sh |
74 | | -make prefix=~/.local install |
75 | | -``` |
76 | | -But you can also just point your compiler's include path to this repository |
77 | | -instead. |
78 | | - |
79 | | -Alternatively you can also install into the compiler's standard library |
80 | | -directory: |
81 | | -```sh |
82 | | -make install-system |
83 | | -``` |
84 | | -You can uninstall again with: |
85 | | -```sh |
86 | | -make uninstall-system |
87 | | -``` |
88 | | - |
89 | | -Build your own project with C++26 (latest GCC, PRs to support Clang are |
90 | | -welcome). Just include `<simd>` and you're good to go: |
91 | | -```c++ |
92 | | -#include <simd> |
93 | | -``` |
94 | | - |
95 | | -To build the tests there are multiple targets available. `make help` will list |
96 | | -all of them. |
97 | | - |
| 90 | +| [LWG4403](https://wg21.link/lwg4403) `simd::basic_vec` CTAD misses difference type casting | ✅ done | |
| 91 | +| [LWG4407](https://wg21.link/lwg4407) *constexpr-wrapper-like* needs `remove_cvref_t` in `simd::basic_vec` constructor | ✅ done | |
| 92 | +| [LWG4408](https://wg21.link/lwg4408) Hardening `simd::vec::operator[]` | 🔴 unclear | |
| 93 | +| [LWG4409](https://wg21.link/lwg4409) Constant expression `ranges::size(r)` Constraints and Mandates in [simd] | 🔴 open | |
| 94 | +| [LWG4412](https://wg21.link/lwg4412) Fix declaration of `zero_element` and `uninit_element` | ✅ done | |
| 95 | +| [LWG4413](https://wg21.link/lwg4413) Unused/left-over `simd::alignment` specialization for `basic_mask` | ✅ done | |
| 96 | +| [LWG4414](https://wg21.link/lwg4414) §[simd.expos.abi] *deduce-abi-t* is underspecified and incorrectly referenced from `rebind` and `resize` | ✅ done ([P3932R0](https://wg21.link/P3932R0)) | |
| 97 | +| [LWG4420](https://wg21.link/lwg4420) §[simd] conversions (constructor, load, stores, gather, and scatter) are incorrectly constrained for `<stdfloat>` types | ✅ done | |
| 98 | +| [LWG4436](https://wg21.link/lwg4436) `simd` broadcast is overconstrained — `std::cw<0.f>` is not convertible to `simd::vec<float16_t>` | 🔴 unclear | |
| 99 | +| [LWG4470](https://wg21.link/lwg4470) The use of *integer-from*`<Bytes>` all over [simd] is incorrect for `Bytes=sizeof(complex<double>)` | ✅ done ([P3932R0](https://wg21.link/P3932R0)) | |
| 100 | +| [LWG4518](https://wg21.link/lwg4518) `simd::cat` return type requires inefficient ABI tag change/conversion | ✅ done ([P3932R0](https://wg21.link/P3932R0)) | |
| 101 | +| [LWG4535](https://wg21.link/lwg4535) Disallow user specialization of `<simd>` templates | ✅ done (not actionable) | |
| 102 | +| [LWG4543](https://wg21.link/lwg4543) Incorrect cast between `simd::vec` and `simd::mask` via conversion to and from impl-defined vector types | ✅ done ([P4042R0](https://wg21.link/P4042R0)) | |
0 commit comments