[GPU] Integration oneDNN3.1 (#15804)

* [GPU] Integration oneDNN3.1
* [GPU] Add os_iyx_osv8 format

Signed-off-by: hyunback <hyunback.kim@intel.com>
This commit is contained in:
hyunback kim 2023-03-03 00:18:42 +09:00 committed by GitHub
parent 226bc301dc
commit cb7eeadd62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 23 additions and 1 deletions

View File

@ -201,6 +201,7 @@ struct format {
lstm_weights_dio, ///< dynamic_lstm, direction,
///< than IO (I - input size, O - 4 * hidden_size)
os_is_osv32_isv32_swizzled_by_4, ///< format for weights for 1x1 IMAD convolution
os_iyx_osv8,
os_iyx_osv32__ai32,
iy_xs_os_xsv2_osv8__ao32,
iy_xs_os_xsv2_osv16__ao32,

View File

@ -33,6 +33,9 @@ void select_preferred_formats::run(program& p) {
#ifdef ENABLE_ONEDNN_FOR_GPU
engine.create_onednn_engine(p.get_config());
for (auto n : p.get_processing_order()) {
if (n->is_input() || !_lo.are_data_types_suitable_for_onednn(*n)) {
continue;
}
// Onednn primitive descriptor creation may fail, for example, due to asymmetric weight.
try {
if (n->is_type<convolution>()) {

View File

@ -446,6 +446,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 cldnn::format::os_iyx_osv8:
return kernel_selector::weights_layout::os_iyx_osv8;
case format::os_zyxi_osv16:
return kernel_selector::weights_layout::os_zyxi_osv16;
case format::goiyx:
@ -794,6 +796,8 @@ cldnn::format::type from_weights_layout(kernel_selector::weights_layout l) {
return cldnn::format::g_os_is_yx_osv16_isv4;
case kernel_selector::weights_layout::g_os_is_yx_isv16_osv16:
return cldnn::format::g_os_is_yx_isv16_osv16;
case kernel_selector::weights_layout::os_iyx_osv8:
return cldnn::format::os_iyx_osv8;
case kernel_selector::weights_layout::os_iyx_osv32__ai32:
return cldnn::format::os_iyx_osv32__ai32;
case kernel_selector::weights_layout::os_is_osv32_isv32_swizzled_by_4:

View File

@ -1533,6 +1533,8 @@ inline uint get_os_i_yxs_osv_yxsv4_index(uint o, uint i, uint y, uint x, uint i_
((o) / (sub_group_size))*CAT(prefix, _OFM_PITCH) \
)
#define GET_FILTER_OS_IYX_OSV16(prefix, o, i, y, x, sub_group_size) GET_FILTER_G_OS_IYX_OSV16(prefix, 0, o, i, y, x, sub_group_size)
#define GET_FILTER_GS_OIYX_GSV16(prefix, g, o, i, y, x, sub_group_size) \
CAT(prefix, _OFFSET) + \
((g) % (sub_group_size)) + \

View File

@ -123,6 +123,8 @@ inline uint FUNC(get_input_index)(uint g, uint o, uint i, uint z, uint y, uint x
return GET_FILTER_GOIZYX(INPUT0, g, o, i, z, y, x);
#elif defined INPUT0_LAYOUT_GIOZYX
return GET_FILTER_GIOZYX(INPUT0, g, o, i, z, y, x);
#elif defined INPUT0_LAYOUT_OS_IYX_OSV8
return GET_FILTER_OS_IYX_OSV16(INPUT0, o, i, y, x, 8);
#elif defined INPUT0_LAYOUT_G_OS_IYX_OSV8
return GET_FILTER_G_OS_IYX_OSV16(INPUT0, g, o, i, y, x, 8);
#elif defined INPUT0_LAYOUT_G_OS_IYX_OSV16
@ -374,6 +376,8 @@ inline uint FUNC(get_output_index)(uint g, uint o, uint i, uint z, uint y, uint
return GET_FILTER_OS_ZY_IS_X_OSV8_ISV4_INDEX(OUTPUT, o, i, z, y, x);
#elif defined OUTPUT_LAYOUT_GOIZYX || defined OUTPUT_LAYOUT_GIOZYX
return GET_FILTER_INDEX_5D(OUTPUT, g, o, i, z, y, x);
#elif defined OUTPUT_LAYOUT_OS_IYX_OSV8
return GET_FILTER_OS_IYX_OSV16(OUTPUT, o, i, y, x, 8);
#elif defined OUTPUT_LAYOUT_G_OS_IYX_OSV8
return GET_FILTER_G_OS_IYX_OSV16(OUTPUT, g, o, i, y, x, 8);
#elif defined OUTPUT_LAYOUT_G_OS_IYX_OSV16

View File

@ -306,6 +306,7 @@ std::string toString(WeightsLayout layout) {
case WeightsLayout::os_yxi_osv16: return "OS_YXI_OSV16";
case WeightsLayout::os_iyx_osv16: return "OS_IYX_OSV16";
case WeightsLayout::os_iyx_osv32: return "OS_IYX_OSV32";
case WeightsLayout::os_iyx_osv8: return "OS_IYX_OSV8";
case WeightsLayout::os_iyx_osv32__ai32: return "OS_IYX_OSV32__AI32";
case WeightsLayout::os_iyx_osv64: return "OS_IYX_OSV64";
case WeightsLayout::os_iyx_osv16_rotate_180: return "OS_IYX_OSV16_ROTATE_180";

View File

@ -72,6 +72,7 @@ WeightsTensor::WeightsChannelArray WeightsTensor::weightsChannelArray {{
{ WeightsLayout::yxio, { 2, 3, -1, 1, 0, -1 } },
{ WeightsLayout::os_iyx_osv16, { 0, 1, -1, 2, 3, -1 } },
{ WeightsLayout::os_iyx_osv32, { 0, 1, -1, 2, 3, -1 } },
{ WeightsLayout::os_iyx_osv8, { 0, 1, -1, 2, 3, -1 } },
{ WeightsLayout::os_iyx_osv32__ai32, { 0, 1, -1, 2, 3, -1 } },
{ WeightsLayout::os_iyx_osv64, { 0, 1, -1, 2, 3, -1 } },
{ WeightsLayout::os_iyx_osv16_rotate_180, { 0, 1, -1, 2, 3, -1 } },
@ -591,6 +592,10 @@ NDims WeightsTensor::GetSimpleDims(const std::vector<size_t>& d, WeightsLayout l
assert(newDims.size() == 4);
newDims[3] = RoundUp(newDims[3], 32);
break;
case os_iyx_osv8:
assert(newDims.size() == 4);
newDims[3] = RoundUp(newDims[3], 8);
break;
case os_iyx_osv32__ai32:
assert(newDims.size() == 4);
newDims[2] = RoundUp(newDims[2], 32);

View File

@ -86,6 +86,7 @@ enum WeightsLayout {
os_yxi_osv16,
os_iyx_osv16,
os_iyx_osv32,
os_iyx_osv8,
os_iyx_osv32__ai32,
os_iyx_osv64,
os_is_zyx_isv16_osv16,

View File

@ -139,6 +139,7 @@ static const std::map<format::type, format_traits> format_traits_map {
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}}),
FMT_TRAITS(os_iyx_osv8, 1, 1, 2, 0, {0, 1, 2, 3}, "oiyx", "oixy", {{0, 8}}),
FMT_TRAITS(os_iyx_osv32__ai32, 1, 1, 2, 0, {0, 1, 2, 3}, "oiyx", "oixy", {{0, 32}}),
FMT_TRAITS(i_yxs_os_yxsv2_osv16, 1, 1, 2, 0, {1, 2, 3, 0}, "iyxo", "oixy", {{0, 16}}),
FMT_TRAITS(iy_xs_os_xsv2_osv8__ao32, 1, 1, 2, 0, {1, 2, 3, 0}, "iyxo", "oixy", {{2, 2}, {0, 8}}),

@ -1 +1 @@
Subproject commit d3af87710fcae9561ae22017d45bd670f8858272
Subproject commit ad34c124895690bafd2b110577639824899ecbca