22 template <
typename GridwiseGemm,
 
   23           bool HasMainKBlockLoop,
 
   25           typename Block2CTileMap,
 
   26           typename AElementwiseOperation,
 
   27           typename BElementwiseOperation,
 
   28           typename CElementwiseOperation>
 
   30 #if CK_USE_LAUNCH_BOUNDS 
   34                                              const Block2CTileMap& b2c_map,
 
   35                                              const AElementwiseOperation a_element_op,
 
   36                                              const BElementwiseOperation b_element_op,
 
   37                                              const CElementwiseOperation c_element_op)
 
   39 #if(!defined(__HIP_DEVICE_COMPILE__) || defined(__gfx908__) || defined(__gfx90a__) || \ 
   41     constexpr 
index_t shared_size = GridwiseGemm::GetSharedMemoryNumberOfByte();
 
   43     __shared__ uint8_t p_shared[shared_size];
 
   45     GridwiseGemm::template Run<HasMainKBlockLoop, CGlobalMemoryDataOperation>(
 
   46         karg, 
static_cast<void*
>(p_shared), b2c_map, a_element_op, b_element_op, c_element_op);
 
   64           typename AElementwiseOperation,
 
   65           typename BElementwiseOperation,
 
   66           typename CElementwiseOperation,
 
   77           typename ABlockTransferThreadClusterLengths_K0_M_K1,
 
   78           typename ABlockTransferThreadClusterArrangeOrder,
 
   79           typename ABlockTransferSrcAccessOrder,
 
   80           index_t ABlockTransferSrcVectorDim,
 
   81           index_t ABlockTransferSrcScalarPerVector,
 
   82           index_t ABlockTransferDstScalarPerVector_K1,
 
   83           bool AThreadTransferSrcResetCoordinateAfterRun,
 
   85           typename BBlockTransferThreadClusterLengths_K0_N_K1,
 
   86           typename BBlockTransferThreadClusterArrangeOrder,
 
   87           typename BBlockTransferSrcAccessOrder,
 
   88           index_t BBlockTransferSrcVectorDim,
 
   89           index_t BBlockTransferSrcScalarPerVector,
 
   90           index_t BBlockTransferDstScalarPerVector_K1,
 
   91           bool BThreadTransferSrcResetCoordinateAfterRun,
 
   93           index_t CShuffleMRepeatPerShuffle,
 
   94           index_t CShuffleNRepeatPerShuffle,
 
   95           index_t CBlockTransferScalarPerVector_NWaveNPerXDL,
 
   96           typename CBlockTransferClusterLengths_MBlock_MPerBlock_NBlock_NPerBlock,
 
   99           typename ComputeTypeA       = FloatC,
 
  100           typename ComputeTypeB       = ComputeTypeA,
 
  101           typename LDSTypeA           = ComputeTypeA,
 
  102           typename LDSTypeB           = ComputeTypeB>
 
  116     static constexpr 
auto M01 = 1;
 
  117     static constexpr 
auto N01 = 1;
 
  121             MPerBlock, NPerBlock, 
K1* K0PerBlock};
 
  126         decltype(GridwiseGemmPipeline_Selector<PipelineVer, NumGemmKPrefetchStage, LoopSched>())>;
 
  146                  const FloatB* p_b_grid_,
 
  189                       << 
"KB:" << 
k_batch << 
"}" << std::endl;
 
  214         auto K_t = K_Batch * K0PerBlock * 
K1;
 
  215         return (K + K_t - 1) / K_t * K0PerBlock;
 
  221         return K_Batch * K0Padded * 
K1;
 
  232         const auto a_grid_desc_m_k = [&]() {
 
  308         const auto b_grid_desc_k_n = [&]() {
 
  378         const auto c_grid_desc_m_n = [&]() {
 
  389         return gemm_padder.PadCDescriptor_M_N(c_grid_desc_m_n);
 
  394         constexpr 
auto max_lds_align = 
K1;
 
  397         constexpr 
auto a_k0_m_k1_block_desc = [&]() {
 
  398             if constexpr(ABlockLdsExtraM)
 
  412         constexpr 
auto b_k0_n_k1_block_desc = [&]() {
 
  413             if constexpr(BBlockLdsExtraN)
 
  427         constexpr 
auto a_block_space_size =
 
  430         constexpr 
auto b_block_space_size =
 
  433         constexpr 
auto c_block_size =
 
  436         return math::max(a_block_space_size * 
sizeof(LDSTypeA) +
 
  437                              b_block_space_size * 
sizeof(LDSTypeB),
 
  438                          c_block_size * 
sizeof(FloatC));
 
  448             if(!(karg.
M % MPerBlock == 0))
 
  452                     std::cout << 
"Arg M value is not a multiple of MPerBlock! M: " << karg.
M << 
" " 
  453                               << __FILE__ << 
":" << __LINE__ << 
", in function: " << __func__
 
  465             if(!(karg.
N % NPerBlock == 0))
 
  469                     std::cout << 
"Arg N value is not a multiple of NPerBlock! N: " << karg.
N << 
" " 
  470                               << __FILE__ << 
":" << __LINE__ << 
", in function: " << __func__
 
  483             auto K_t = karg.
k_batch * K0PerBlock * 
K1;
 
  484             if(!(karg.
K % K_t == 0))
 
  488                     std::cout << 
"Arg K value is not a multiple of K_Batch * K0PerBlock * K1! K: " 
  489                               << karg.
K << 
" " << __FILE__ << 
":" << __LINE__
 
  490                               << 
", in function: " << __func__ << std::endl;
 
  498             if(karg.
K % ABlockTransferSrcScalarPerVector != 0)
 
  502                     std::cout << 
"Arg K (" << karg.
K 
  503                               << 
") value is not a multiple of ABlockTransferSrcScalarPerVector (" 
  504                               << ABlockTransferSrcScalarPerVector << 
" )! " << __FILE__ << 
":" 
  505                               << __LINE__ << 
", in function: " << __func__ << std::endl;
 
  512             if(karg.
M % ABlockTransferSrcScalarPerVector != 0)
 
  516                     std::cout << 
"Arg M (" << karg.
M 
  517                               << 
") value is not a multiple of ABlockTransferSrcScalarPerVector (" 
  518                               << ABlockTransferSrcScalarPerVector << 
" )! " << __FILE__ << 
":" 
  519                               << __LINE__ << 
", in function: " << __func__ << std::endl;
 
  527             if(karg.
N % BBlockTransferSrcScalarPerVector != 0)
 
  531                     std::cout << 
"Arg N (" << karg.
N 
  532                               << 
") value is not a multiple of BBlockTransferSrcScalarPerVector (" 
  533                               << BBlockTransferSrcScalarPerVector << 
" )! " << __FILE__ << 
":" 
  534                               << __LINE__ << 
", in function: " << __func__ << std::endl;
 
  541             if(karg.
K % BBlockTransferSrcScalarPerVector != 0)
 
  545                     std::cout << 
"Arg K (" << karg.
K 
  546                               << 
") value is not a multiple of BBlockTransferSrcScalarPerVector (" 
  547                               << BBlockTransferSrcScalarPerVector << 
" )! " << __FILE__ << 
":" 
  548                               << __LINE__ << 
", in function: " << __func__ << std::endl;
 
  556             if(karg.
N % CBlockTransferScalarPerVector_NWaveNPerXDL != 0)
 
  560                     std::cout << 
"Arg N (" << karg.
N 
  561                               << 
") value is not a multiple of " 
  562                                  "CBlockTransferScalarPerVector_NWaveNPerXDL (" 
  563                               << CBlockTransferScalarPerVector_NWaveNPerXDL << 
" )! " << __FILE__
 
  564                               << 
":" << __LINE__ << 
", in function: " << __func__ << std::endl;
 
  571             if(karg.
M % CBlockTransferScalarPerVector_NWaveNPerXDL != 0)
 
  575                     std::cout << 
"Arg M (" << karg.
M 
  576                               << 
") value is not a multiple of " 
  577                                  "CBlockTransferScalarPerVector_NWaveNPerXDL (" 
  578                               << CBlockTransferScalarPerVector_NWaveNPerXDL << 
" )! " << __FILE__
 
  579                               << 
":" << __LINE__ << 
", in function: " << __func__ << std::endl;
 
  585         const auto num_k_loop = karg.
K0Padded / K0PerBlock;
 
  586         if(!GridwiseGemmPipe::IsSupported(num_k_loop))
 
  590                 std::cout << 
"The number of k loops (" << num_k_loop
 
  591                           << 
") value is not supported by GridwiseGemm Pipeline." 
  592                           << 
" K0Padded: " << karg.
K0Padded << 
", K0PerBlock: " << K0PerBlock << 
" " 
  593                           << __FILE__ << 
":" << __LINE__ << 
", in function: " << __func__
 
  606         const index_t KPad = KBatch * K0Padded * 
K1;
 
  612         const index_t num_loop = K0Padded / K0PerBlock;
 
  613         return GridwiseGemmPipe::CalculateHasMainLoop(num_loop);
 
  616     template <
typename CGr
idDesc>
 
  617     __host__ __device__ 
static constexpr 
auto 
  620         const auto M = c_m_n_grid_desc.GetLength(
I0);
 
  621         const auto N = c_m_n_grid_desc.GetLength(
I1);
 
  623         const auto MBlock = M / MPerBlock;
 
  624         const auto NBlock = N / NPerBlock;
 
  635     template <
typename CGr
idDesc>
 
  640             c_m_n_grid_desc, 8, KBatch);
 
  643     __host__ __device__ 
static constexpr 
auto 
  646         constexpr 
index_t MWave = MPerBlock / (MRepeat * MPerXDL);
 
  647         constexpr 
index_t NWave = NPerBlock / (NRepeat * NPerXDL);
 
  665     template <
bool HasMainKBlockLoop,
 
  667               typename Block2CTileMap>
 
  669                                void* __restrict__ p_shared_block,
 
  670                                const Block2CTileMap& block_2_ctile_map,
 
  671                                const AElementwiseOperation a_element_op = AElementwiseOperation{},
 
  672                                const BElementwiseOperation b_element_op = BElementwiseOperation{},
 
  673                                const CElementwiseOperation c_element_op = CElementwiseOperation{})
 
  675         const FloatA* p_a_grid           = karg.
p_a_grid;
 
  676         const FloatB* p_b_grid           = karg.
p_b_grid;
 
  684         const auto c_grid_desc_mblock_mperblock_nblock_nperblock =
 
  687         const auto a_grid_buf = make_dynamic_buffer<AddressSpaceEnum::Global>(
 
  688             p_a_grid, a_b_k0_m_k1_grid_desc.GetElementSpaceSize());
 
  689         const auto b_grid_buf = make_dynamic_buffer<AddressSpaceEnum::Global>(
 
  690             p_b_grid, b_b_k0_n_k1_grid_desc.GetElementSpaceSize());
 
  691         auto c_grid_buf = make_dynamic_buffer<AddressSpaceEnum::Global>(
 
  692             p_c_grid, c_grid_desc_mblock_mperblock_nblock_nperblock.GetElementSpaceSize());
 
  695         const auto block_work_idx =
 
  698         if(!block_2_ctile_map.ValidCTileIndex(
 
  700                make_tuple(c_grid_desc_mblock_mperblock_nblock_nperblock.GetLength(
I0),
 
  701                           c_grid_desc_mblock_mperblock_nblock_nperblock.GetLength(
I2))))
 
  706         const index_t block_m_id = __builtin_amdgcn_readfirstlane(block_work_idx[
I1]);
 
  707         const index_t block_n_id = __builtin_amdgcn_readfirstlane(block_work_idx[
I2]);
 
  708         const index_t k_batch_id = __builtin_amdgcn_readfirstlane(block_work_idx[
I0]);
 
  711         const index_t m_block_data_idx_on_grid =
 
  712             __builtin_amdgcn_readfirstlane(block_m_id * MPerBlock);
 
  714         const index_t n_block_data_idx_on_grid =
 
  715             __builtin_amdgcn_readfirstlane(block_n_id * NPerBlock);
 
  718         constexpr 
auto max_lds_align = 
K1;
 
  721         constexpr 
auto a_k0_m_k1_block_desc = [&]() {
 
  722             if constexpr(ABlockLdsExtraM)
 
  725                     make_tuple(Number<K0PerBlock>{}, Number<MPerBlock>{}, 
K1),
 
  731                     make_tuple(Number<K0PerBlock>{}, Number<MPerBlock>{}, 
K1), max_lds_align);
 
  735         constexpr 
auto a_b_k0_m_k1_block_desc = [&]() {
 
  736             if constexpr(ABlockLdsExtraM)
 
  739                     make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<MPerBlock>{}, 
K1),
 
  740                     make_tuple(Number<K0PerBlock>{} * Number<MPerBlock + 1>{} * 
K1,
 
  741                                Number<MPerBlock + 1>{} * 
K1,
 
  748                     make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<MPerBlock>{}, 
K1),
 
  753         constexpr 
auto b_k0_n_k1_block_desc = [&]() {
 
  754             if constexpr(BBlockLdsExtraN)
 
  757                     make_tuple(Number<K0PerBlock>{}, Number<NPerBlock>{}, 
K1),
 
  763                     make_tuple(Number<K0PerBlock>{}, Number<NPerBlock>{}, 
K1), max_lds_align);
 
  767         constexpr 
auto b_b_k0_n_k1_block_desc = [&]() {
 
  768             if constexpr(BBlockLdsExtraN)
 
  771                     make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<NPerBlock>{}, 
K1),
 
  772                     make_tuple(Number<K0PerBlock>{} * Number<NPerBlock + 1>{} * 
K1,
 
  773                                Number<NPerBlock + 1>{} * 
K1,
 
  780                     make_tuple(Number<1>{}, Number<K0PerBlock>{}, Number<NPerBlock>{}, 
K1),
 
  785         auto a_blockwise_copy =
 
  787                                                 AElementwiseOperation,
 
  790                                                 Sequence<1, K0PerBlock, MPerBlock, K1>,
 
  791                                                 ABlockTransferThreadClusterLengths_K0_M_K1,
 
  792                                                 ABlockTransferThreadClusterArrangeOrder,
 
  795                                                 decltype(a_b_k0_m_k1_grid_desc),
 
  796                                                 decltype(a_b_k0_m_k1_block_desc),
 
  797                                                 ABlockTransferSrcAccessOrder,
 
  798                                                 Sequence<0, 2, 1, 3>,
 
  799                                                 ABlockTransferSrcVectorDim,
 
  801                                                 ABlockTransferSrcScalarPerVector,
 
  802                                                 ABlockTransferDstScalarPerVector_K1,
 
  805                                                 AThreadTransferSrcResetCoordinateAfterRun,
 
  807                 a_b_k0_m_k1_grid_desc,
 
  810                 a_b_k0_m_k1_block_desc,
 
  815         auto b_blockwise_copy =
 
  817                                                 BElementwiseOperation,
 
  820                                                 Sequence<1, K0PerBlock, NPerBlock, K1>,
 
  821                                                 BBlockTransferThreadClusterLengths_K0_N_K1,
 
  822                                                 BBlockTransferThreadClusterArrangeOrder,
 
  825                                                 decltype(b_b_k0_n_k1_grid_desc),
 
  826                                                 decltype(b_b_k0_n_k1_block_desc),
 
  827                                                 BBlockTransferSrcAccessOrder,
 
  828                                                 Sequence<0, 2, 1, 3>,
 
  829                                                 BBlockTransferSrcVectorDim,
 
  831                                                 BBlockTransferSrcScalarPerVector,
 
  832                                                 BBlockTransferDstScalarPerVector_K1,
 
  835                                                 BThreadTransferSrcResetCoordinateAfterRun,
 
  837                 b_b_k0_n_k1_grid_desc,
 
  840                 b_b_k0_n_k1_block_desc,
 
  857             decltype(a_k0_m_k1_block_desc),
 
  858             decltype(b_k0_n_k1_block_desc),
 
  868         auto c_thread_buf = blockwise_gemm.GetCThreadBuffer();
 
  871         constexpr 
auto a_block_space_size =
 
  874         auto p_a_block = 
reinterpret_cast<LDSTypeA*
>(p_shared_block);
 
  875         auto p_b_block = 
reinterpret_cast<LDSTypeB*
>(p_a_block + a_block_space_size);
 
  877         constexpr 
auto a_block_slice_copy_step = 
make_multi_index(0, K0PerBlock, 0, 0);
 
  878         constexpr 
auto b_block_slice_copy_step = 
make_multi_index(0, K0PerBlock, 0, 0);
 
  880         auto a_block_buf = make_dynamic_buffer<AddressSpaceEnum::Lds>(
 
  881             p_a_block, a_k0_m_k1_block_desc.GetElementSpaceSize());
 
  882         auto b_block_buf = make_dynamic_buffer<AddressSpaceEnum::Lds>(
 
  883             p_b_block, b_k0_n_k1_block_desc.GetElementSpaceSize());
 
  886         const index_t num_k_block_main_loop = __builtin_amdgcn_readfirstlane(
 
  887             (a_b_k0_m_k1_grid_desc.GetLength(
I1) * a_b_k0_m_k1_grid_desc.GetLength(
I3)) /
 
  892         gridwise_gemm_pipeline.template Run<HasMainKBlockLoop>(a_b_k0_m_k1_grid_desc,
 
  893                                                                a_b_k0_m_k1_block_desc,
 
  897                                                                a_block_slice_copy_step,
 
  898                                                                b_b_k0_n_k1_grid_desc,
 
  899                                                                b_b_k0_n_k1_block_desc,
 
  903                                                                b_block_slice_copy_step,
 
  906                                                                num_k_block_main_loop);
 
  910             constexpr 
index_t MWave = MPerBlock / (MRepeat * MPerXDL);
 
  911             constexpr 
index_t NWave = NPerBlock / (NRepeat * NPerXDL);
 
  913             constexpr 
auto c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc =
 
  914                 blockwise_gemm.GetCBlockDescriptor_M0_N0_M1_N1_M2_M3_M4_N2();
 
  916             constexpr 
auto c_m0_n0_m1_n1_m2_m3_m4_n2_thread_desc =
 
  917                 blockwise_gemm.GetCThreadDescriptor_M0_N0_M1_N1_M2_M3_M4_N2();
 
  919             constexpr 
auto M0 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I0);
 
  920             constexpr 
auto N0 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I1);
 
  921             constexpr 
auto M1 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I2);
 
  922             constexpr 
auto N1 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I3);
 
  923             constexpr 
auto M2 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I4);
 
  924             constexpr 
auto M3 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I5);
 
  925             constexpr 
auto M4 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I6);
 
  926             constexpr 
auto N2 = c_m0_n0_m1_n1_m2_m3_m4_n2_block_desc.GetLength(
I7);
 
  928             constexpr 
auto c_block_desc_mblock_mperblock_nblock_nperblock =
 
  931             auto c_block_buf = make_dynamic_buffer<AddressSpaceEnum::Lds>(
 
  932                 static_cast<FloatC*
>(p_shared_block),
 
  933                 c_block_desc_mblock_mperblock_nblock_nperblock.GetElementSpaceSize());
 
  936                 c_block_desc_mblock_mperblock_nblock_nperblock,
 
  948                 make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}),
 
  950                     Sequence<>{}, Sequence<0, 2, 4, 5, 6>{}, Sequence<>{}, Sequence<1, 3, 7>{}));
 
  954             const auto c_thread_mtx_on_block =
 
  955                 blockwise_gemm.CalculateCThreadOriginDataIndex(
I0, 
I0, 
I0, 
I0);
 
  957             const index_t m_thread_data_on_block = c_thread_mtx_on_block[
I0];
 
  958             const index_t n_thread_data_on_block = c_thread_mtx_on_block[
I1];
 
  960             const auto m_thread_data_on_block_to_m0_m1_m2_m3_m4_adaptor =
 
  966             const auto m_thread_data_on_block_idx =
 
  967                 m_thread_data_on_block_to_m0_m1_m2_m3_m4_adaptor.CalculateBottomIndex(
 
  970             const auto n_thread_data_on_block_to_n0_n1_n2_adaptor =
 
  976             const auto n_thread_data_on_block_idx =
 
  977                 n_thread_data_on_block_to_n0_n1_n2_adaptor.CalculateBottomIndex(
 
  981             auto c_thread_copy_vgpr_to_lds =
 
  982                 ThreadwiseTensorSliceTransfer_v1r3<FloatAcc,
 
  984                                                    decltype(c_m0_n0_m1_n1_m2_m3_m4_n2_thread_desc),
 
  985                                                    decltype(c_block_desc_m0_n0_m1_n1_m2_m3_m4_n2),
 
  987                                                    Sequence<CShuffleMRepeatPerShuffle,
 
  988                                                             CShuffleNRepeatPerShuffle,
 
  995                                                    Sequence<0, 1, 2, 3, 4, 5, 6, 7>,
 
 1001                     c_block_desc_m0_n0_m1_n1_m2_m3_m4_n2,
 
 1004                                      m_thread_data_on_block_idx[
I1],
 
 1005                                      n_thread_data_on_block_idx[
I1],
 
 1006                                      m_thread_data_on_block_idx[
I2],
 
 1007                                      m_thread_data_on_block_idx[
I3],
 
 1008                                      m_thread_data_on_block_idx[
I4],
 
 1009                                      n_thread_data_on_block_idx[
I2]),
 
 1013             auto c_block_copy_lds_to_global = ThreadGroupTensorSliceTransfer_v6r1<
 
 1015                 CElementwiseOperation,      
 
 1016                 CGlobalMemoryDataOperation, 
 
 1018                          CShuffleMRepeatPerShuffle * MWave * MPerXDL,
 
 1020                          CShuffleNRepeatPerShuffle * NWave * NPerXDL>, 
 
 1021                 CBlockTransferClusterLengths_MBlock_MPerBlock_NBlock_NPerBlock,
 
 1022                 Sequence<0, 1, 2, 3>, 
 
 1025                 decltype(c_block_desc_mblock_mperblock_nblock_nperblock),
 
 1026                 decltype(c_grid_desc_mblock_mperblock_nblock_nperblock),
 
 1027                 Sequence<0, 1, 2, 3>,                       
 
 1029                 CBlockTransferScalarPerVector_NWaveNPerXDL, 
 
 1032                 {c_block_desc_mblock_mperblock_nblock_nperblock,
 
 1034                  c_grid_desc_mblock_mperblock_nblock_nperblock,
 
 1038             constexpr 
auto mxdlperwave_forward_step =
 
 1040             constexpr 
auto nxdlperwave_forward_step =
 
 1042             constexpr 
auto nxdlperwave_backward_step =
 
 1045             static_for<0, MRepeat, CShuffleMRepeatPerShuffle>{}([&](
auto mxdlperwave_iter) {
 
 1046                 constexpr 
auto mxdlperwave = mxdlperwave_iter;
 
 1048                 static_for<0, NRepeat, CShuffleNRepeatPerShuffle>{}([&](
auto nxdlperwave_iter) {
 
 1049                     constexpr 
bool nxdlperwave_forward_sweep =
 
 1050                         (mxdlperwave % (2 * CShuffleMRepeatPerShuffle) == 0);
 
 1052                     constexpr 
index_t nxdlperwave_value =
 
 1053                         nxdlperwave_forward_sweep
 
 1055                             : (NRepeat - nxdlperwave_iter - CShuffleNRepeatPerShuffle);
 
 1057                     constexpr 
auto nxdlperwave = Number<nxdlperwave_value>{};
 
 1063                     c_thread_copy_vgpr_to_lds.Run(
 
 1064                         c_m0_n0_m1_n1_m2_m3_m4_n2_thread_desc,
 
 1067                         c_block_desc_m0_n0_m1_n1_m2_m3_m4_n2,
 
 1074                     c_block_copy_lds_to_global.Run(c_block_desc_mblock_mperblock_nblock_nperblock,
 
 1076                                                    c_grid_desc_mblock_mperblock_nblock_nperblock,
 
 1080                     if constexpr(nxdlperwave_forward_sweep &&
 
 1081                                  (nxdlperwave < NRepeat - CShuffleNRepeatPerShuffle))
 
 1083                         c_block_copy_lds_to_global.MoveDstSliceWindow(
 
 1084                             c_grid_desc_mblock_mperblock_nblock_nperblock,
 
 1085                             nxdlperwave_forward_step);
 
 1087                     else if constexpr((!nxdlperwave_forward_sweep) && (nxdlperwave > 0))
 
 1089                         c_block_copy_lds_to_global.MoveDstSliceWindow(
 
 1090                             c_grid_desc_mblock_mperblock_nblock_nperblock,
 
 1091                             nxdlperwave_backward_step);
 
 1096                 if constexpr(mxdlperwave < MRepeat - CShuffleMRepeatPerShuffle)
 
 1098                     c_block_copy_lds_to_global.MoveDstSliceWindow(
 
 1099                         c_grid_desc_mblock_mperblock_nblock_nperblock, mxdlperwave_forward_step);
 
 1107         auto str = std::stringstream();
 
 1110         str << 
"GemmXdlSplitKCShuffle_" 
 1112             << std::string(ALayout::name)[0]
 
 1113             << std::string(BLayout::name)[0]
 
 1114             << std::string(CLayout::name)[0]
 
 1116             << 
"B" << BlockSize << 
"_" 
 1117             << 
"Vec" << ABlockTransferSrcScalarPerVector << 
"x" 
 1118             << BBlockTransferSrcScalarPerVector << 
"x" 
 1119             << CBlockTransferScalarPerVector_NWaveNPerXDL << 
"_" 
 1122             << K0PerBlock << 
"x" 
#define CK_MIN_BLOCK_PER_CU
Definition: ck.hpp:30
 
#define CK_MAX_THREAD_PER_BLOCK
Definition: ck.hpp:29
 
__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:32
 
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:33
 
InMemoryDataOperationEnum
Definition: ck.hpp:278
 
__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:25
 
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:297
 
__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:300
 
__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:18
 
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:976
 
Definition: block_to_ctile_map.hpp:540
 
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:129
 
index_t StrideC
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:138
 
index_t K0Padded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:142
 
index_t MPadded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:139
 
index_t k_batch
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:143
 
index_t N
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:134
 
const FloatA * p_a_grid
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:130
 
index_t K
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:135
 
index_t StrideA
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:136
 
index_t M
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:133
 
const FloatB * p_b_grid
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:131
 
index_t StrideB
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:137
 
FloatC * p_c_grid
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:132
 
index_t NPadded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:140
 
index_t KPadded
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:141
 
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:145
 
void Print() const
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:176
 
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:104
 
static constexpr auto I2
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:107
 
static constexpr auto gemm_padder
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:119
 
__host__ static __device__ auto CalculateGridSize(const Argument &karg)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:193
 
__host__ static __device__ auto CalculateMPadded(index_t M)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:201
 
static constexpr auto I5
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:110
 
remove_cvref_t< decltype(GridwiseGemmPipeline_Selector< PipelineVer, NumGemmKPrefetchStage, LoopSched >())> GridwiseGemmPipe
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:126
 
__host__ static __device__ auto GetKPad(index_t K, index_t KBatch)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:602
 
remove_cvref_t< decltype(MakeDefaultBlock2CTileMap())> DefaultBlock2CTileMap
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:663
 
static constexpr auto K1
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:115
 
static constexpr auto I1
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:106
 
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:668
 
__host__ static constexpr __device__ auto MakeCGridDesc_MBlock_MPerBlock_NBlock_NPerBlock(const CGridDesc &c_m_n_grid_desc)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:618
 
__host__ static constexpr __device__ index_t GetSharedMemoryNumberOfByte()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:392
 
__host__ static constexpr __device__ bool CheckValidity(const Argument &karg)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:441
 
static constexpr auto I3
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:108
 
static constexpr auto I7
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:112
 
__host__ static constexpr __device__ auto GetCBlockDescriptor_MBlock_MPerBlock_NBlock_NPerBlock()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:644
 
static constexpr auto I6
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:111
 
__host__ static __device__ auto CalculateNPadded(index_t N)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:206
 
static constexpr auto N01
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:117
 
__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:224
 
__host__ static __device__ auto CalculateK0Padded(index_t K, index_t K_Batch=1)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:211
 
__host__ static constexpr __device__ bool CalculateHasMainK0BlockLoop(index_t K0Padded)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:610
 
__host__ static constexpr __device__ auto MakeDefaultBlock2CTileMap()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:657
 
__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:300
 
__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:636
 
__host__ static __device__ auto MakeCGridDescriptor_M_N(index_t M, index_t N, index_t StrideC)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:376
 
ThisThreadBlock< BlockSize > ThisThreadBlock
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:123
 
static constexpr auto M01
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:116
 
remove_cvref_t< decltype(MakeCGridDescriptor_M_N(1, 1, 1))> CGridDesc_M_N
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:662
 
__host__ static __device__ auto CalculateKPadded(index_t K, index_t K_Batch=1)
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:218
 
static std::string GetTypeString()
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:1105
 
static constexpr auto I4
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:109
 
static constexpr auto I0
Definition: gridwise_gemm_xdlops_v2r4r2.hpp:105
 
Definition: sequence.hpp:43
 
Definition: integral_constant.hpp:20
 
Definition: device_base.hpp:51
 
Definition: matrix_padder.hpp:134
 
Definition: unary_element_wise_operation.hpp:308
 
#define CK_ENV(name)
Definition: env.hpp:128