[CPU] MVN nspc kernel optimization (#13268)

This commit is contained in:
Chenhu Wang authored and GitHub committed 2022-11-17 15:31:08 +04:00
1 parent 807279276b
commit ade90b2043
3 files changed
+697 -191

No files matched your search

File diff suppressed because it is too large. Load diff
+9 -6
View File
@@ -14,8 +14,14 @@ namespace ov {
namespace intel_cpu {
namespace node {
enum MVNLayoutType {
mvn_planar,
mvn_block,
mvn_by_channel
};
struct jit_mvn_config_params {
bool planar_layout;
MVNLayoutType layout;
bool across_channels;
bool normalize_variance;
InferenceEngine::Precision src_prc;
@@ -69,6 +75,7 @@ struct jit_uni_mvn_kernel {
jit_mvn_config_params jcp_;
const dnnl_primitive_attr &attr_;
int optimized_scaleshift_num = 0;
};
class MVN : public Node {
@@ -102,11 +109,6 @@ public:
OUTSIDE_SQRT
};
enum MVNLayoutType {
planar,
block,
by_channel
};
struct MVNAttrs {
MVNLayoutType layout;
std::tuple<size_t, size_t, size_t, size_t, size_t> shape5D;
@@ -152,6 +154,7 @@ private:
private:
void mvn_pln(const uint8_t *in_ptr_, uint8_t *out_ptr_, const void *post_ops_data_);
void mvn_blk(const uint8_t *in_ptr_, uint8_t *out_ptr_, const void *post_ops_data_);
void mvn_nspc(const uint8_t *in_ptr_, uint8_t *out_ptr_, const void *post_ops_data_);
std::shared_ptr<jit_uni_mvn_mean_variance_kernel> mvn_mean_kernel;
std::shared_ptr<jit_uni_mvn_mean_variance_kernel> mvn_variance_kernel;
@@ -433,13 +433,17 @@ const std::vector<ov::Shape> inputShapesStatic_3D = {
const std::vector<ov::Shape> inputShapesStatic_4D = {
{1, 7, 3, 5},
{1, 15, 9, 5},
{4, 41, 6, 9}
{4, 41, 6, 9},
// cover channel case 4*16*2+16+3=147
{1, 147, 2, 2}
};
const std::vector<ov::Shape> inputShapesStatic_5D = {
{1, 32, 8, 1, 6},
{1, 9, 1, 15, 9},
{6, 64, 6, 1, 18}
{6, 64, 6, 1, 18},
// cover channel case 4*16*2+16+9=153
{6, 153, 2, 2, 2}
};
const auto Mvn2DStatic = ::testing::Combine(