mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-07-17 00:58:44 +00:00
Separate types from concepts.
This commit is contained in:
@@ -1,38 +1,37 @@
|
||||
|
||||
#include "ck_tile/builder/conv_builder.hpp"
|
||||
#include "../utils/types.hpp"
|
||||
#include "ck_tile/builder/conv_signature_types.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
namespace ckb = ck_tile::builder;
|
||||
namespace ckb_examples = ck_tile::builder::examples;
|
||||
using namespace ck_tile::builder;
|
||||
|
||||
constexpr ckb_examples::ConvSignature FwdConvSignature
|
||||
constexpr ConvSignature FwdConvSignature
|
||||
{
|
||||
.spatial_dim = 2,
|
||||
.direction = ckb::ConvDirection::FORWARD,
|
||||
.layout = ckb::GroupConvLayout::CHANNELS_LAST,
|
||||
.data_type = ckb::DataType::BF16,
|
||||
.direction = ConvDirection::FORWARD,
|
||||
.layout = GroupConvLayout::CHANNELS_LAST,
|
||||
.data_type = DataType::BF16
|
||||
};
|
||||
static_assert(ckb::ValidConvSignature<FwdConvSignature>);
|
||||
static_assert(ValidConvSignature<FwdConvSignature>);
|
||||
|
||||
// To get valid configuration parameters, refer to "device_grouped_conv_fwd_xdl_comp_instance.hpp".
|
||||
// This file contains the current instances of the kernel DeviceGroupedConvFwdMultipleABD_Xdl_CShuffle_V3.
|
||||
// Currently the build has this kernel hard-coded.
|
||||
// In the future, we may need builders per kernel type since they typically have slightly different parameters.
|
||||
|
||||
constexpr ckb::ThreadBlock FwdThreadBlock
|
||||
constexpr ThreadBlock FwdThreadBlock
|
||||
{
|
||||
.block_size = 256,
|
||||
.submatrix = {.m = 256, .n = 256, .k = 32} // Tile sizes
|
||||
};
|
||||
|
||||
constexpr ckb::ConvTuningParams FwdTuningParams
|
||||
constexpr ConvTuningParams FwdTuningParams
|
||||
{
|
||||
.ak1 = 8, .bk1 = 8, .m_per_xdl=32, .n_per_xdl = 32, .m_xdl_per_wave = 4, .n_xdl_per_wave = 4
|
||||
};
|
||||
|
||||
constexpr ckb_examples::BlockTransfer FwdBlockTransfer
|
||||
constexpr BlockTransfer FwdBlockTransfer
|
||||
{
|
||||
.thread_cluster_dims_a = {.k0 = 4, .m = 64, .k1 = 1},
|
||||
.thread_cluster_dims_b = {.k0 = 4, .n = 64, .k1 = 1},
|
||||
@@ -50,15 +49,15 @@ int main()
|
||||
.b_source_access_order = {1, 0, 2}
|
||||
};
|
||||
|
||||
constexpr ckb_examples::ConvAlgorithm FwdConvAlgorithm
|
||||
constexpr ConvAlgorithm FwdConvAlgorithm
|
||||
{
|
||||
.thread_block = FwdThreadBlock,
|
||||
.tuning_params = FwdTuningParams,
|
||||
.block_transfer = FwdBlockTransfer,
|
||||
.pipeline_version = ckb::BlockGemmPipelineVersion::V4,
|
||||
.pipeline_version = BlockGemmPipelineVersion::V4,
|
||||
};
|
||||
|
||||
using Builder = ckb::ConvBuilder<FwdConvSignature, FwdConvAlgorithm>;
|
||||
using Builder = ConvBuilder<FwdConvSignature, FwdConvAlgorithm>;
|
||||
const auto kernel_string = Builder::Instance::TypeString();
|
||||
std::cout << "Generated kernel: " << kernel_string << std::endl;
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ck_tile/builder/conv_algorithm.hpp"
|
||||
#include "ck_tile/builder/conv_signature.hpp"
|
||||
|
||||
namespace ck_tile::builder::examples
|
||||
{
|
||||
namespace ckb = ck_tile::builder;
|
||||
|
||||
struct ConvSignature {
|
||||
int spatial_dim;
|
||||
ckb::ConvDirection direction;
|
||||
ckb::GroupConvLayout layout;
|
||||
ckb::DataType data_type;
|
||||
};
|
||||
static_assert(ckb::ConvSignatureDescriptor<ConvSignature>);
|
||||
|
||||
struct BlockTransfer
|
||||
{
|
||||
ckb::BlockATransferLengths thread_cluster_dims_a;
|
||||
ckb::BlockBTransferLengths thread_cluster_dims_b;
|
||||
ckb::BlockCTransferLengths thread_cluster_dims_c;
|
||||
ckb::VectorTransferAB vector_transfer_a;
|
||||
ckb::VectorTransferAB vector_transfer_b;
|
||||
ckb::VectorTransferC vector_transfer_c;
|
||||
ckb::ThreadClusterAccessOrder a_thread_cluster_access_order;
|
||||
ckb::ThreadClusterAccessOrder b_thread_cluster_access_order;
|
||||
ckb::SourceAccessOrder a_source_access_order;
|
||||
ckb::SourceAccessOrder b_source_access_order;
|
||||
};
|
||||
|
||||
struct ConvAlgorithm
|
||||
{
|
||||
ckb::ThreadBlock thread_block;
|
||||
ckb::ConvTuningParams tuning_params;
|
||||
BlockTransfer block_transfer;
|
||||
ckb::BlockGemmPipelineVersion pipeline_version;
|
||||
};
|
||||
static_assert(ckb::ConvAlgorithmDescriptor<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesThreadBlock<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesConvTuning<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesGemmPipelineVersion<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBlockATransfer<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBlockBTransfer<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBlockCTransfer<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBlockAVectorTransfer<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBlockBVectorTransfer<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBlockCVectorTransfer<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesAThreadClusterAccessOrder<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBThreadClusterAccessOrder<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesASourceAccessOrder<ConvAlgorithm>);
|
||||
static_assert(ckb::SpecifiesBSourceAccessOrder<ConvAlgorithm>);
|
||||
} // namespace ck_tile::builder::examples
|
||||
Reference in New Issue
Block a user