simplify generate_tuple (#2043)

[ROCm/composable_kernel commit: 6ce0797dad]
This commit is contained in:
Max Podkorytov
2025-04-08 09:00:51 -07:00
committed by GitHub
parent 6dbaeb5fe8
commit 26724086f3
3 changed files with 29 additions and 4 deletions

View File

@@ -396,11 +396,16 @@ struct tuple_array_impl<T, 1>
};
} // namespace impl
template <typename F, index_t... ids>
CK_TILE_HOST_DEVICE constexpr auto generate_tuple_for(F&& f, sequence<ids...>)
{
return make_tuple(f(number<ids>{})...);
}
template <typename F, index_t N>
CK_TILE_HOST_DEVICE constexpr auto generate_tuple(F&& f, number<N>)
{
return unpack([&f](auto&&... is) { return make_tuple(f(is)...); },
typename arithmetic_sequence_gen<0, N, 1>::type{});
return generate_tuple_for(f, make_index_sequence<N>{});
}
template <typename F, index_t N>