[x265] [PATCH 248 of 307] x86: AVX512 interp_8tap_vert_ps_32xN

mythreyi at multicorewareinc.com mythreyi at multicorewareinc.com
Sat Apr 7 04:34:06 CEST 2018


# HG changeset patch
# User Jayashri Murugan <jayashri at multicorewareinc.com>
# Date 1512717026 -19800
#      Fri Dec 08 12:40:26 2017 +0530
# Node ID 3d7a32f87793527d40d17024c1bb415a95cbdeae
# Parent  e2a41cef45ae06d73c0c17d99a853df6e81562ee
x86: AVX512 interp_8tap_vert_ps_32xN

Size  |  AVX2 performance | AVX512 performance
----------------------------------------------
32x8  |      20.52x       |      30.65x
32x16 |      23.42x       |      32.85x
32x24 |      22.88x       |      33.53x
32x32 |      24.74x       |      33.35x
32x64 |      25.03x       |      34.50x

diff -r e2a41cef45ae -r 3d7a32f87793 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Dec 07 11:53:44 2017 +0530
+++ b/source/common/x86/asm-primitives.cpp	Fri Dec 08 12:40:26 2017 +0530
@@ -5197,6 +5197,12 @@
         p.pu[LUMA_64x32].luma_vps = PFX(interp_8tap_vert_ps_64x32_avx512);
         p.pu[LUMA_64x48].luma_vps = PFX(interp_8tap_vert_ps_64x48_avx512);
         p.pu[LUMA_64x64].luma_vps = PFX(interp_8tap_vert_ps_64x64_avx512);
+
+        p.pu[LUMA_32x8].luma_vps = PFX(interp_8tap_vert_ps_32x8_avx512);
+        p.pu[LUMA_32x16].luma_vps = PFX(interp_8tap_vert_ps_32x16_avx512);
+        p.pu[LUMA_32x32].luma_vps = PFX(interp_8tap_vert_ps_32x32_avx512);
+        p.pu[LUMA_32x24].luma_vps = PFX(interp_8tap_vert_ps_32x24_avx512);
+        p.pu[LUMA_32x64].luma_vps = PFX(interp_8tap_vert_ps_32x64_avx512);
     }
 #endif
 }
diff -r e2a41cef45ae -r 3d7a32f87793 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Thu Dec 07 11:53:44 2017 +0530
+++ b/source/common/x86/ipfilter8.asm	Fri Dec 08 12:40:26 2017 +0530
@@ -14253,8 +14253,7 @@
     FILTER_VER_PP_LUMA_16xN_AVX512 32
     FILTER_VER_PP_LUMA_16xN_AVX512 64
 %endif
-
-%macro PROCESS_LUMA_VERT_PP_32x4_AVX512 0
+%macro PROCESS_LUMA_VERT_32x4_AVX512 1
     lea                   r5,                 [r0 + 4 * r1]
     movu                  ym1,                [r0]
     vinserti32x8          m1,                 [r0 + 2 * r1],       1
@@ -14331,7 +14330,7 @@
     paddw                 m1,                 m13
     paddw                 m2,                 m14
     paddw                 m3,                 m15
-
+%ifidn %1,pp
     pmulhrsw              m0,                 m7
     pmulhrsw              m1,                 m7
     pmulhrsw              m2,                 m7
@@ -14343,20 +14342,36 @@
     movu                  [r2 + r3],          ym2
     vextracti32x8         [r2 + 2 * r3],      m0,                  1
     vextracti32x8         [r2 + r7],          m2,                  1
-%endmacro
-
+%else
+    psubw                 m0,                 m7
+    psubw                 m1,                 m7
+    psubw                 m2,                 m7
+    psubw                 m3,                 m7
+
+    mova                  m12,                 m16
+    mova                  m13,                 m17
+    mova                  m14,                 m16
+    mova                  m15,                 m17
+
+    vpermi2q              m12,                 m0,                m1
+    vpermi2q              m13,                 m0,                m1
+    vpermi2q              m14,                 m2,                m3
+    vpermi2q              m15,                 m2,                m3
+
+    movu                  [r2],               m12
+    movu                  [r2 + r3],          m14
+    movu                  [r2 + 2 * r3],      m13
+    movu                  [r2 + r7],          m15
+%endif
+%endmacro
 ;-----------------------------------------------------------------------------------------------------------------
 ; void interp_4tap_vert(int16_t *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx)
 ;-----------------------------------------------------------------------------------------------------------------
-%macro FILTER_VER_PP_LUMA_32xN_AVX512 1
+%macro FILTER_VERT_LUMA_32xN_AVX512 2
 INIT_ZMM avx512
-cglobal interp_8tap_vert_pp_32x%1, 5, 8, 16
+cglobal interp_8tap_vert_%1_32x%2, 5, 8, 18
     mov                   r4d,                r4m
     shl                   r4d,                8
-    lea                   r6,                 [3 * r1]
-    lea                   r7,                 [3 * r3]
-    sub                   r0,                 r6
-
 %ifdef PIC
     lea                   r5,                 [tab_LumaCoeffVer_32_avx512]
     mova                  m8,                 [r5 + r4]
@@ -14369,27 +14384,43 @@
     mova                  m10,                [tab_LumaCoeffVer_32_avx512 + r4 + 2 * mmsize]
     mova                  m11,                [tab_LumaCoeffVer_32_avx512 + r4 + 3 * mmsize]
 %endif
-
+%ifidn %1, pp
     vbroadcasti32x8       m7,                 [pw_512]
-%rep %1/4 - 1
-    PROCESS_LUMA_VERT_PP_32x4_AVX512
+%else
+    add                   r3d,                r3d
+    vbroadcasti32x8       m7,                 [pw_2000]
+    mova                  m16,                [interp4_vps_store1_avx512]
+    mova                  m17,                [interp4_vps_store2_avx512]
+%endif
+
+    lea                   r6,                 [3 * r1]
+    lea                   r7,                 [3 * r3]
+    sub                   r0,                 r6
+
+%rep %2/4 - 1
+    PROCESS_LUMA_VERT_32x4_AVX512 %1
     lea                   r0,                 [r0 + 4 * r1]
     lea                   r2,                 [r2 + 4 * r3]
 %endrep
-    PROCESS_LUMA_VERT_PP_32x4_AVX512
+    PROCESS_LUMA_VERT_32x4_AVX512 %1
     RET
 %endmacro
 
 %if ARCH_X86_64
-    FILTER_VER_PP_LUMA_32xN_AVX512 8
-    FILTER_VER_PP_LUMA_32xN_AVX512 16
-    FILTER_VER_PP_LUMA_32xN_AVX512 24
-    FILTER_VER_PP_LUMA_32xN_AVX512 32
-    FILTER_VER_PP_LUMA_32xN_AVX512 64
-%endif
-
+    FILTER_VERT_LUMA_32xN_AVX512 pp, 8
+    FILTER_VERT_LUMA_32xN_AVX512 pp, 16
+    FILTER_VERT_LUMA_32xN_AVX512 pp, 24
+    FILTER_VERT_LUMA_32xN_AVX512 pp, 32
+    FILTER_VERT_LUMA_32xN_AVX512 pp, 64
+
+    FILTER_VERT_LUMA_32xN_AVX512 ps, 8
+    FILTER_VERT_LUMA_32xN_AVX512 ps, 16
+    FILTER_VERT_LUMA_32xN_AVX512 ps, 24
+    FILTER_VERT_LUMA_32xN_AVX512 ps, 32
+    FILTER_VERT_LUMA_32xN_AVX512 ps, 64
+%endif
 %macro PROCESS_LUMA_VERT_PP_48x8_AVX512 0
-    PROCESS_LUMA_VERT_PP_32x4_AVX512
+    PROCESS_LUMA_VERT_32x4_AVX512 pp
     lea                   r8,                 [r4 + 4 * r1]
     movu                  ym1,                [r5]
     vinserti32x8          m1,                 [r5 + 2 * r1],       1


More information about the x265-devel mailing list