cuda::experimental::hierarchy_add_level

Defined in include/cuda/experimental/__hierarchy/hierarchy_dimensions.cuh

template<typename NewLevel, typename Unit, typename ...Levels>
constexpr auto cuda::experimental::hierarchy_add_level(const hierarchy_dimensions_fragment<Unit, Levels...> &hierarchy, NewLevel level)

Add a level to a hierarchy.

This function returns a new hierarchy, that is a copy of the supplied hierarchy with the supplied level added to it. This function will examine the supplied level and add it either at the top or at the bottom of the hierarchy, depending on what levels above and below it are valid for it.

Snippet

#include <cudax/hierarchy_dimensions.cuh>

using namespace cuda::experimental;

auto partial1 = make_hierarchy_fragment<block_level>(grid_dims(256), cluster_dims<4>());
auto hierarchy1 = hierarchy_add_level(partial1, block_dims<8, 8, 8>());
auto partial2 = make_hierarchy_fragment<thread_level>(block_dims<8, 8, 8>(), cluster_dims<4>());
auto hierarchy2 = hierarchy_add_level(partial2, grid_dims(256));
static_assert(cuda::std::is_same_v<decltype(hierarchy1), decltype(hierarchy2)>);