device_batched_contraction_multiple_d_xdl_cshuffle.hpp Source File#
device_batched_contraction_multiple_d_xdl_cshuffle.hpp
Go to the documentation of this file.
139// dimension in a dimension group (eg [G0, G1] in Gs, [M0, M1, M2] in Ms, etc.) are contiguous and
153// is again a packed tensor. MakeGridDescriptor() currently just merges dimensions and ignores some
154// strides from input tensor extents so finer dimension information is lost. Merging dimensions is
float launch_and_time_kernel(const StreamConfig &stream_config, F kernel, dim3 grid_dim, dim3 block_dim, std::size_t lds_byte, Args... args)
Definition host_utility/kernel_launch.hpp:14
Definition convolution_backward_data_specialization.hpp:8
TensorSpecialization
Definition tensor_specialization.hpp:11
@ Packed
Definition tensor_specialization.hpp:13
GemmSpecialization
Definition gemm_specialization.hpp:11
Definition convolution_backward_data_specialization.hpp:7
Definition ck.hpp:268
__host__ __device__ constexpr auto make_multi_index(Xs &&... xs)
Definition array_multi_index.hpp:15
__global__ void kernel_contraction_multiple_d_xdl_cshuffle(const FloatAB *__restrict__ p_a_grid, const FloatAB *__restrict__ p_b_grid, FloatDsPointer p_ds_grid, FloatE *__restrict__ p_e_grid, const index_t batch_count, const AElementwiseOperation a_element_op, const BElementwiseOperation b_element_op, const CDEElementwiseOperation cde_element_op, const AGridDesc_AK0_M_AK1 a_grid_desc_ak0_m_ak1, const BGridDesc_BK0_N_BK1 b_grid_desc_bk0_n_bk1, const DsGridDescriptor_MBlock_MPerBlock_NBlock_NPerBlock ds_grid_desc_mblock_mperblock_nblock_nperblock, const EGridDescriptor_MBlock_MPerBlock_NBlock_NPerBlock e_grid_desc_mblock_mperblock_nblock_nperblock, const ComputePtrOffsetOfBatch compute_ptr_offset_of_batch, const Block2ETileMap block_2_etile_map)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:41
__host__ __device__ constexpr auto make_naive_tensor_descriptor(const Tuple< Lengths... > &lengths, const Tuple< Strides... > &strides)
Definition tensor_descriptor_helper.hpp:49
typename tuple_element< I, TTuple >::type tuple_element_t
Definition utility/tuple.hpp:208
__host__ __device__ constexpr auto make_merge_transform(const LowLengths &low_lengths)
Definition multi_index_transform_helper.hpp:55
__host__ __device__ constexpr auto get_container_subset(const Array< T, N > &arr, Sequence< Is... >)
Definition utility/container_helper.hpp:346
__host__ __device__ constexpr auto container_reduce(const Container &x, Reduce reduce, Init init, Number< IBegin >=Number< 0 >{}, Number< IEnd >=Number< Container::Size()>{}, Number< IStep >=Number< 1 >{})
Definition utility/container_helper.hpp:111
__host__ __device__ constexpr auto generate_tuple(F &&f, Number< N >)
Definition tuple_helper.hpp:21
__host__ __device__ constexpr auto make_tuple(Xs &&... xs)
Definition utility/tuple.hpp:211
__host__ __device__ constexpr auto transform_tensor_descriptor(const OldTensorDescriptor &old_tensor_desc, const NewTransforms &new_transforms, NewLowerDimensionOldVisibleIdss, NewUpperDimensionNewVisibleIdss)
Definition tensor_description/tensor_descriptor.hpp:319
constexpr LoopScheduler make_default_loop_scheduler()
Definition loop_scheduler.hpp:20
Definition ck/stream_config.hpp:10
Definition gridwise_gemm_multiple_d_xdl_cshuffle.hpp:78
__host__ static __device__ constexpr auto MakeDefaultBGridDescriptor_BK0_N_BK1(const BGridDesc_N_K &b_grid_desc_n_k)
Definition gridwise_gemm_multiple_d_xdl_cshuffle.hpp:207
__host__ static __device__ constexpr auto MakeDefaultAGridDescriptor_AK0_M_AK1(const AGridDesc_M_K &a_grid_desc_m_k)
Definition gridwise_gemm_multiple_d_xdl_cshuffle.hpp:190
__host__ static __device__ constexpr bool CheckValidity(const AGridDesc_M_K &a_grid_desc_m_k, const BGridDesc_N_K &b_grid_desc_n_k, const DsGridDesc_M_N &ds_grid_desc_m_n, const EGridDesc_M_N &e_grid_desc_m_n, const Block2ETileMap &, index_t k_batch=1)
Definition gridwise_gemm_multiple_d_xdl_cshuffle.hpp:334
__host__ static __device__ constexpr auto MakeEGridDescriptor_MBlock_MPerBlock_NBlock_NPerBlock(const EGridDesc_M_N &e_grid_desc_m_n)
Definition gridwise_gemm_multiple_d_xdl_cshuffle.hpp:224
__host__ static __device__ constexpr auto MakeDefaultBlock2ETileMap(const EGridDesc_M_N &e_grid_desc_m_n)
Definition gridwise_gemm_multiple_d_xdl_cshuffle.hpp:257
__host__ static __device__ constexpr auto MakeDsGridDescriptor_MBlock_MPerBlock_NBlock_NPerBlock(const DsGridDesc_M_N &ds_grid_desc_m_n)
Definition gridwise_gemm_multiple_d_xdl_cshuffle.hpp:245
Definition utility/sequence.hpp:43
Definition utility/sequence.hpp:256
typename conditional< kHasContent, type0, type1 >::type type
Definition utility/sequence.hpp:271
Definition utility/integral_constant.hpp:20
Definition utility/math.hpp:34
Definition functional2.hpp:33
Definition device_base.hpp:197
BaseArgument()=default
BaseInvoker()=default
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:507
__host__ __device__ constexpr long_index_t GetAPtrOffset(index_t g_idx) const
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:519
ComputePtrOffsetOfStridedBatch(index_t batch_stride_A, index_t batch_stride_B, DsGridDesc_G_M_N ds_grid_desc_g_m_n, EGridDesc_G_M_N e_grid_desc_g_m_n)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:508
__host__ __device__ constexpr long_index_t GetEPtrOffset(index_t g_idx) const
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:541
__host__ __device__ constexpr long_index_t GetBPtrOffset(index_t g_idx) const
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:524
__host__ __device__ constexpr auto GetDsPtrOffset(index_t g_idx) const
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:529
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:624
EGridDesc_M_N e_grid_desc_m_n_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:759
EGridDesc_MBlock_MPerBlock_NBlock_NPerBlock e_grid_desc_mblock_mperblock_nblock_nperblock_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:769
GridwiseGemm64::DsGridPointer p_ds_grid_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:752
BElementwiseOperation b_element_op_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:776
BGridDesc_N_K b_grid_desc_n_k_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:757
DsGridDesc_M_N ds_grid_desc_m_n_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:758
const BDataType * p_b_grid_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:751
EDataType * p_e_grid_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:753
ComputePtrOffsetOfStridedBatch compute_ptr_offset_of_batch_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:792
ck::tensor_operation::device::DeviceBatchedContractionMultipleD_Xdl_CShuffle::Argument::a_kz_stride_
index_t a_kz_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:782
ck::tensor_operation::device::DeviceBatchedContractionMultipleD_Xdl_CShuffle::Argument::b_nz_stride_
index_t b_nz_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:783
DsGridDesc_MBlock_MPerBlock_NBlock_NPerBlock ds_grid_desc_mblock_mperblock_nblock_nperblock_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:768
index_t b_batch_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:790
AGridDesc_AK0_M_AK1 a_grid_desc_ak0_m_ak1_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:765
EGridDesc_G_M_N e_grid_desc_g_m_n_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:762
void init_ds_e_grid_desc()
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:626
ck::tensor_operation::device::DeviceBatchedContractionMultipleD_Xdl_CShuffle::Argument::a_mz_stride_
index_t a_mz_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:781
std::array< index_t, NumDTensor > ds_nz_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:785
DsGridDesc_G_M_N ds_grid_desc_g_m_n_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:761
Block2ETileMap block_2_etile_map_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:772
const ADataType * p_a_grid_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:750
ck::tensor_operation::device::DeviceBatchedContractionMultipleD_Xdl_CShuffle::Argument::e_mz_stride_
index_t e_mz_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:786
index_t a_batch_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:789
AGridDesc_M_K a_grid_desc_m_k_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:756
BGridDesc_BK0_N_BK1 b_grid_desc_bk0_n_bk1_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:766
ck::tensor_operation::device::DeviceBatchedContractionMultipleD_Xdl_CShuffle::Argument::b_kz_stride_
index_t b_kz_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:784
CDEElementwiseOperation cde_element_op_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:777
ck::tensor_operation::device::DeviceBatchedContractionMultipleD_Xdl_CShuffle::Argument::e_nz_stride_
index_t e_nz_stride_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:787
Argument(const void *p_a_grid, const void *p_b_grid, std::array< const void *, NumDTensor > p_ds_grid, void *p_e_grid, const std::vector< index_t > &a_gs_ms_ns_lengths, const std::vector< index_t > &a_gs_ms_ks_strides, const std::vector< index_t > &b_gs_ns_ks_lengths, const std::vector< index_t > &b_gs_ns_ks_strides, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_lengths, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_strides, const std::vector< index_t > &e_gs_ms_ns_lengths, const std::vector< index_t > &e_gs_ms_ns_strides, AElementwiseOperation a_element_op, BElementwiseOperation b_element_op, CDEElementwiseOperation cde_element_op)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:644
AElementwiseOperation a_element_op_
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:775
void Print() const
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:739
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:797
float RunImp(const Argument &arg, const StreamConfig &stream_config=StreamConfig{})
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:801
INVOKER_RUN_IMPL float Run(const BaseArgument *p_arg, const StreamConfig &stream_config=StreamConfig{}) override
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:873
DeviceOp::Argument Argument
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:798
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:218
static constexpr auto NXdlPerWave32
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:223
static constexpr auto matrix_padder
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:232
decltype(MakeBGridDescriptor_N_K({}, {})) BGridDesc_N_K
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:499
remove_cvref_t< decltype(GridwiseGemm64::MakeDefaultBlock2ETileMap(EGridDesc_M_N{}))> Block2ETileMap
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:619
static auto MakeAGridDescriptor_M_K(const std::vector< index_t > &a_gs_ms_ks_lengths_vec, const std::vector< index_t > &a_gs_ms_ks_strides_vec)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:236
remove_cvref_t< decltype(GridwiseGemm64::MakeDefaultBGridDescriptor_BK0_N_BK1( BGridDesc_N_K{}))> BGridDesc_BK0_N_BK1
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:608
remove_cvref_t< decltype(GridwiseGemm64::MakeEGridDescriptor_MBlock_MPerBlock_NBlock_NPerBlock( EGridDesc_M_N{}))> EGridDesc_MBlock_MPerBlock_NBlock_NPerBlock
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:614
remove_cvref_t< decltype(MakeDsGridDescriptor_G_M_N({}, {}))> DsGridDesc_G_M_N
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:503
static auto MakeEGridDescriptor_M_N(const std::vector< index_t > &e_gs_ms_ns_lengths_vec, const std::vector< index_t > &e_gs_ms_ns_strides_vec)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:348
DeviceBatchedContractionMultipleD_Xdl_CShuffle DeviceOp
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:219
std::unique_ptr< BaseInvoker > MakeInvokerPointer() override
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:1065
static constexpr index_t NumDTensor
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:225
static bool IsSupportedArgument(const Argument &arg)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:880
static auto MakeDsGridDescriptor_G_M_N(const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_lengths_vec, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_strides_vec)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:486
std::unique_ptr< BaseArgument > MakeArgumentPointer(const void *p_a, const void *p_b, std::array< const void *, NumDTensor > p_ds, void *p_e, const std::vector< index_t > &a_gs_ms_ns_lengths, const std::vector< index_t > &a_gs_ms_ks_strides, const std::vector< index_t > &b_gs_ns_ks_lengths, const std::vector< index_t > &b_gs_ns_ks_strides, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_lengths, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_strides, const std::vector< index_t > &e_gs_ms_ns_lengths, const std::vector< index_t > &e_gs_ms_ns_strides, AElementwiseOperation a_element_op, BElementwiseOperation b_element_op, CDEElementwiseOperation cde_element_op) override
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:1031
decltype(MakeAGridDescriptor_M_K({}, {})) AGridDesc_M_K
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:498
static constexpr auto I3
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:230
bool IsSupportedArgument(const BaseArgument *p_arg) override
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:988
remove_cvref_t< decltype(GridwiseGemm64::MakeDsGridDescriptor_MBlock_MPerBlock_NBlock_NPerBlock( DsGridDesc_M_N{}))> DsGridDesc_MBlock_MPerBlock_NBlock_NPerBlock
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:611
decltype(MakeEGridDescriptor_M_N({}, {})) EGridDesc_M_N
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:501
static constexpr auto I2
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:229
static auto MakeBGridDescriptor_N_K(const std::vector< index_t > &b_gs_ns_ks_lengths_vec, const std::vector< index_t > &b_gs_ns_ks_strides_vec)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:292
decltype(MakeEGridDescriptor_G_M_N({}, {})) EGridDesc_G_M_N
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:504
static auto MakeInvoker()
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:1027
GridwiseGemmBase< NXdlPerWave32 > GridwiseGemm32
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:602
static auto MakeArgument(const void *p_a, const void *p_b, std::array< const void *, NumDTensor > p_ds, void *p_e, const std::vector< index_t > &a_gs_ms_ns_lengths, const std::vector< index_t > &a_gs_ms_ks_strides, const std::vector< index_t > &b_gs_ns_ks_lengths, const std::vector< index_t > &b_gs_ns_ks_strides, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_lengths, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_strides, const std::vector< index_t > &e_gs_ms_ns_lengths, const std::vector< index_t > &e_gs_ms_ns_strides, AElementwiseOperation a_element_op, BElementwiseOperation b_element_op, CDEElementwiseOperation cde_element_op)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:994
static GET_NXDL_PER_WAVE_IMPL constexpr auto NXdlPerWave64
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:222
static auto MakeEGridDescriptor_G_M_N(const std::vector< index_t > &e_gs_ms_ns_lengths_vec, const std::vector< index_t > &e_gs_ms_ns_strides_vec)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:404
GridwiseGemmBase< math::max(NXdlPerWave64, 1)> GridwiseGemm64
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:601
std::string GetTypeString() const override
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:1071
static constexpr auto I0
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:227
remove_cvref_t< decltype(MakeDsGridDescriptor_M_N({{}}, {{}}))> DsGridDesc_M_N
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:500
static constexpr auto I1
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:228
GridwiseGemmMultipleD_xdl_cshuffle< ADataType, BDataType, ComputeDataType, AccDataType, CShuffleDataType, DsDataType, EDataType, AElementwiseOperation, BElementwiseOperation, CDEElementwiseOperation, NumGemmKPrefetchStage, BlockSize, MPerBlock, NPerBlock, KPerBlock, AK1, BK1, MPerXDL, NPerXDL, MXdlPerWave, NXdlPerWave_, ABlockTransferThreadClusterLengths_AK0_M_AK1, ABlockTransferThreadClusterArrangeOrder, ABlockTransferSrcAccessOrder, ABlockTransferSrcVectorDim, ABlockTransferSrcScalarPerVector, ABlockTransferDstScalarPerVector_AK1, false, ABlockLdsExtraM, BBlockTransferThreadClusterLengths_BK0_N_BK1, BBlockTransferThreadClusterArrangeOrder, BBlockTransferSrcAccessOrder, BBlockTransferSrcVectorDim, BBlockTransferSrcScalarPerVector, BBlockTransferDstScalarPerVector_BK1, false, BBlockLdsExtraN, CShuffleMXdlPerWavePerShuffle, CShuffleNXdlPerWavePerShuffle, CDEBlockTransferClusterLengths_MBlock_MPerBlock_NBlock_NPerBlock, CDEBlockTransferScalarPerVector_NPerBlock, LoopSched > GridwiseGemmBase
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:558
static auto MakeDsGridDescriptor_M_N(const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_lengths_vec, const std::array< std::vector< index_t >, NumDTensor > &ds_gs_ms_ns_strides_vec)
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:474
ADataType ComputeDataType
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:554
remove_cvref_t< decltype(GridwiseGemm64::MakeDefaultAGridDescriptor_AK0_M_AK1( AGridDesc_M_K{}))> AGridDesc_AK0_M_AK1
Definition device_batched_contraction_multiple_d_xdl_cshuffle.hpp:605
Definition device_batched_contraction_multiple_d.hpp:39
Definition matrix_padder.hpp:180