[dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over memcpy

Li, Xiaoyun xiaoyun.li at intel.com
Thu Aug 31 07:24:25 CEST 2017


About gcc FMV, I tried it several days ago.
But the way that the same function name with different attributions only works in C++.
And then I tried GCC6 since it is said that GCC6 would support both C and C++.
But it doesn’t work.

However, if using different function names  with attributions, it works.
And the function with attribution AVX512 means this function would be compiled via AVX512.
So I add attribution for each function and delete –mavx512 in makefile. But I haven’t sent the patch.
Because there are some compilation issues.

Before, only if both compiler and cpu support AVX512 and users want, the AVX512 codes would be compiled since the macro RTE_MACHINE_CPUFLAG_AVX512.
Now, we hope to compiler them all and choose one at runtime based on cpu.
But only above gcc4.9 and newest clang would support AVX512.
So I am thinking adding a macro switch in mk which will determine whether the compiler supports AVX512 and whether users hope to use 512. (don’t need cpu support because it will be determined at run-time)
Only if the compiler supports AVX512 and users hope to use 512, the 512 codes would be compiled.


Best Regards,
Xiaoyun Li



From: Stephen Hemminger [mailto:stephen at networkplumber.org]
Sent: Thursday, August 31, 2017 13:06
To: Lu, Wenzhuo <wenzhuo.lu at intel.com>
Cc: Wang, Zhihong <zhihong.wang at intel.com>; dev at dpdk.org; Zhang, Qi Z <qi.z.zhang at intel.com>; Li, Xiaoyun <xiaoyun.li at intel.com>; Richardson, Bruce <bruce.richardson at intel.com>
Subject: RE: [dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over memcpy

I was referring to gcc multiversion

https://gcc.gnu.org/wiki/FunctionMultiVersioning


On Aug 30, 2017 6:24 PM, "Lu, Wenzhuo" <wenzhuo.lu at intel.com<mailto:wenzhuo.lu at intel.com>> wrote:
Hi Stephen,


> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen at networkplumber.org<mailto:stephen at networkplumber.org>]
> Sent: Thursday, August 31, 2017 2:01 AM
> To: Li, Xiaoyun <xiaoyun.li at intel.com<mailto:xiaoyun.li at intel.com>>
> Cc: Richardson, Bruce <bruce.richardson at intel.com<mailto:bruce.richardson at intel.com>>; dev at dpdk.org<mailto:dev at dpdk.org>; Lu,
> Wenzhuo <wenzhuo.lu at intel.com<mailto:wenzhuo.lu at intel.com>>; Wang, Zhihong
> <zhihong.wang at intel.com<mailto:zhihong.wang at intel.com>>; Zhang, Qi Z <qi.z.zhang at intel.com<mailto:qi.z.zhang at intel.com>>
> Subject: Re: [dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over memcpy
>
> On Fri, 25 Aug 2017 10:06:11 +0800
> Xiaoyun Li <xiaoyun.li at intel.com<mailto:xiaoyun.li at intel.com>> wrote:
>
> > This patch dynamically selects functions of memcpy at run-time based
> > on CPU flags that current machine supports. This patch uses function
> > pointers which are bind to the relative functions at constrctor time.
> > To make AVX512 instructions pass compilation, enable the switch in
> > makefile.
> >
> > Signed-off-by: Xiaoyun Li <xiaoyun.li at intel.com<mailto:xiaoyun.li at intel.com>>
>
> Recent versions of GCC also have better ways to handle this.
I think the assumption of using the instructions is that we believe we can do better than the compiler. If it turns out not, maybe we need to change the instructions back to C. But it's another story.


More information about the dev mailing list