sequence_helper.hpp Source File

sequence_helper.hpp Source File#

Composable Kernel: sequence_helper.hpp Source File
sequence_helper.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
3
4#pragma once
5
7
8namespace ck {
9
10template <index_t... Is>
11__host__ __device__ constexpr auto make_sequence(Number<Is>...)
12{
13 return Sequence<Is...>{};
14}
15
16// F returns index_t
17template <typename F, index_t N>
18__host__ __device__ constexpr auto generate_sequence(F, Number<N>)
19{
20 return typename sequence_gen<N, F>::type{};
21}
22
23// F returns Number<>
24template <typename F, index_t N>
25__host__ __device__ constexpr auto generate_sequence_v2(F&& f, Number<N>)
26{
27 return unpack([&f](auto&&... xs) { return make_sequence(f(xs)...); },
29}
30
31template <index_t... Is>
32__host__ __device__ constexpr auto to_sequence(Tuple<Number<Is>...>)
33{
34 return Sequence<Is...>{};
35}
36
37} // namespace ck
Definition ck.hpp:268
int32_t index_t
Definition ck.hpp:299
__host__ __device__ constexpr auto to_sequence(Tuple< Number< Is >... >)
Definition sequence_helper.hpp:32
integral_constant< index_t, N > Number
Definition number.hpp:12
__host__ __device__ constexpr auto unpack(F &&f, X &&x)
Definition functional4.hpp:46
__host__ __device__ constexpr auto generate_sequence_v2(F &&f, Number< N >)
Definition sequence_helper.hpp:25
__host__ __device__ constexpr auto make_sequence(Number< Is >...)
Definition sequence_helper.hpp:11
__host__ __device__ constexpr auto generate_sequence(F, Number< N >)
Definition sequence_helper.hpp:18
Definition utility/sequence.hpp:43
Definition utility/tuple.hpp:117
typename conditional< kHasContent, type0, type1 >::type type
Definition utility/sequence.hpp:271
typename sequence_gen_impl< 0, NSize, F >::type type
Definition utility/sequence.hpp:250