P2929R2 — Proposal to add simd_invoke to std::simd
(9 items)
LEWG
This paper proposes adding a `simd::chunked_invoke` function to the C++ standard library's `std::simd` facility. The function accepts a callable and one or more `basic_vec` or `basic_mask` arguments, decomposes each argument into native-register-sized chunks using `simd::chunk`, invokes the callable on corresponding chunks (optionally passing the chunk index), and reassembles the results via `simd::cat`. This simplifies the boilerplate required to apply target-specific SIMD intrinsics to `basic_vec` values that span multiple hardware registers.
- Section 5.3, Returns clause [simd.chunked.invoke] — 'return nothing' is not established standardese; Returns clauses in the C++ standard use the form 'Returns: expression.' and handle the void case via Effects or by omitting the Returns clause entirely. [3] [1]
-
Section 4, lambda in 19-element example — basic_vec
::size is missing function-call parentheses; size is a static constexpr member function and requires () to yield the integer value. The paper's own earlier code uses the correct form vec ::size(). [2] [2] - Section 3, code example for twice-register-size basic_vec — Structured bindings use curly braces (auto {lowA, highA}) instead of the required square brackets (auto [lowA, highA]); the paper's own Before/After table uses the correct syntax. [3]
- Title — Title says 'simd_invoke' but the function was renamed to 'chunked_invoke' in this revision per the revision history. [1] [4]
- Section 4, before the Before/After table — 'chunked_invoked' is a misspelling of the function name 'chunked_invoke' (extra trailing 'd'). [5]
- Section 3, first sentence — 'std:simd' uses a single colon instead of the scope resolution operator '::'. [6]
- Section 4, before the Before/After table — 'Let's look how' is missing the preposition 'at'; should be 'Let's look at how'. [7]
References — Anthropic Citations API
[1]
chars 0–469
"# P2929R2Proposal to add simd_invoke to std::simd ## Draft Proposal, 2026-01-26 This version: http://wg21.link/D2929R2.html Authors: Daniel Towner (Intel) Ruslan Arutyunyan..."
"# P2929R2Proposal to add simd_invoke to std::simd ## Draft Proposal, 2026-01-26 This version: http://wg21.link/D2929R2.html Authors: Daniel Towner (Intel) Ruslan Arutyunyan..."
[2]
"auto {lowA, highA} = chunk>(a); auto {lowB, highB} = chunk>(b);"
"auto {lowA, highA} = chunk
[3]
"Although std:simd has been carefully crafted to include APIs which access all of the common or desirable features of SIMD instruction sets"
"Although std:simd has been carefully crafted to include APIs which access all of the common or desirable features of SIMD instruction sets"
[4]
"Let's look how the example from § 3 Background looks like with chunked_invoked applied"
"Let's look how the example from § 3 Background looks like with chunked_invoked applied"
[5]
chars 11552–12065
"auto do_native = [](basic_vec lhs, basic_vec rhs) {
if constexpr (basic_vec::size <= 4)
return vec
"auto do_native = []
[5]
chars 11552–12065
"auto do_native = [](basic_vec lhs, basic_vec rhs) {
if constexpr (basic_vec::size <= 4)
return vec
"auto do_native = []
[6]
"Let's look how the example from § 3 Background looks like with chunked_invoked applied"
"Let's look how the example from § 3 Background looks like with chunked_invoked applied"
[7]
chars 21468–21571
"Returns: If the Callable function has a void return, return nothing, otherwise return cat(Result). "
"Returns: If the Callable function has a void return, return nothing, otherwise return cat(Result). "
Summary: P2929R2 proposes a function chunked_invoke (renamed from simd_invoke in prior revisions) that splits a std::simd object into native-sized chunks, invokes a user-provided callable on each chunk, and concatenates the results. The paper provides wording for inclusion in the simd header.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.