Repository: pytorch
Issue: [Inductor] [CPU] Maxpooling is not vectorized in shufflenet_v2_x1_0
Labels: triaged

### Description
Comparing performances of `shufflenet_v2_x1_0` with backends inductor and IPEX, inductor is 0.74 IPEX. One main reason is the long time consuming of Maxpooling because Maxpooling is not vectorized due to masked load sematic, the other one is reported in https://github.com/pytorch/torchdynamo/issues/1915.

### Profiling and Code snippet
`kernel_cpp_0` is for `torch.ops.aten.max_pool2d_with_indices` implementation.
![image](https://user-images.githubusercontent.com/23010269/203484815-8bcab50f-f33f-4246-b097-d15e4eff12ce.png)
```
kernel_cpp_0 = async_compile.cpp('''
#include "/home/neo/workspace/workspace01_dynamotest/pytorch/torch/_inductor/codegen/cpp_prefix.h"
extern "C" void kernel(const float* __restrict__ in_ptr0,
                       float* __restrict__ out_ptr0,
                       float* __restrict__ out_ptr1,
                       float* __restrict__ out_ptr2)
{
    RECORD_FUNCTION(__FUNCTION__, c10::ArrayRef<c10::IValue>({})); 
    #pragma omp parallel num_threads(28)
    {
        #pragma omp for 
        for(long i0=0; i0<64; i0+=1)
        {
            #pragma GCC ivdep
            for(long i1=0; i1<56; i1+=1)
            {
                #pragma GCC ivdep
                for(long i2=0; i2<56; i2+=1)
                {
                    #pragma GCC ivdep
                    for(long i3=0; i3<24; i3+=1)
                    {
                        {
                            {
                                auto tmp0 = static_cast<long>((-1) + (2*i1));
                                auto tmp1 = static_cast<long>(0);
                                auto tmp2 = tmp0 >= tmp1;
                                auto tmp3 = static_cast<long>(112);
                                auto tmp4 = tmp0 < tmp3;
                                auto tmp5 = tmp2 & tmp4;
                                auto tmp6 = static_cast<long>((-1) + (2*i2));
                                auto tmp7 = tmp6 >= tmp1;
                                auto tmp8 = tmp6 < tmp3;
                                auto tmp9 = tmp7 & tmp8;
                                auto tmp10 = tmp5 & tmp9;
                                float tmp11 = -std::numeric_limits<float>::infinity();
                                if(tmp10)
                                {
                                    auto tmp12 = in_ptr0[(-2712) + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp11 = tmp12;
                                }
                                auto tmp13 = static_cast<long>((-113) + (2*i2) + (224*i1));
                                auto tmp14 = static_cast<long>(2*i2);
                                auto tmp15 = tmp14 >= tmp1;
                                auto tmp16 = tmp14 < tmp3;
                                auto tmp17 = tmp15 & tmp16;
                                auto tmp18 = tmp5 & tmp17;
                                float tmp19 = -std::numeric_limits<float>::infinity();
                                if(tmp18)
                                {
                                    auto tmp20 = in_ptr0[(-2688) + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp19 = tmp20;
                                }
                                auto tmp21 = static_cast<long>((-112) + (2*i2) + (224*i1));
                                auto tmp22 = tmp19 > tmp11;
                                auto tmp23 = tmp22 ? tmp21 : tmp13;
                                auto tmp24 = std::max(tmp19, tmp11);
                                auto tmp25 = static_cast<long>(1 + (2*i2));
                                auto tmp26 = tmp25 >= tmp1;
                                auto tmp27 = tmp25 < tmp3;
                                auto tmp28 = tmp26 & tmp27;
                                auto tmp29 = tmp5 & tmp28;
                                float tmp30 = -std::numeric_limits<float>::infinity();
                                if(tmp29)
                                {
                                    auto tmp31 = in_ptr0[(-2664) + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp30 = tmp31;
                                }
                                auto tmp32 = static_cast<long>((-111) + (2*i2) + (224*i1));
                                auto tmp33 = tmp30 > tmp24;
                                auto tmp34 = tmp33 ? tmp32 : tmp23;
                                auto tmp35 = std::max(tmp30, tmp24);
                                auto tmp36 = static_cast<long>(2*i1);
                                auto tmp37 = tmp36 >= tmp1;
                                auto tmp38 = tmp36 < tmp3;
                                auto tmp39 = tmp37 & tmp38;
                                auto tmp40 = tmp39 & tmp9;
                                float tmp41 = -std::numeric_limits<float>::infinity();
                                if(tmp40)
                                {
                                    auto tmp42 = in_ptr0[(-24) + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp41 = tmp42;
                                }
                                auto tmp43 = static_cast<long>((-1) + (2*i2) + (224*i1));
                                auto tmp44 = tmp41 > tmp35;
                                auto tmp45 = tmp44 ? tmp43 : tmp34;
                                auto tmp46 = std::max(tmp41, tmp35);
                                auto tmp47 = tmp39 & tmp17;
                                float tmp48 = -std::numeric_limits<float>::infinity();
                                if(tmp47)
                                {
                                    auto tmp49 = in_ptr0[i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp48 = tmp49;
                                }
                                auto tmp50 = static_cast<long>((2*i2) + (224*i1));
                                auto tmp51 = tmp48 > tmp46;
                                auto tmp52 = tmp51 ? tmp50 : tmp45;
                                auto tmp53 = std::max(tmp48, tmp46);
                                auto tmp54 = tmp39 & tmp28;
                                float tmp55 = -std::numeric_limits<float>::infinity();
                                if(tmp54)
                                {
                                    auto tmp56 = in_ptr0[24 + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp55 = tmp56;
                                }
                                auto tmp57 = static_cast<long>(1 + (2*i2) + (224*i1));
                                auto tmp58 = tmp55 > tmp53;
                                auto tmp59 = tmp58 ? tmp57 : tmp52;
                                auto tmp60 = std::max(tmp55, tmp53);
                                auto tmp61 = static_cast<long>(1 + (2*i1));
                                auto tmp62 = tmp61 >= tmp1;
                                auto tmp63 = tmp61 < tmp3;
                                auto tmp64 = tmp62 & tmp63;
                                auto tmp65 = tmp64 & tmp9;
                                float tmp66 = -std::numeric_limits<float>::infinity();
                                if(tmp65)
                                {
                                    auto tmp67 = in_ptr0[2664 + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp66 = tmp67;
                                }
                                auto tmp68 = static_cast<long>(111 + (2*i2) + (224*i1));
                                auto tmp69 = tmp66 > tmp60;
                                auto tmp70 = tmp69 ? tmp68 : tmp59;
                                auto tmp71 = std::max(tmp66, tmp60);
                                auto tmp72 = tmp64 & tmp17;
                                float tmp73 = -std::numeric_limits<float>::infinity();
                                if(tmp72)
                                {
                                    auto tmp74 = in_ptr0[2688 + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp73 = tmp74;
                                }
                                auto tmp75 = static_cast<long>(112 + (2*i2) + (224*i1));
                                auto tmp76 = tmp73 > tmp71;
                                auto tmp77 = tmp76 ? tmp75 : tmp70;
                                auto tmp78 = std::max(tmp73, tmp71);
                                auto tmp79 = tmp64 & tmp28;
                                float tmp80 = -std::numeric_limits<float>::infinity();
                                if(tmp79)
                                {
                                    auto tmp81 = in_ptr0[2712 + i3 + (48*i2) + (5376*i1) + (301056*i0)];
                                    tmp80 = tmp81;
                                }
                                auto tmp82 = static_cast<long>(113 + (2*i2) + (224*i1));
                                auto tmp83 = tmp80 > tmp78;
                                auto tmp84 = tmp83 ? tmp82 : tmp77;
                                auto tmp85 = std::max(tmp80, tmp78);
                                out_ptr0[i3 + (24*i2) + (1344*i1) + (75264*i0)] = tmp85;
                            }
                        }
                    }
                }
            }
        }
        #pragma omp for 
        for(long i0=0; i0<64; i0+=1)
        {
            #pragma GCC ivdep
            for(long i1=0; i1<24; i1+=1)
            {
                #pragma GCC ivdep
                for(long i2=0; i2<3136; i2+=1)
                {
                    {
                        {
                            auto tmp0 = out_ptr0[i1 + (24*i2) + (75264*i0)];
                            out_ptr1[i1 + (24*i2) + (75264*i0)] = tmp0;
                            out_ptr2[i1 + (24*i2) + (75264*i0)] = tmp0;
                        }
                    }
                }
            }
        }
    }
}
''')
```

### Minified repro
`python benchmarks/dynamo/torchbench.py --performance --float32 -dcpu -n50 --inductor --no-skip --dashboard -k "shufflenet_v2_x1_0" --cold_start_latency --channels-last`

cc @EikanWang @jgong5