[v3,1/8] eal: introduce zmm type for AVX 512-bit
diff mbox series

Message ID 895e07b9a83234251f3a6b6a43dc360ee9b7edc6.1589890262.git.vladimir.medvedkin@intel.com
State Superseded, archived
Delegated to: David Marchand
Headers show
Series
  • fib: implement AVX512 vector lookup
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch warning coding style issues

Commit Message

Medvedkin, Vladimir May 19, 2020, 12:12 p.m. UTC
New data type to manipulate 512 bit AVX values.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
 lib/librte_eal/x86/include/rte_vect.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Ananyev, Konstantin June 24, 2020, 1:14 p.m. UTC | #1
> 
> New data type to manipulate 512 bit AVX values.
> 
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> ---
>  lib/librte_eal/x86/include/rte_vect.h | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/lib/librte_eal/x86/include/rte_vect.h b/lib/librte_eal/x86/include/rte_vect.h
> index df5a607..ffe4f7d 100644
> --- a/lib/librte_eal/x86/include/rte_vect.h
> +++ b/lib/librte_eal/x86/include/rte_vect.h
> @@ -90,6 +90,26 @@ __extension__ ({                 \
>  })
>  #endif /* (defined(__ICC) && __ICC < 1210) */
> 
> +#ifdef __AVX512F__
> +
> +typedef __m512i __x86_zmm_t;
> +
> +#define	ZMM_SIZE	(sizeof(__x86_zmm_t))
> +#define	ZMM_MASK	(ZMM_SIZE - 1)
> +
> +typedef union __rte_x86_zmm  {
> +	__x86_zmm_t	 z;
> +	ymm_t    y[ZMM_SIZE / sizeof(ymm_t)];
> +	xmm_t    x[ZMM_SIZE / sizeof(xmm_t)];
> +	uint8_t  u8[ZMM_SIZE / sizeof(uint8_t)];
> +	uint16_t u16[ZMM_SIZE / sizeof(uint16_t)];
> +	uint32_t u32[ZMM_SIZE / sizeof(uint32_t)];
> +	uint64_t u64[ZMM_SIZE / sizeof(uint64_t)];
> +	double   pd[ZMM_SIZE / sizeof(double)];
> +} __attribute__((__aligned__(ZMM_SIZE)))  __rte_x86_zmm_t;
> +
> +#endif /* __AVX512F__ */
> +
>  #ifdef __cplusplus
>  }
>  #endif
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.7.4
Thomas Monjalon July 6, 2020, 5:28 p.m. UTC | #2
19/05/2020 14:12, Vladimir Medvedkin:
> New data type to manipulate 512 bit AVX values.
[...]
> +typedef union __rte_x86_zmm  {
> +	__x86_zmm_t	 z;
> +	ymm_t    y[ZMM_SIZE / sizeof(ymm_t)];
> +	xmm_t    x[ZMM_SIZE / sizeof(xmm_t)];
> +	uint8_t  u8[ZMM_SIZE / sizeof(uint8_t)];
> +	uint16_t u16[ZMM_SIZE / sizeof(uint16_t)];
> +	uint32_t u32[ZMM_SIZE / sizeof(uint32_t)];
> +	uint64_t u64[ZMM_SIZE / sizeof(uint64_t)];
> +	double   pd[ZMM_SIZE / sizeof(double)];
> +} __attribute__((__aligned__(ZMM_SIZE)))  __rte_x86_zmm_t;

Should be __rte_aligned(ZMM_SIZE)

Patch
diff mbox series

diff --git a/lib/librte_eal/x86/include/rte_vect.h b/lib/librte_eal/x86/include/rte_vect.h
index df5a607..ffe4f7d 100644
--- a/lib/librte_eal/x86/include/rte_vect.h
+++ b/lib/librte_eal/x86/include/rte_vect.h
@@ -90,6 +90,26 @@  __extension__ ({                 \
 })
 #endif /* (defined(__ICC) && __ICC < 1210) */
 
+#ifdef __AVX512F__
+
+typedef __m512i __x86_zmm_t;
+
+#define	ZMM_SIZE	(sizeof(__x86_zmm_t))
+#define	ZMM_MASK	(ZMM_SIZE - 1)
+
+typedef union __rte_x86_zmm  {
+	__x86_zmm_t	 z;
+	ymm_t    y[ZMM_SIZE / sizeof(ymm_t)];
+	xmm_t    x[ZMM_SIZE / sizeof(xmm_t)];
+	uint8_t  u8[ZMM_SIZE / sizeof(uint8_t)];
+	uint16_t u16[ZMM_SIZE / sizeof(uint16_t)];
+	uint32_t u32[ZMM_SIZE / sizeof(uint32_t)];
+	uint64_t u64[ZMM_SIZE / sizeof(uint64_t)];
+	double   pd[ZMM_SIZE / sizeof(double)];
+} __attribute__((__aligned__(ZMM_SIZE)))  __rte_x86_zmm_t;
+
+#endif /* __AVX512F__ */
+
 #ifdef __cplusplus
 }
 #endif