Skip to content

[QST] why have Int<2>{} in coalesce_x function when last shape value equal to constant one. #2023

@Shan19900305

Description

@Shan19900305

In function coalesce_x, shape value is using default Int<2>{} when last shape value equal to constant one. Why need to do this?

`
template <class Shape, class Stride>
CUTE_HOST_DEVICE constexpr
auto
coalesce_x(Layout<Shape,Stride> const& layout)
{
auto flat_shape = flatten(layout.shape());
auto flat_stride = flatten(layout.stride());

constexpr int R = decltype(rank(flat_shape))::value;
if constexpr (is_constant<1, decltype(get(flat_shape))>::value) {
return detail::bw_coalesce(flat_shape, flat_stride, Int<2>{}, get(flat_stride));
} else {
return detail::bw_coalesce(flat_shape, flat_stride, get(flat_shape), get(flat_stride));
}
}
`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions