mattkretz / std-simd-feedback

Feedback from simd in the Parallelism TS 2
0 stars 0 forks source link

Dynamic versus static interfaces for insert/extract #38

Closed danieltowner closed 1 year ago

danieltowner commented 1 year ago

There is a proposal to add static insert/extract functions:

extract<_Begin, _End>(v);   // Extract a simd of size (_End - _Begin) from v, starting at index _Begin.
insert<_Begin>(v, child);   // Insert a smaller simd into v at index _Begin, overwriting the values in the range [_Begin, _End]

Since the indexes are known, checking can be performed to ensure the insert/extract ranges are valid.

Investigate whether it is useful to allow the insert/extract positions to be dynamic:

extract<_Size>(v, i);     // Extract a simd of the given size, starting at the given dynamic index.
insert(v, child, i);      // Insert the child into the given position of v, overwriting the existing values.

The size of the insert/extract will always be static, since the simd must have a known size. Only the position could vary dynamically.

Is this useful?

Does it have a performance impact?

How is error handling done?

danieltowner commented 1 year ago

From Issaqoah '23: https://github.com/orgs/cplusplus/projects/12/views/5?pane=issue&itemId=18902808

POLL: Support run-time offsets in insert/extract for the first release that has insert/extract. Outcome: Consensus against.