From c54a05626aae0a1780e29826a9041789e586aee4 Mon Sep 17 00:00:00 2001 From: Anton Voronov Date: Thu, 10 Feb 2022 14:54:15 +0300 Subject: [PATCH] simple reorder: disabled unused bf16 primitives --- src/cpu/reorder/cpu_reorder_comp_s8_s8.cpp | 2 ++ src/cpu/reorder/cpu_reorder_regular_bf16.cpp | 21 ++++++++++++------- .../reorder/cpu_reorder_regular_f32_bf16.cpp | 20 ++++++++++++++---- src/cpu/reorder/cpu_reorder_regular_u8.cpp | 4 +--- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/cpu/reorder/cpu_reorder_comp_s8_s8.cpp b/src/cpu/reorder/cpu_reorder_comp_s8_s8.cpp index 72cc1acc552..7f1ea668f48 100644 --- a/src/cpu/reorder/cpu_reorder_comp_s8_s8.cpp +++ b/src/cpu/reorder/cpu_reorder_comp_s8_s8.cpp @@ -127,7 +127,9 @@ const impl_list_map_t comp_s8_s8_impl_list_map { REG_REORDER_P(REG_SR(s8, ihwo, s8, OIhw16i16o4i, fmt_order_keep, spec_conv_req_comp)) REG_REORDER_P(REG_SR(s8, oihw, s8, OIhw16i16o4i, fmt_order_keep, spec_conv_req_comp)) REG_REORDER_P(REG_SR(s8, hwio, s8, OIhw16i16o4i, fmt_order_keep, spec_conv_req_comp)) +#endif REG_REORDER_P(REG_SR(s8, iohw, s8, OIhw4i16o4i, fmt_order_keep, spec_conv_req_comp)) +#ifdef ENABLE_UNUSED_PRIM REG_REORDER_P(REG_SR(s8, iohw, s8, OIhw2i8o4i, fmt_order_keep, spec_conv_req_comp)) REG_REORDER_P(REG_SR(s8, iohw, s8, OIhw4o4i, fmt_order_keep, spec_conv_req_comp)) #endif diff --git a/src/cpu/reorder/cpu_reorder_regular_bf16.cpp b/src/cpu/reorder/cpu_reorder_regular_bf16.cpp index 63a6fb7c811..3e1f207f35e 100644 --- a/src/cpu/reorder/cpu_reorder_regular_bf16.cpp +++ b/src/cpu/reorder/cpu_reorder_regular_bf16.cpp @@ -29,21 +29,26 @@ const impl_list_map_t regular_bf16_impl_list_map { REG_REORDER_P(DNNL_X64_ONLY(CPU_REORDER_INSTANCE(x64_jit_blk_reorder_t))) REG_REORDER_P(DNNL_X64_ONLY(CPU_REORDER_INSTANCE(x64_jit_uni_reorder_t))) -// todo: [AV] disable unused simple reorder primitives - REG_REORDER_P(REG_SR_BIDIR(bf16, any, f32, nCw16c)) +#ifdef ENABLE_UNUSED_PRIM + REG_REORDER_P(REG_SR(bf16, any, f32, nCw16c, fmt_order_keep)) +#endif + REG_REORDER_P(REG_SR(bf16, any, f32, nCw16c, fmt_order_reverse)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, f32, nChw16c)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, f32, nCdhw16c)) - +#ifdef ENABLE_UNUSED_PRIM REG_REORDER_P(REG_SR_BIDIR(bf16, any, s8, nChw16c)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, s8, nCdhw16c)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, u8, nChw16c)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, u8, nCdhw16c)) - - REG_REORDER_P(REG_SR_BIDIR(bf16, any, bf16, nCw16c)) +#endif + REG_REORDER_P(REG_SR(bf16, any, bf16, nCw16c, fmt_order_keep)) +#ifdef ENABLE_UNUSED_PRIM + REG_REORDER_P(REG_SR(bf16, any, bf16, nCw16c, fmt_order_reverse)) +#endif REG_REORDER_P(REG_SR_BIDIR(bf16, any, bf16, nChw16c)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, bf16, nCdhw16c)) - +#ifdef ENABLE_UNUSED_PRIM REG_REORDER_P(REG_SR_BIDIR(bf16, any, f32, OIdhw16o16i)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, f32, OIdhw16i16o)) @@ -52,11 +57,13 @@ const impl_list_map_t regular_bf16_impl_list_map { REG_REORDER_P(REG_SR_BIDIR(bf16, any, u8, OIdhw16o16i)) REG_REORDER_P(REG_SR_BIDIR(bf16, any, u8, OIdhw16i16o)) - +#endif REG_REORDER_P(REG_SR(bf16, any, bf16, any, fmt_order_any, spec_reference)) REG_REORDER_P(REG_SR(bf16, any, f32, any, fmt_order_any, spec_reference)) +#ifdef ENABLE_UNUSED_PRIM REG_REORDER_P(REG_SR(bf16, any, s8, any, fmt_order_any, spec_reference)) REG_REORDER_P(REG_SR(bf16, any, u8, any, fmt_order_any, spec_reference)) +#endif nullptr, }}, diff --git a/src/cpu/reorder/cpu_reorder_regular_f32_bf16.cpp b/src/cpu/reorder/cpu_reorder_regular_f32_bf16.cpp index 7559a9ac9dc..c8d522f2214 100644 --- a/src/cpu/reorder/cpu_reorder_regular_f32_bf16.cpp +++ b/src/cpu/reorder/cpu_reorder_regular_f32_bf16.cpp @@ -30,20 +30,32 @@ const impl_list_map_t regular_f32_bf16_impl_list_map { REG_REORDER_P(DNNL_X64_ONLY(CPU_REORDER_INSTANCE(x64_jit_blk_reorder_t))) REG_REORDER_P(DNNL_X64_ONLY(CPU_REORDER_INSTANCE(x64_jit_uni_reorder_t))) -// todo: [AV] disable unused simple reorder primitives - REG_REORDER_P(REG_SR_BIDIR(f32, ncw, bf16, nCw16c)) - REG_REORDER_P(REG_SR_BIDIR(f32, nchw, bf16, nChw16c)) + REG_REORDER_P(REG_SR(f32, ncw, bf16, nCw16c, fmt_order_keep)) +#ifdef ENABLE_UNUSED_PRIM + REG_REORDER_P(REG_SR(f32, ncw, bf16, nCw16c, fmt_order_reverse)) +#endif + REG_REORDER_P(REG_SR(f32, nchw, bf16, nChw16c, fmt_order_keep)) +#ifdef ENABLE_UNUSED_PRIM + REG_REORDER_P(REG_SR(f32, nchw, bf16, nChw16c, fmt_order_reverse)) +#endif REG_REORDER_P(REG_SR_BIDIR(f32, any, bf16, nChw16c)) - REG_REORDER_P(REG_SR_BIDIR(f32, any, bf16, nCdhw16c)) + REG_REORDER_P(REG_SR(f32, any, bf16, nCdhw16c, fmt_order_keep)) +#ifdef ENABLE_UNUSED_PRIM + REG_REORDER_P(REG_SR(f32, any, bf16, nCdhw16c, fmt_order_reverse)) +#endif REG_REORDER_P(REG_SR(f32, oihw, bf16, OIhw8i16o2i, fmt_order_keep)) +#ifdef ENABLE_UNUSED_PRIM REG_REORDER_P(REG_SR(f32, goihw, bf16, gOIhw8i16o2i, fmt_order_keep)) +#endif REG_REORDER_P(REG_SR(f32, oihw, bf16, OIhw8o16i2o, fmt_order_keep)) +#ifdef ENABLE_UNUSED_PRIM REG_REORDER_P(REG_SR(f32, goihw, bf16, gOIhw8o16i2o, fmt_order_keep)) REG_REORDER_P(REG_SR(f32, oihw, bf16, IOhw8o16i2o, fmt_order_keep)) REG_REORDER_P(REG_SR(f32, goihw, bf16, gIOhw8o16i2o, fmt_order_keep)) REG_REORDER_P(REG_SR(f32, oihw, bf16, OIhw16i16o, fmt_order_keep)) REG_REORDER_P(REG_SR(f32, goihw, bf16, gOIhw16i16o, fmt_order_keep)) +#endif REG_REORDER_P(REG_SR(f32, any, bf16, any, fmt_order_any, spec_reference)) diff --git a/src/cpu/reorder/cpu_reorder_regular_u8.cpp b/src/cpu/reorder/cpu_reorder_regular_u8.cpp index 4a5bf510aaa..2c5fdfe1427 100644 --- a/src/cpu/reorder/cpu_reorder_regular_u8.cpp +++ b/src/cpu/reorder/cpu_reorder_regular_u8.cpp @@ -57,10 +57,8 @@ const impl_list_map_t regular_u8_impl_list_map { REG_REORDER_P(REG_SR_BIDIR(u8, any, s32, nChw16c)) REG_REORDER_P(REG_SR_BIDIR(u8, any, bf16, nChw16c)) REG_REORDER_P(REG_SR_BIDIR(u8, any, s8, nChw16c)) - - REG_REORDER_P(REG_SR(u8, any, u8, nChw16c, fmt_order_keep)) #endif - REG_REORDER_P(REG_SR(u8, any, u8, nChw16c, fmt_order_reverse)) + REG_REORDER_P(REG_SR_BIDIR(u8, any, u8, nChw16c)) REG_REORDER_P(REG_SR(u8, any, f32, nChw8c, fmt_order_keep)) #ifdef ENABLE_UNUSED_PRIM REG_REORDER_P(REG_SR(u8, any, f32, nChw8c, fmt_order_reverse))