mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-14 10:09:41 +00:00
add a fast compilation path for static for (0..N) (#2005)
* add a fast compilation path for static for (0..N)
* Update functional2.hpp
add comment and put range applier into detail namespace
* Update functional.hpp
ditto for ck-tile
* prettify
* prettify more
* add comment
* clang-format
[ROCm/composable_kernel commit: c59a8bb206]
This commit is contained in:
@@ -46,4 +46,28 @@ struct static_for
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T, T... Is>
|
||||
struct applier
|
||||
{
|
||||
template <typename F>
|
||||
__host__ __device__ constexpr void operator()(F f) const
|
||||
{
|
||||
// tweak -fbracket-depth if compilation fails. Clang default limit is 256
|
||||
(f(Number<Is>{}), ...);
|
||||
}
|
||||
};
|
||||
|
||||
template <int32_t Size> // == sizeof...(Is)
|
||||
using make_applier = __make_integer_seq<applier, index_t, Size>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <index_t N>
|
||||
struct static_for<0, N, 1> : detail::make_applier<N>
|
||||
{
|
||||
using detail::make_applier<N>::operator();
|
||||
};
|
||||
|
||||
} // namespace ck
|
||||
|
||||
@@ -58,6 +58,30 @@ struct static_for
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T, T... Is>
|
||||
struct applier
|
||||
{
|
||||
template <typename F>
|
||||
CK_TILE_HOST_DEVICE constexpr void operator()(F f) const
|
||||
{
|
||||
// tweak -fbracket-depth if compilation fails. Clang default limit is 256
|
||||
(f(number<Is>{}), ...);
|
||||
}
|
||||
};
|
||||
|
||||
template <int32_t Size> // == sizeof...(Is)
|
||||
using make_applier = __make_integer_seq<applier, index_t, Size>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <index_t N>
|
||||
struct static_for<0, N, 1> : detail::make_applier<N>
|
||||
{
|
||||
using detail::make_applier<N>::operator();
|
||||
};
|
||||
|
||||
struct identity
|
||||
{
|
||||
template <typename T>
|
||||
|
||||
Reference in New Issue
Block a user