[GPU] Added os_is_yx_osv16_isv2 format (#17476)

This commit is contained in:
Roman Lyamin
2023-05-12 15:11:09 +04:00
committed by GitHub
parent a4314faf29
commit ad03c631b9
9 changed files with 32 additions and 0 deletions

View File

@@ -132,6 +132,7 @@ struct format {
os_iyx_osv16, ///< format used only for convolution weights
o_is_yx_isv16, ///< format used only for convolution weights
os_yxi_osv16, ///< format used only for convolution weights
os_is_yx_osv16_isv2, ///< format used only for convolution weights
os_is_yx_osv16_isv16, ///< format used for convolution i8 weights
os_is_zyx_osv32_isv16,
os_is_zyx_osv64_isv16,

View File

@@ -390,6 +390,8 @@ kernel_selector::weights_layout to_weights_layout(format f, bool is_grouped) {
return kernel_selector::weights_layout::o_is_yx_isv16;
case format::os_iyx_osv16:
return kernel_selector::weights_layout::os_iyx_osv16;
case format::os_is_yx_osv16_isv2:
return kernel_selector::weights_layout::os_is_yx_osv16_isv2;
case format::os_is_yx_osv16_isv16:
return kernel_selector::weights_layout::os_is_yx_osv16_isv16;
case format::os_iyx_osv32:
@@ -511,6 +513,8 @@ kernel_selector::weights_layout to_weights_layout(format f, bool is_grouped) {
return kernel_selector::weights_layout::os_is_osv32_isv32_swizzled_by_4;
case format::os_is_zyx_isv8_osv16_isv2:
return kernel_selector::weights_layout::os_is_zyx_isv8_osv16_isv2;
case format::os_is_yx_isv8_osv16_isv2:
return kernel_selector::weights_layout::os_is_yx_isv8_osv16_isv2;
case cldnn::format::os_iyx_osv8:
return kernel_selector::weights_layout::os_iyx_osv8;
case format::os_zyxi_osv16:
@@ -657,6 +661,8 @@ cldnn::format::type from_weights_layout(kernel_selector::weights_layout l) {
return cldnn::format::os_iyx_osv16;
case kernel_selector::weights_layout::os_is_yx_isv16_osv16:
return cldnn::format::os_is_yx_isv16_osv16;
case kernel_selector::weights_layout::os_is_yx_osv16_isv2:
return cldnn::format::os_is_yx_osv16_isv2;
case kernel_selector::weights_layout::os_is_yx_osv16_isv16:
return cldnn::format::os_is_yx_osv16_isv16;
case kernel_selector::weights_layout::os_iyx_osv32:

View File

@@ -177,6 +177,17 @@ inline uint get_g_os_is_zyx_osv_isv_index(uint g, uint o, uint i, uint z, uint y
16, \
16)
#define GET_FILTER_OS_IS_YX_OSV16_ISV2_INDEX(prefix, o, i, y, x) \
get_os_is_zyx_osv_isv_index( \
o, i, 0, y, x, \
CAT(prefix, _SIZE_X), \
CAT(prefix, _SIZE_Y), \
1, \
CAT(prefix, _IFM_NUM), \
CAT(prefix, _OFM_NUM), \
16, \
2)
#define GET_FILTER_OS_IS_YX_OSV16_ISV16_INDEX(prefix, o, i, y, x) \
get_os_is_zyx_osv_isv_index( \
o, i, 0, y, x, \

View File

@@ -390,6 +390,8 @@ inline uint FUNC(get_input_index)(uint g, uint o, uint i, uint z, uint y, uint x
defined INPUT0_LAYOUT_GOIYX || \
defined INPUT0_LAYOUT_GIOYX
return GET_FILTER_GOIYX(INPUT0, g, o, i, y, x);
#elif defined INPUT0_LAYOUT_OS_IS_YX_OSV16_ISV2
return GET_FILTER_OS_IS_YX_OSV16_ISV2_INDEX(INPUT0, o, i, y, x);
#elif defined INPUT0_LAYOUT_OS_IS_YX_OSV16_ISV16
return GET_FILTER_OS_IS_YX_OSV16_ISV16_INDEX(INPUT0, o, i, y, x);
#elif defined INPUT0_LAYOUT_OS_IS_ZYX_OSV16_ISV16
@@ -661,6 +663,8 @@ inline uint FUNC(get_output_index)(uint g, uint o, uint i, uint z, uint y, uint
return GET_FILTER_GS_OI_YXS_GSV4_YXSV4_INDEX(OUTPUT, g, o, i, y, x);
#elif defined OUTPUT_LAYOUT_G_OS_IS_YX_ISV16_OSV16
return GET_FILTER_G_OS_IS_YX_ISV16_OSV16_INDEX(OUTPUT, g, o, i, y, x, SUB_GROUP_SIZE);
#elif defined OUTPUT_LAYOUT_OS_IS_YX_OSV16_ISV2
return GET_FILTER_OS_IS_YX_OSV16_ISV2_INDEX(OUTPUT, o, i, y, x);
#elif defined OUTPUT_LAYOUT_OS_IS_YX_OSV16_ISV16
return GET_FILTER_OS_IS_YX_OSV16_ISV16_INDEX(OUTPUT, o, i, y, x);
#elif defined OUTPUT_LAYOUT_OS_IS_ZYX_OSV16_ISV16

View File

@@ -300,6 +300,7 @@ std::string toString(WeightsLayout layout) {
case WeightsLayout::iyxo: return "IYXO";
case WeightsLayout::yxio: return "YXIO";
case WeightsLayout::os_is_yx_isv16_osv16: return "OS_IS_YX_ISV16_OSV16";
case WeightsLayout::os_is_yx_osv16_isv2: return "OS_IS_YX_OSV16_ISV2";
case WeightsLayout::os_is_yx_osv16_isv16: return "OS_IS_YX_OSV16_ISV16";
case WeightsLayout::os_is_zyx_osv16_isv16: return "OS_IS_ZYX_OSV16_ISV16";
case WeightsLayout::os_is_zyx_osv32_isv16: return "OS_IS_ZYX_OSV32_ISV16";

View File

@@ -43,6 +43,7 @@ inline uint32_t SubGroupSize(WeightsLayout l) {
case WeightsLayout::g_os_is_zyx_isv16_osv16:
case WeightsLayout::giy_xs_os_xsv2_osv16__ao32:
case WeightsLayout::g_os_is_yx_isv16_osv16:
case WeightsLayout::os_is_yx_osv16_isv2:
case WeightsLayout::os_is_yx_osv16_isv16:
return 16;
case WeightsLayout::os_i_osv8__ai8:

View File

@@ -83,6 +83,7 @@ WeightsTensor::WeightsChannelArray WeightsTensor::weightsChannelArray {{
{ WeightsLayout::os_i_osv8__ai8, { -1, -1, -1, 0, 1, -1 } },
{ WeightsLayout::os_i_osv16__ai8, { -1, -1, -1, 0, 1, -1 } },
{ WeightsLayout::os_i_osv16, { -1, -1, -1, 0, 1, -1 } },
{ WeightsLayout::os_is_yx_osv16_isv2, { 0, 1, -1, 2, 3, -1 } },
{ WeightsLayout::os_is_yx_osv16_isv16, { 0, 1, -1, 2, 3, -1 } },
{ WeightsLayout::os_is_zyx_osv16_isv16, { 0, 1, 2, 3, 4, -1 } },
{ WeightsLayout::g_os_is_zyx_osv16_isv16, { 0, 1, 2, 3, 4, 5 } },
@@ -867,6 +868,11 @@ NDims WeightsTensor::GetSimpleDims(const std::vector<size_t>& d, WeightsLayout l
case gs_oi_yxs_gsv4_yxsv4:
newDims[4] = RoundUp(newDims[4], 4);
break;
case os_is_yx_osv16_isv2:
assert(newDims.size() == 4);
newDims[2] = RoundUp(newDims[2], 2);
newDims[3] = RoundUp(newDims[3], 16);
break;
case os_is_yx_osv16_isv16:
assert(newDims.size() == 4);
newDims[2] = RoundUp(newDims[2], 16);

View File

@@ -104,6 +104,7 @@ enum WeightsLayout {
os_i_osv8__ai8, // TODO can we drop the alignment form layout name?
os_i_osv16__ai8,
os_i_osv16,
os_is_yx_osv16_isv2,
os_is_yx_osv16_isv16, // wieghts for int8 blocked conv
os_is_zyx_osv16_isv16,
os_is_zyx_osv32_isv16,

View File

@@ -138,6 +138,7 @@ static const std::map<format::type, format_traits> format_traits_map {
FMT_TRAITS(os_is_zyx_isv8_osv16_isv2, 1, 1, 3, 0, {0, 1, 2, 3, 4}, "oizyx", "oixyz", {{1, 8}, {0, 16}, {1, 2}}),
FMT_TRAITS(os_zyxi_osv16, 1, 1, 3, 0, {0, 2, 3, 4, 1}, "ozyxi", "oixyz", {{0, 16}}),
FMT_TRAITS(os_is_yx_isv8_osv16_isv2, 1, 1, 2, 0, {0, 1, 2, 3}, "oiyx", "oixy", {{1, 8}, {0, 16}, {1, 2}}),
FMT_TRAITS(os_is_yx_osv16_isv2, 1, 1, 2, 0, {0, 1, 2, 3}, "oiyx", "oixy", {{0, 16}, {1, 2}}),
FMT_TRAITS(os_is_yx_osv16_isv16, 1, 1, 2, 0, {0, 1, 2, 3}, "oiyx", "oixy", {{0, 16}, {1, 16}}),
FMT_TRAITS(os_is_zyx_osv32_isv16, 1, 1, 3, 0, {0, 1, 2, 3, 4}, "oizyx", "oixyz", {{0, 32}, {1, 16}}),
FMT_TRAITS(os_is_zyx_osv64_isv16, 1, 1, 3, 0, {0, 1, 2, 3, 4}, "oizyx", "oixyz", {{0, 64}, {1, 16}}),