This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4231. datapar::chunk<N> should use simd-size-type instead of size_t

Section: 29.10.3 [simd.syn], 29.10.7.8 [simd.creation] Status: New Submitter: Matthias Kretz Opened: 2025-03-22 Last modified: 2025-03-22

Priority: Not Prioritized

View all issues with New status.

Discussion:

All index values and simd widths in subclause "Data-parallel types" use the type simd-size-type. Specifically, the NTTP of std::datapar::resize uses simd-size-type and std::datapar::chunk is "implemented" using std::datapar::resize.

For chunk<N>, N is of type size_t and needs to be converted to simd-size-type in the effects clause where it is passed to resize. The NTTP of chunk should use simd-size-type instead of size_t.

Proposed resolution:

This wording is relative to N5008.

  1. Modify 29.10.3 [simd.syn], header <simd> synopsis, as indicated:

    namespace std::datapar {
      […]
      template<simd-size-typesize_t N, class T, class Abi>
        constexpr auto chunk(const basic_simd<T, Abi>& x) noexcept;
      template<simd-size-typesize_t N, size_t Bytes, class Abi>
        constexpr auto chunk(const basic_simd_mask<Bytes, Abi>& x) noexcept;
      […]
    }
    
  2. Modify 29.10.7.8 [simd.creation] as indicated:

    template<simd-size-typesize_t N, class T, class Abi>
      constexpr auto chunk(const basic_simd<T, Abi>& x) noexcept;
    

    -4- Effects: Equivalent to: return chunk<resize_t<N, basic_simd<T, Abi>>>(x);

    template<simd-size-typesize_t N, size_t Bytes, class Abi>
      constexpr auto chunk(const basic_simd_mask<Bytes, Abi>& x) noexcept;
    

    -5- Effects: Equivalent to: return chunk<resize_t<N, basic_simd_mask<Bytes, Abi>>>(x);