Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permute(T, idx_perm) overload #63

Open
mattkretz opened this issue May 10, 2023 · 2 comments
Open

permute(T, idx_perm) overload #63

mattkretz opened this issue May 10, 2023 · 2 comments
Assignees
Labels
exploration New feature or request to be explored

Comments

@mattkretz
Copy link
Owner

We need to consider an overload like

  template <std::size_t N = 0, vir::vectorizable T, detail::index_permutation_function<V> F>
    constexpr
    std::conditional_t<N <= 1, T, stdx::resize_simd_t<N, stdx::simd<T>>>
    permute(T const& v, F const idx_perm) noexcept

I.e. take a non-simd but vectorizable scalar + index permutation lambda. Produce a scalar or possibly a simd.

Rationale: generic code?

@mattkretz mattkretz added the exploration New feature or request to be explored label May 10, 2023
@mattkretz mattkretz added this to the P2664R3 (permute) milestone May 10, 2023
@mattkretz
Copy link
Owner Author

Hmm, I suspect LEWG will ask for a rename to simd_permute unless we make it even more generic? Like permute(std::array, ...) etc. (e.g. permute(iota_v<std::array<int, 4>>, permutations::reverse) yields {3, 2, 1, 0} as a constant expression).
Maybe the paper should ask whether there's interest in exploring a generalization? Otherwise stick with simd<T> and possibly T.

@mattkretz
Copy link
Owner Author

No, let's stick with "simd permute" to avoid any ambiguity wrt the return type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exploration New feature or request to be explored
Projects
Status: No status
Development

No branches or pull requests

2 participants