mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-02 04:31:25 +00:00
[CK_TILE] Add CK Tile bwd weight profiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation To compare old CK and CK Tile, we need to extend the current CK profiler to support running also CK Tile instance with the same API. In order to have the same instance coverage in CK Tile compared to the old CK, I've added code generation from old CK configurations to CK Tile instances using the CK Builder. ## Technical Details - The codegen python script for CK Tile fwd convs is extended to support also bwd weight and bwd data. - The generated instances are added to the CMake build (target `device_grouped_conv_bwd_weight_tile_instance`s). - A new profiler op (`grouped_conv_bwd_weight_tile`) has been added to the CK Profiler.
177 lines
11 KiB
C++
177 lines
11 KiB
C++
#include "../../builder/test/utils/ckb_conv_tile_test_configs.hpp"
|
|
#include "ck_tile/builder/testing/conv/fwd.hpp"
|
|
#include "ck_tile/builder/testing/conv/bwd_weight.hpp"
|
|
#include "ck_tile/builder/testing/conv/ck_tile.hpp"
|
|
|
|
namespace ckb = ck_tile::builder;
|
|
namespace ckt = ck_tile::builder::test;
|
|
namespace cku = ck_tile::builder::test_utils;
|
|
|
|
namespace ck_tile::builder::profiling {
|
|
|
|
constexpr auto SIGNATURE_NHWGC_FP32_FWD =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::FORWARD,
|
|
.data_type = ckb::DataType::FP32,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NHWGC_BF16_FWD =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::FORWARD,
|
|
.data_type = ckb::DataType::BF16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NHWGC_FP16_FWD =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::FORWARD,
|
|
.data_type = ckb::DataType::FP16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_FP32_FWD =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::FORWARD,
|
|
.data_type = ckb::DataType::FP32,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_BF16_FWD =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::FORWARD,
|
|
.data_type = ckb::DataType::BF16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_FP16_FWD =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::FORWARD,
|
|
.data_type = ckb::DataType::FP16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
// Backward Weight Signatures
|
|
constexpr auto SIGNATURE_NHWGC_FP32_BWD_WEIGHT =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::BACKWARD_WEIGHT,
|
|
.data_type = ckb::DataType::FP32,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NHWGC_BF16_BWD_WEIGHT =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::BACKWARD_WEIGHT,
|
|
.data_type = ckb::DataType::BF16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NHWGC_FP16_BWD_WEIGHT =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::BACKWARD_WEIGHT,
|
|
.data_type = ckb::DataType::FP16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_FP32_BWD_WEIGHT =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::BACKWARD_WEIGHT,
|
|
.data_type = ckb::DataType::FP32,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_BF16_BWD_WEIGHT =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::BACKWARD_WEIGHT,
|
|
.data_type = ckb::DataType::BF16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_FP16_BWD_WEIGHT =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::BACKWARD_WEIGHT,
|
|
.data_type = ckb::DataType::FP16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
// Backward Data Signatures
|
|
constexpr auto SIGNATURE_NHWGC_FP32_BWD_DATA =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::BACKWARD_DATA,
|
|
.data_type = ckb::DataType::FP32,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NHWGC_BF16_BWD_DATA =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::BACKWARD_DATA,
|
|
.data_type = ckb::DataType::BF16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NHWGC_FP16_BWD_DATA =
|
|
ckt::ConvSignature{.spatial_dim = 2,
|
|
.direction = ckb::ConvDirection::BACKWARD_DATA,
|
|
.data_type = ckb::DataType::FP16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_FP32_BWD_DATA =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::BACKWARD_DATA,
|
|
.data_type = ckb::DataType::FP32,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_BF16_BWD_DATA =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::BACKWARD_DATA,
|
|
.data_type = ckb::DataType::BF16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
constexpr auto SIGNATURE_NDHWGC_FP16_BWD_DATA =
|
|
ckt::ConvSignature{.spatial_dim = 3,
|
|
.direction = ckb::ConvDirection::BACKWARD_DATA,
|
|
.data_type = ckb::DataType::FP16,
|
|
.accumulation_data_type = ckb::DataType::FP32,
|
|
.input = {.config = {.layout = ckb::TensorLayout::NDHWGC}},
|
|
.weight = {.config = {.layout = ckb::TensorLayout::GKZYXC}},
|
|
.output = {.config = {.layout = ckb::TensorLayout::NDHWGK}}};
|
|
|
|
} // namespace ck_tile::builder::profiling
|