cuda::experimental::coop::composite_mapping#
namespace cuda::experimental::coop {
template <typename... Mappings>
class composite_mapping : public /*group-mapping-interface-for*/<composite_mapping>
{
cuda::std::tuple<Mappings...> /*mappings_*/; // exposition-only
public:
__device__ constexpr composite_mapping(const Mappings&... mappings)
: /*mappings_*/{mappings...}
{}
[[nodiscard]] __device__ constexpr const cuda::std::tuple<Mappings...>& get() const [[lifetimebound]];
};
template <typename... Mappings>
composite_mapping(const Mappings&...) -> composite_mapping<Mappings...>;
template </*mapping-type*/ Lhs, /*mapping-type*/ Rhs>
[[nodiscard]] __device__ constexpr
composite_mapping<Lhs, Rhs> operator|(const Lhs& lhs, const Rhs& rhs)
template <typename... LhsMappings, /*mapping-type*/ Rhs>
[[nodiscard]] __device__ constexpr
composite_mapping<LhsMappings..., Rhs> operator|(const composite_mapping<LhsMappings...>& lhs, const Rhs& rhs);
template </*mapping-type*/ Lhs, typename... RhsMappings>
[[nodiscard]] __device__ constexpr
composite_mapping<Lhs, RhsMappings...> operator|(const Lhs& lhs, const composite_mapping<RhsMappings...>& rhs);
template <typename... LhsMappings, typename... RhsMappings>
[[nodiscard]] __device__ constexpr
composite_mapping<LhsMappings..., RhsMappings...> operator|(const composite_mapping<LhsMappings...>& lhs,
const composite_mapping<RhsMappings...>& rhs);
} // namespace cuda::experimental::coop
Overview#
cuda::experimental::coop::composite_mapping is a mapping that combines multiple mappings together, so they can be used as one during group construction. The type itself shouldn’t be used directly; users should use the pipe operator (|) to merge the mappings instead.
Examples#
#include <cuda/experimental/coop/group>
namespace cudax = cuda::experimental;
__global__ void kernel()
{
// Creates a mapping that groups units from the previous mapping results by 4 and then selects only 3 of those
// threads to return a valid mapping result.
auto m = cudax::coop::group_by{4} | cudax::coop::take{3};
}