aphrodite_collective_builder.cuh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "cutlass/gemm/collective/collective_builder.hpp"
  3. namespace cutlass::gemm::collective {
  4. using namespace cute;
  5. //
  6. // APHRODITECollectiveBuilder is a wrapper around CollectiveBuilder that allows
  7. // for for custom kernel tags, allowing you to build custom collectives. Without
  8. // touching the cutlass library headers, using `CutlassKernelTag` will mean it
  9. // will resort to using the standard cutlass collective builder.
  10. //
  11. // Use the default Cutlass collective builder, i.e. use an unmodified cutless
  12. // collective
  13. struct CutlassKernelTag {};
  14. template <class KernelTag, class ArchTag, class OpClass, class ElementA,
  15. class GmemLayoutA, int AlignmentA, class ElementB, class GmemLayoutB,
  16. int AlignmentB, class ElementAccumulator, class TileShape_MNK,
  17. class ClusterShape_MNK, class StageCountType,
  18. class KernelScheduleType, class Enable = void>
  19. struct APHRODITECollectiveBuilder {
  20. static_assert(sizeof(ElementA) == 0,
  21. "Could not build a collective for given parameters.");
  22. };
  23. template <class ArchTag, class OpClass, class ElementA, class GmemLayoutA,
  24. int AlignmentA, class ElementB, class GmemLayoutB, int AlignmentB,
  25. class ElementAccumulator, class TileShape_MNK, class ClusterShape_MNK,
  26. class StageCountType, class KernelScheduleType>
  27. struct APHRODITECollectiveBuilder<
  28. CutlassKernelTag, ArchTag, OpClass, ElementA, GmemLayoutA, AlignmentA,
  29. ElementB, GmemLayoutB, AlignmentB, ElementAccumulator, TileShape_MNK,
  30. ClusterShape_MNK, StageCountType, KernelScheduleType> {
  31. using CollectiveOp = typename CollectiveBuilder<
  32. ArchTag, OpClass, ElementA, GmemLayoutA, AlignmentA, ElementB,
  33. GmemLayoutB, AlignmentB, ElementAccumulator, TileShape_MNK,
  34. ClusterShape_MNK, StageCountType, KernelScheduleType>::CollectiveOp;
  35. };
  36. }; // namespace cutlass::gemm::collective