MCPcopy Create free account
hub / github.com/NVIDIA/cutlass / compact_order

Function compact_order

include/cute/stride.hpp:410–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408// @pre is_static<RefOrder>
409template <class Shape, class Order, class RefShape, class RefOrder>
410CUTE_HOST_DEVICE constexpr
411auto
412compact_order(Shape const& shape, Order const& order,
413 RefShape const& ref_shape, RefOrder const& ref_order)
414{
415 if constexpr (is_tuple<Order>::value) {
416 static_assert(tuple_size<Shape>::value == tuple_size<Order>::value, "Need equal rank of shape and order");
417 return transform(shape, order, [&](auto const& s, auto const& o) { return compact_order(s, o, ref_shape, ref_order); });
418 } else {
419 // Compute the starting stride for this shape by accumulating all shapes corresponding to lesser orders
420 auto stride_start = product(transform(ref_shape, ref_order,
421 [&](auto const& s, auto const& o) {
422 return conditional_return(o < order, s, Int<1>{});
423 }));
424 return compact_col_major(shape, stride_start);
425 }
426
427 CUTE_GCC_UNREACHABLE;
428}
429
430} // end namespace detail
431

Callers 2

make_ordered_layoutFunction · 0.85
make_layout_likeFunction · 0.85

Calls 9

conditional_returnFunction · 0.85
compact_col_majorFunction · 0.85
foldFunction · 0.85
product_likeFunction · 0.70
rankFunction · 0.70
unflattenFunction · 0.70
transformFunction · 0.50
productFunction · 0.50
flatten_to_tupleFunction · 0.50

Tested by

no test coverage detected