Re: [dpdk-dev] [PATCH v4 1/8] eal: introduce zmm type for AVX 512-bit
From: David Marchand <hidden>
Date: 2020-07-09 15:20:42
On Thu, Jul 9, 2020 at 4:52 PM Medvedkin, Vladimir [off-list ref] wrote:
quoted
quoted
+ +#define ZMM_SIZE (sizeof(__x86_zmm_t)) +#define ZMM_MASK (ZMM_SIZE - 1)Macros in a public header need a RTE_ prefix + this is x86 specific, then RTE_X86_. Looking at the whole applied series: $ git grep -lw ZMM_SIZE lib/librte_eal/x86/include/rte_vect.h $ git grep -lw ZMM_MASK lib/librte_eal/x86/include/rte_vect.h So I wonder if we need to export it or we can instead just #undef after the struct definition.I think it's better to undef it
Even if you undef the macro, please still prefix it. This is to avoid conflicts with macros defined before including this rte_vect.h header.
quoted
quoted
+ +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)]; +} __rte_aligned(ZMM_SIZE) __rte_x86_zmm_t;I don't understand this forced alignment statement. Would not natural alignment be enough, since all fields in this union have the same size?Some compilers won't align this union https://mails.dpdk.org/archives/dev/2020-March/159591.html
Ok, interesting, I will try to keep in mind. -- David Marchand