21 template <
typename GridwiseGemm,
22 bool HasMainKBlockLoop,
24 typename Block2CTileMap,
25 typename AElementwiseOperation,
26 typename BElementwiseOperation,
27 typename CElementwiseOperation>
29 #if CK_USE_LAUNCH_BOUNDS
33 const Block2CTileMap& b2c_map,
34 const AElementwiseOperation a_element_op,
35 const BElementwiseOperation b_element_op,
36 const CElementwiseOperation c_element_op)
38 #if(!defined(__HIP_DEVICE_COMPILE__) || defined(__gfx908__) || defined(__gfx90a__) || \
40 constexpr
index_t shared_size = GridwiseGemm::GetSharedMemoryNumberOfByte();
42 __shared__ uint8_t p_shared[shared_size];
44 GridwiseGemm::template Run<HasMainKBlockLoop, CGlobalMemoryDataOperation>(
45 karg,
static_cast<void*
>(p_shared), b2c_map, a_element_op, b_element_op, c_element_op);
63 typename AElementwiseOperation,
64 typename BElementwiseOperation,
65 typename CElementwiseOperation,
76 typename ABlockTransferThreadClusterLengths_K0_M_K1,
77 typename ABlockTransferThreadClusterArrangeOrder,
78 typename ABlockTransferSrcAccessOrder,
79 index_t ABlockTransferSrcVectorDim,
80 index_t ABlockTransferSrcScalarPerVector,
81 index_t ABlockTransferDstScalarPerVector_K1,
82 bool AThreadTransferSrcResetCoordinateAfterRun,
84 typename BBlockTransferThreadClusterLengths_K0_N_K1,
85 typename BBlockTransferThreadClusterArrangeOrder,
86 typename BBlockTransferSrcAccessOrder,
87 index_t BBlockTransferSrcVectorDim,
88 index_t BBlockTransferSrcScalarPerVector,
89 index_t BBlockTransferDstScalarPerVector_K1,
90 bool BThreadTransferSrcResetCoordinateAfterRun,
92 index_t CShuffleMRepeatPerShuffle,
93 index_t CShuffleNRepeatPerShuffle,
94 index_t CBlockTransferScalarPerVector_NWaveNPerXDL,
95 typename CBlockTransferClusterLengths_MBlock_MPerBlock_NBlock_NPerBlock,
98 typename ComputeTypeA = FloatC,
99 typename ComputeTypeB = ComputeTypeA,
100 typename LDSTypeA = ComputeTypeA,
101 typename LDSTypeB = ComputeTypeB>
115 static constexpr
auto M01 = 1;
116 static constexpr
auto N01 = 1;
120 MPerBlock, NPerBlock,
K1* K0PerBlock};
125 decltype(GridwiseGemmPipeline_Selector<PipelineVer, NumGemmKPrefetchStage, LoopSched>())>;
145 const FloatB* p_b_grid_,
188 <<
"KB:" <<
k_batch <<
"}" << std::endl;
213 auto K_t = K_Batch * K0PerBlock *
K1;
214 return (K + K_t - 1) / K_t * K0PerBlock;
220 return K_Batch * K0Padded *
K1;
231 const auto a_grid_desc_m_k = [&]() {
307 const auto b_grid_desc_k_n = [&]() {
377 const auto c_grid_desc_m_n = [&]() {
388 return gemm_padder.PadCDescriptor_M_N(c_grid_desc_m_n);
393 constexpr
auto max_lds_align =
K1;
396 constexpr
auto a_k0_m_k1_block_desc = [&]() {
397 if constexpr(ABlockLdsExtraM)
411 constexpr
auto b_k0_n_k1_block_desc = [&]() {
412 if constexpr(BBlockLdsExtraN)
426 constexpr
auto a_block_space_size =
429 constexpr
auto b_block_space_size =
432 constexpr
auto c_block_size =
435 return math::max(a_block_space_size *
sizeof(LDSTypeA) +
436 b_block_space_size *
sizeof(LDSTypeB),
437 c_block_size *
sizeof(FloatC));
447 if(!(karg.
M % MPerBlock == 0))
451 std::cout <<
"Arg M value is not a multiple of MPerBlock! M: " << karg.
M <<
" "
452 << __FILE__ <<
":" << __LINE__ <<
", in function: " << __func__
464 if(!(karg.
N % NPerBlock == 0))
468 std::cout <<
"Arg N value is not a multiple of NPerBlock! N: " << karg.
N <<
" "
469 << __FILE__ <<
":" << __LINE__ <<
", in function: " << __func__
482 auto K_t = karg.
k_batch * K0PerBlock *
K1;
483 if(!(karg.
K % K_t == 0))
487 std::cout <<
"Arg K value is not a multiple of K_Batch * K0PerBlock * K1! K: "
488 << karg.
K <<
" " << __FILE__ <<
":" << __LINE__
489 <<
", in function: " << __func__ << std::endl;
497 if(karg.
K % ABlockTransferSrcScalarPerVector != 0)
501 std::cout <<
"Arg K (" << karg.
K
502 <<
") value is not a multiple of ABlockTransferSrcScalarPerVector ("
503 << ABlockTransferSrcScalarPerVector <<
" )! " << __FILE__ <<
":"
504 << __LINE__ <<
", in function: " << __func__ << std::endl;
511 if(karg.
M % ABlockTransferSrcScalarPerVector != 0)
515 std::cout <<
"Arg M (" << karg.
M
516 <<
") value is not a multiple of ABlockTransferSrcScalarPerVector ("
517 << ABlockTransferSrcScalarPerVector <<
" )! " << __FILE__ <<
":"
518 << __LINE__ <<
", in function: " << __func__ << std::endl;
526 if(karg.
N % BBlockTransferSrcScalarPerVector != 0)
530 std::cout <<
"Arg N (" << karg.
N
531 <<
") value is not a multiple of BBlockTransferSrcScalarPerVector ("
532 << BBlockTransferSrcScalarPerVector <<
" )! " << __FILE__ <<
":"
533 << __LINE__ <<
", in function: " << __func__ << std::endl;
540 if(karg.
K % BBlockTransferSrcScalarPerVector != 0)
544 std::cout <<
"Arg K (" << karg.
K
545 <<
") value is not a multiple of BBlockTransferSrcScalarPerVector ("
546 << BBlockTransferSrcScalarPerVector <<
" )! " << __FILE__ <<
":"
547 << __LINE__ <<
", in function: " << __func__ << std::endl;
555 if(karg.
N % CBlockTransferScalarPerVector_NWaveNPerXDL != 0)
559 std::cout <<
"Arg N (" << karg.
N
560 <<
") value is not a multiple of "
561 "CBlockTransferScalarPerVector_NWaveNPerXDL ("
562 << CBlockTransferScalarPerVector_NWaveNPerXDL <<
" )! " << __FILE__
563 <<
":" << __LINE__ <<
", in function: " << __func__ << std::endl;
570 if(karg.
M % CBlockTransferScalarPerVector_NWaveNPerXDL != 0)
574 std::cout <<
"Arg M (" << karg.
M
575 <<
") value is not a multiple of "
576 "CBlockTransferScalarPerVector_NWaveNPerXDL ("
577 << CBlockTransferScalarPerVector_NWaveNPerXDL <<
" )! " << __FILE__
578 <<
":" << __LINE__ <<
", in function: " << __func__ << std::endl;
584 const auto num_k_loop = karg.
K0Padded / K0PerBlock;
585 if(!GridwiseGemmPipe::IsSupported(num_k_loop))
589 std::cout <<
"The number of k loops (" << num_k_loop
590 <<
") value is not supported by GridwiseGemm Pipeline."
591 <<
" K0Padded: " << karg.
K0Padded <<
", K0PerBlock: " << K0PerBlock <<
" "
592 << __FILE__ <<
":" << __LINE__ <<
", in function: " << __func__
605 const index_t KPad = KBatch * K0Padded *
K1;
611 const index_t num_loop = K0Padded / K0PerBlock;
612 return GridwiseGemmPipe::CalculateHasMainLoop(num_loop);
615 template <
typename CGr
idDesc>
616 __host__ __device__
static constexpr
auto
619 const auto M = c_m_n_grid_desc.GetLength(
I0);
620 const auto N = c_m_n_grid_desc.GetLength(
I1);
622 const auto MBlock = M / MPerBlock;
623 const auto NBlock = N / NPerBlock;
634 template <
typename CGr
idDesc>
639 c_m_n_grid_desc, 8, KBatch);
642 __host__ __device__
static constexpr
auto
645 constexpr
index_t MWave = MPerBlock / (MRepeat * MPerXDL);
646 constexpr
index_t NWave = NPerBlock / (NRepeat * NPerXDL);
664 template <
bool HasMainKBlockLoop,
666 typename Block2CTileMap>
668 void* __restrict__ p_shared_block,
669 const Block2CTileMap& block_2_ctile_map,
670 const AElementwiseOperation a_element_op = AElementwiseOperation{},
671 const BElementwiseOperation b_element_op = BElementwiseOperation{},
672 const CElementwiseOperation c_element_op = CElementwiseOperation{})
674 const FloatA* p_a_grid = karg.
p_a_grid;
675 const FloatB* p_b_grid = karg.
p_b_grid;
683 const auto c_grid_desc_mblock_mperblock_nblock_nperblock =
686 const auto a_grid_buf = make_dynamic_buffer<AddressSpaceEnum::Global>(
687 p_a_grid, a_b_k0_m_k1_grid_desc.GetElementSpaceSize());
688 const auto b_grid_buf = make_dynamic_buffer<AddressSpaceEnum::Global>(
689 p_b_grid, b_b_k0_n_k1_grid_desc.GetElementSpaceSize());
690 auto c_grid_buf = make_dynamic_buffer<AddressSpaceEnum::Global>(
691 p_c_grid, c_grid_desc_mblock_mperblock_nblock_nperblock.GetElementSpaceSize());
694 const auto block_work_idx =
697 if(!block_2_ctile_map.ValidCTileIndex(
699 make_tuple(c_grid_desc_mblock_mperblock_nblock_nperblock.GetLength(
I0),
700 c_grid_desc_mblock_mperblock_nblock_nperblock.GetLength(
I2))))
705 const index_t block_m_id = __builtin_amdgcn_readfirstlane(block_work_idx[
I1]);
706 const index_t block_n_id = __builtin_amdgcn_readfirstlane(block_work_idx[
I2]);
707 const index_t k_batch_id = __builtin_amdgcn_readfirstlane(block_work_idx[
I0]);
710 const index_t m_block_data_idx_on_grid =
711 __builtin_amdgcn_readfirstlane(block_m_id * MPerBlock);
713 const index_t n_block_data_idx_on_grid =
714 __builtin_amdgcn_readfirstlane(block_n_id * NPerBlock);
717 constexpr
auto max_lds_align =
K1;
720 constexpr
auto a_k0_m_k1_block_desc = [&]() {
721 if constexpr(ABlockLdsExtraM)
724 make_tuple(Number<K0PerBlock>{}, Number<MPerBlock>{},
K1),
730 make_tuple(Number<K0PerBlock>{}, Number<MPerBlock>{},
K1), max_lds_align);
734 constexpr
auto a_b_k0_m_k1_block_desc = [&]() {
735 if constexpr(ABlockLdsExtraM)
738 make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<MPerBlock>{},
K1),
739 make_tuple(Number<K0PerBlock>{} * Number<MPerBlock + 1>{} *
K1,
740 Number<MPerBlock + 1>{} *
K1,
747 make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<MPerBlock>{},
K1),
752 constexpr
auto b_k0_n_k1_block_desc = [&]() {
753 if constexpr(BBlockLdsExtraN)
756 make_tuple(Number<K0PerBlock>{}, Number<NPerBlock>{},
K1),
762 make_tuple(Number<K0PerBlock>{}, Number<NPerBlock>{},
K1), max_lds_align);
766 constexpr
auto b_b_k0_n_k1_block_desc = [&]() {
767 if constexpr(BBlockLdsExtraN)
770 make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<NPerBlock>{},
K1),
771 make_tuple(Number<K0PerBlock>{} * Number<NPerBlock + 1>{} *
K1,
772 Number<NPerBlock + 1>{} *
K1,
779 make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<NPerBlock>{},
K1),
784 auto a_blockwise_copy =
786 AElementwiseOperation,
789 Sequence<1, K0PerBlock, MPerBlock, K1>,
790 ABlockTransferThreadClusterLengths_K0_M_K1,
791 ABlockTransferThreadClusterArrangeOrder,
794 decltype(a_b_k0_m_k1_grid_desc),
795 decltype(a_b_k0_m_k1_block_desc),
796 ABlockTransferSrcAccessOrder,
797 Sequence<0, 2, 1, 3>,
798 ABlockTransferSrcVectorDim,
800 ABlockTransferSrcScalarPerVector,
801 ABlockTransferDstScalarPerVector_K1,
804 AThreadTransferSrcResetCoordinateAfterRun,
806 a_b_k0_m_k1_grid_desc,
809 a_b_k0_m_k1_block_desc,
814 auto b_blockwise_copy =
816 BElementwiseOperation,
819 Sequence<1, K0PerBlock, NPerBlock, K1>,
820 BBlockTransferThreadClusterLengths_K0_N_K1,
821 BBlockTransferThreadClusterArrangeOrder,
824 decltype(b_b_k0_n_k1_grid_desc),
825 decltype(b_b_k0_n_k1_block_desc),
826 BBlockTransferSrcAccessOrder,
827 Sequence<0, 2, 1, 3>,
828 BBlockTransferSrcVectorDim,
830 BBlockTransferSrcScalarPerVector,
831 BBlockTransferDstScalarPerVector_K1,
834 BThreadTransferSrcResetCoordinateAfterRun,
836 b_b_k0_n_k1_grid_desc,
839 b_b_k0_n_k1_block_desc,
856 decltype(a_k0_m_k1_block_desc),
857 decltype(b_k0_n_k1_block_desc),
867 auto c_thread_buf = blockwise_gemm.GetCThreadBuffer();
870 constexpr
auto a_block_space_size =
873 auto p_a_block =
reinterpret_cast<LDSTypeA*
>(p_shared_block);
874 auto p_b_block =
reinterpret_cast<LDSTypeB*
>(p_a_block + a_block_space_size);
876 constexpr
auto a_block_slice_copy_step =
make_multi_index(0, K0PerBlock, 0, 0);
877 constexpr
auto b_block_slice_copy_step =
make_multi_index(0, K0PerBlock, 0, 0);
879 auto a_block_buf = make_dynamic_buffer<AddressSpaceEnum::Lds>(
880 p_a_block, a_k0_m_k1_block_desc.GetElementSpaceSize());
881 auto b_block_buf = make_dynamic_buffer<AddressSpaceEnum::Lds>(
882 p_b_block, b_k0_n_k1_block_desc.GetElementSpaceSize());
885 const index_t num_k_block_main_loop = __builtin_amdgcn_readfirstlane(
886 (a_b_k0_m_k1_grid_desc.GetLength(
I1) * a_b_k0_m_k1_grid_desc.GetLength(
I3)) /
891 gridwise_gemm_pipeline.template Run<HasMainKBlockLoop>(a_b_k0_m_k1_grid_desc,
892 a_b_k0_m_k1_block_desc,
896 a_block_slice_copy_step,
897 b_b_k0_n_k1_grid_desc,
898 b_b_k0_n_k1_block_desc,
902 b_block_slice_copy_step,
905 num_k_block_main_loop);
909 constexpr
index_t MWave = MPerBlock / (MRepeat * MPerXDL);
910 constexpr
index_t NWave = NPerBlock / (NRepeat * NPerXDL);
912 constexpr
auto c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc =
913 blockwise_gemm.GetCBlockDescriptor_M0_N0_M1_N1_M2_M3_M4_N2();
915 constexpr
auto c_m0_n0_m1_n1_m2_m3_m4_n2_thread_desc =
916 blockwise_gemm.GetCThreadDescriptor_M0_N0_M1_N1_M2_M3_M4_N2();
918 constexpr
auto M0 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I0);
919 constexpr
auto N0 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I1);
920 constexpr
auto M1 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I2);
921 constexpr
auto N1 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I3);
922 constexpr
auto M2 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I4);
923 constexpr
auto M3 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I5);
924 constexpr
auto M4 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I6);
925 constexpr
auto N2 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I7);
927 constexpr
auto c_block_desc_mblock_mperblock_nblock_nperblock =
930 auto c_block_buf = make_dynamic_buffer<AddressSpaceEnum::Lds>(
931 static_cast<FloatC*
>(p_shared_block),
932 c_block_desc_mblock_mperblock_nblock_nperblock.GetElementSpaceSize());
935 c_block_desc_mblock_mperblock_nblock_nperblock,
947 make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}),
949 Sequence<>{}, Sequence<0, 2, 4, 5, 6>{}, Sequence<>{}, Sequence<1, 3, 7>{}));
953 const auto c_thread_mtx_on_block =
954 blockwise_gemm.CalculateCThreadOriginDataIndex(
I0,
I0,
I0,
I0);
956 const index_t m_thread_data_on_block = c_thread_mtx_on_block[
I0];
957 const index_t n_thread_data_on_block = c_thread_mtx_on_block[
I1];
959 const auto m_thread_data_on_block_to_m0_m1_m2_m3_m4_adaptor =
965 const auto m_thread_data_on_block_idx =
966 m_thread_data_on_block_to_m0_m1_m2_m3_m4_adaptor.CalculateBottomIndex(
969 const auto n_thread_data_on_block_to_n0_n1_n2_adaptor =
975 const auto n_thread_data_on_block_idx =
976 n_thread_data_on_block_to_n0_n1_n2_adaptor.CalculateBottomIndex(
980 auto c_thread_copy_vgpr_to_lds =
981 ThreadwiseTensorSliceTransfer_v1r3<FloatAcc,
983 decltype(c_m0_n0_m1_n1_m2_m3_m4_n2_thread_desc),
984 decltype(c_block_desc_m0_n0_m1_n1_m2_m3_m4_n2),
986 Sequence<CShuffleMRepeatPerShuffle,
987 CShuffleNRepeatPerShuffle,
994 Sequence<0, 1, 2, 3, 4, 5, 6, 7>,
1000 c_block_desc_m0_n0_m1_n1_m2_m3_m4_n2,
1003 m_thread_data_on_block_idx[
I1],
1004 n_thread_data_on_block_idx[
I1],
1005 m_thread_data_on_block_idx[
I2],
1006 m_thread_data_on_block_idx[
I3],
1007 m_thread_data_on_block_idx[
I4],
1008 n_thread_data_on_block_idx[
I2]),
1012 auto c_block_copy_lds_to_global = ThreadGroupTensorSliceTransfer_v6r1<
1014 CElementwiseOperation,
1015 CGlobalMemoryDataOperation,
1017 CShuffleMRepeatPerShuffle * MWave * MPerXDL,
1019 CShuffleNRepeatPerShuffle * NWave * NPerXDL>,
1020 CBlockTransferClusterLengths_MBlock_MPerBlock_NBlock_NPerBlock,
1021 Sequence<0, 1, 2, 3>,
1024 decltype(c_block_desc_mblock_mperblock_nblock_nperblock),
1025 decltype(c_grid_desc_mblock_mperblock_nblock_nperblock),
1026 Sequence<0, 1, 2, 3>,
1028 CBlockTransferScalarPerVector_NWaveNPerXDL,
1031 {c_block_desc_mblock_mperblock_nblock_nperblock,
1033 c_grid_desc_mblock_mperblock_nblock_nperblock,
1037 constexpr
auto mxdlperwave_forward_step =
1039 constexpr
auto nxdlperwave_forward_step =
1041 constexpr
auto nxdlperwave_backward_step =
1044 static_for<0, MRepeat, CShuffleMRepeatPerShuffle>{}([&](
auto mxdlperwave_iter) {
1045 constexpr
auto mxdlperwave = mxdlperwave_iter;
1047 static_for<0, NRepeat, CShuffleNRepeatPerShuffle>{}([&](
auto nxdlperwave_iter) {
1048 constexpr
bool nxdlperwave_forward_sweep =
1049 (mxdlperwave % (2 * CShuffleMRepeatPerShuffle) == 0);
1051 constexpr
index_t nxdlperwave_value =
1052 nxdlperwave_forward_sweep
1054 : (NRepeat - nxdlperwave_iter - CShuffleNRepeatPerShuffle);
1056 constexpr
auto nxdlperwave = Number<nxdlperwave_value>{};
1062 c_thread_copy_vgpr_to_lds.Run(
1063 c_m0_n0_m1_n1_m2_m3_m4_n2_thread_desc,
1066 c_block_desc_m0_n0_m1_n1_m2_m3_m4_n2,
1073 c_block_copy_lds_to_global.Run(c_block_desc_mblock_mperblock_nblock_nperblock,
1075 c_grid_desc_mblock_mperblock_nblock_nperblock,
1079 if constexpr(nxdlperwave_forward_sweep &&
1080 (nxdlperwave < NRepeat - CShuffleNRepeatPerShuffle))
1082 c_block_copy_lds_to_global.MoveDstSliceWindow(
1083 c_grid_desc_mblock_mperblock_nblock_nperblock,
1084 nxdlperwave_forward_step);
1086 else if constexpr((!nxdlperwave_forward_sweep) && (nxdlperwave > 0))
1088 c_block_copy_lds_to_global.MoveDstSliceWindow(
1089 c_grid_desc_mblock_mperblock_nblock_nperblock,
1090 nxdlperwave_backward_step);
1095 if constexpr(mxdlperwave < MRepeat - CShuffleMRepeatPerShuffle)
1097 c_block_copy_lds_to_global.MoveDstSliceWindow(
1098 c_grid_desc_mblock_mperblock_nblock_nperblock, mxdlperwave_forward_step);
1106 auto str = std::stringstream();
1109 str <<
"GemmXdlSplitKCShuffle_"
1111 << std::string(ALayout::name)[0]
1112 << std::string(BLayout::name)[0]
1113 << std::string(CLayout::name)[0]
1115 <<
"B" << BlockSize <<
"_"
1116 <<
"Vec" << ABlockTransferSrcScalarPerVector <<
"x"
1117 << BBlockTransferSrcScalarPerVector <<
"x"
1118 << CBlockTransferScalarPerVector_NWaveNPerXDL <<
"_"
1121 << K0PerBlock <<
"x"
#define CK_MIN_BLOCK_PER_CU
Definition: ck.hpp:34
#define CK_MAX_THREAD_PER_BLOCK
Definition: ck.hpp:33
#define CK_ENV(name)
Definition: env.hpp:128
__host__ constexpr __device__ auto integer_least_multiple(X x, Y y)
Definition: math.hpp:78
__host__ constexpr __device__ auto integer_divide_ceil(X x, Y y)
Definition: math.hpp:72
__host__ constexpr __device__ T max(T x)
Definition: math.hpp:84
std::string getGemmSpecializationString(const GemmSpecialization &s)
Definition: gemm_specialization.hpp:33
GemmSpecialization
Definition: gemm_specialization.hpp:11
__host__ constexpr __device__ auto make_multi_index(Xs &&... xs)
Definition: array_multi_index.hpp:15
constexpr auto BlockwiseGemmXdlops_k0mk1_k0nk1_m0n0m1n1m2m3m4n2_Selector()
Definition: blockwise_gemm_xdlops.hpp:606
__host__ constexpr __device__ auto make_naive_tensor_descriptor(const Tuple< Lengths... > &lengths, const Tuple< Strides... > &strides)
Definition: tensor_descriptor_helper.hpp:49
__global__ void kernel_gemm_xdlops_v2r4r2_simplified(typename GridwiseGemm::Argument karg, const Block2CTileMap &b2c_map, const AElementwiseOperation a_element_op, const BElementwiseOperation b_element_op, const CElementwiseOperation c_element_op)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:32
InMemoryDataOperationEnum
Definition: ck.hpp:267
__host__ constexpr __device__ auto make_naive_tensor_descriptor_packed(const Tuple< Lengths... > &lengths)
Definition: tensor_descriptor_helper.hpp:101
__host__ constexpr __device__ auto make_merge_transform(const LowLengths &low_lengths)
Definition: multi_index_transform_helper.hpp:55
__host__ constexpr __device__ auto make_naive_tensor_descriptor_aligned(const Tuple< Lengths... > &lengths, Align align)
Definition: tensor_descriptor_helper.hpp:132
__host__ constexpr __device__ auto make_single_stage_tensor_adaptor(const Transforms &transforms, LowerDimensionOldTopIdss, UpperDimensionNewTopIdss)
Definition: tensor_adaptor.hpp:429
__host__ constexpr __device__ auto make_freeze_transform(const LowerIndex &low_idx)
Definition: multi_index_transform_helper.hpp:98
constexpr detail::ignore_t ignore
Definition: ignore.hpp:20
__device__ index_t get_block_1d_id()
Definition: get_id.hpp:22
bool EnvIsEnabled(EnvVar)
Definition: env.hpp:139
__host__ constexpr __device__ auto make_pass_through_transform(const LowLength &low_length)
Definition: multi_index_transform_helper.hpp:12
__host__ constexpr __device__ auto make_tuple(Xs &&... xs)
Definition: tuple.hpp:211
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Definition: type.hpp:300
__host__ constexpr __device__ auto make_unmerge_transform(const UpLengths &up_lengths, integral_constant< bool, Use24BitIntegerCalculation >=integral_constant< bool, false >{})
Definition: multi_index_transform_helper.hpp:90
LoopScheduler
Definition: loop_scheduler.hpp:15
int32_t index_t
Definition: ck.hpp:289
__host__ constexpr __device__ auto transform_tensor_descriptor(const OldTensorDescriptor &old_tensor_desc, const NewTransforms &new_transforms, NewLowerDimensionOldVisibleIdss, NewUpperDimensionNewVisibleIdss)
Definition: tensor_descriptor.hpp:319
__host__ constexpr __device__ auto make_right_pad_transform(const LowLength &low_length, const RightPadLength &right_pad, integral_constant< bool, SkipIsValidCheck >=integral_constant< bool, false >{})
Definition: multi_index_transform_helper.hpp:37
__device__ void block_sync_lds()
Definition: synchronization.hpp:10
PipelineVersion
Definition: gridwise_gemm_pipeline_selector.hpp:17
constexpr LoopScheduler make_default_loop_scheduler()
Definition: loop_scheduler.hpp:20
Simple tile mapping which creates 3D grid of block of threads.
Definition: block_to_ctile_map.hpp:974
Definition: block_to_ctile_map.hpp:539
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:128
index_t StrideC
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:137
index_t K0Padded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:141
index_t MPadded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:138
index_t k_batch
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:142
index_t N
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:133
const FloatA * p_a_grid
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:129
index_t K
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:134
index_t StrideA
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:135
index_t M
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:132
const FloatB * p_b_grid
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:130
index_t StrideB
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:136
FloatC * p_c_grid
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:131
index_t NPadded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:139
index_t KPadded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:140
Argument(const FloatA *p_a_grid_, const FloatB *p_b_grid_, FloatC *p_c_grid_, index_t M_, index_t N_, index_t K_, index_t StrideA_, index_t StrideB_, index_t StrideC_, index_t MPadded_, index_t NPadded_, index_t KPadded_, index_t K0Padded_, index_t k_batch_)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:144
void Print() const
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:175
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:103
static constexpr auto I2
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:106
static constexpr auto gemm_padder
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:118
__host__ static __device__ auto CalculateGridSize(const Argument &karg)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:192
__host__ static __device__ auto CalculateMPadded(index_t M)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:200
static constexpr auto I5
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:109
remove_cvref_t< decltype(GridwiseGemmPipeline_Selector< PipelineVer, NumGemmKPrefetchStage, LoopSched >())> GridwiseGemmPipe
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:125
__host__ static __device__ auto GetKPad(index_t K, index_t KBatch)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:601
remove_cvref_t< decltype(MakeDefaultBlock2CTileMap())> DefaultBlock2CTileMap
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:662
static constexpr auto K1
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:114
static constexpr auto I1
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:105
static __device__ void Run(const Argument &karg, void *__restrict__ p_shared_block, const Block2CTileMap &block_2_ctile_map, const AElementwiseOperation a_element_op=AElementwiseOperation{}, const BElementwiseOperation b_element_op=BElementwiseOperation{}, const CElementwiseOperation c_element_op=CElementwiseOperation{})
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:667
__host__ static constexpr __device__ auto MakeCGridDesc_MBlock_MPerBlock_NBlock_NPerBlock(const CGridDesc &c_m_n_grid_desc)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:617
__host__ static constexpr __device__ index_t GetSharedMemoryNumberOfByte()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:391
__host__ static constexpr __device__ bool CheckValidity(const Argument &karg)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:440
static constexpr auto I3
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:107
static constexpr auto I7
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:111
__host__ static constexpr __device__ auto GetCBlockDescriptor_MBlock_MPerBlock_NBlock_NPerBlock()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:643
static constexpr auto I6
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:110
__host__ static __device__ auto CalculateNPadded(index_t N)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:205
static constexpr auto N01
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:116
__host__ static __device__ auto MakeAGridDescriptor_KBatch_K0_M_K1(index_t M, index_t MPad, index_t K, index_t StrideA, index_t KBatch, index_t K0Padded, index_t KPad)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:223
__host__ static __device__ auto CalculateK0Padded(index_t K, index_t K_Batch=1)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:210
__host__ static constexpr __device__ bool CalculateHasMainK0BlockLoop(index_t K0Padded)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:609
__host__ static constexpr __device__ auto MakeDefaultBlock2CTileMap()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:656
__host__ static __device__ auto MakeBGridDescriptor_KBatch_K0_N_K1(index_t K, index_t NPad, index_t N, index_t StrideB, index_t KBatch, index_t K0Padded, index_t KPad)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:299
__host__ static constexpr __device__ auto MakeCBlockClusterAdaptor(const CGridDesc &c_m_n_grid_desc, index_t, index_t, index_t KBatch)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:635
__host__ static __device__ auto MakeCGridDescriptor_M_N(index_t M, index_t N, index_t StrideC)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:375
ThisThreadBlock< BlockSize > ThisThreadBlock
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:122
static constexpr auto M01
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:115
remove_cvref_t< decltype(MakeCGridDescriptor_M_N(1, 1, 1))> CGridDesc_M_N
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:661
__host__ static __device__ auto CalculateKPadded(index_t K, index_t K_Batch=1)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:217
static std::string GetTypeString()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:1104
static constexpr auto I4
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:108
static constexpr auto I0
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:104
Definition: sequence.hpp:43
Definition: integral_constant.hpp:10
Definition: device_base.hpp:50
Definition: matrix_padder.hpp:134
Definition: unary_element_wise_operation.hpp:241