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

Function compact

include/cute/stride.hpp:292–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290// Return (result, current * product(shape)) to enable recurrence
291template <class Major, class Shape, class Current>
292CUTE_HOST_DEVICE constexpr
293auto
294compact(Shape const& shape,
295 Current const& current)
296{
297 if constexpr (is_tuple<Shape>::value) { // Shape::tuple Current::int
298 using Lambda = CompactLambda<Major>; // Append or Prepend
299 using Seq = typename Lambda::template seq<Shape>; // Seq or RSeq
300 return cute::detail::fold(shape, cute::make_tuple(cute::make_tuple(), current), Lambda{}, Seq{});
301 } else { // Shape::int Current::int
302 if constexpr (is_constant<1, Shape>::value) {
303 return cute::make_tuple(Int<0>{}, current); // If current is dynamic, this could save a reg
304 } else {
305 return cute::make_tuple(current, current * shape);
306 }
307 }
308
309 CUTE_GCC_UNREACHABLE;
310}
311
312// For GCC8.5 -- Specialization LayoutLeft
313template <>

Callers

nothing calls this directly

Calls 1

foldFunction · 0.85

Tested by

no test coverage detected