DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over
@ 2017-09-01 10:54 O Mahony, Billy
  2017-09-04  2:20 ` Li, Xiaoyun
  0 siblings, 1 reply; 2+ messages in thread
From: O Mahony, Billy @ 2017-09-01 10:54 UTC (permalink / raw)
  To: dev; +Cc: stephen, Lu, Wenzhuo, Wang, Zhihong, Zhang, Qi Z, Richardson, Bruce

Hi,



FYI, Just to note a bug I found when using FMV with -O flag:



https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81128



I see the fix is on the trunk now but not sure if it's been back ported to other point releases so dev's might need to be careful about which gcc versions they use and be aware that compiler support in the wild could be an issue. The only version marked 'Known to work' on the bug ticket is 8.0.



Apologies if this does not get added to the correct thread - I  don't subscribe to this dev list so I didn't have the original email to reply to.



Regards,

Billy.


> -------- Forwarded Message --------

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

> memcpy

> Date: Thu, 31 Aug 2017 05:24:25 +0000

> From: Li, Xiaoyun <xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com>>

> To: Stephen Hemminger <stephen@networkplumber.org<mailto:stephen@networkplumber.org>>, Lu, Wenzhuo

> <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com>>

> CC: Wang, Zhihong <zhihong.wang@intel.com<mailto:zhihong.wang@intel.com>>, dev@dpdk.org<mailto:dev@dpdk.org>

> <dev@dpdk.org<mailto:dev@dpdk.org>>, Zhang, Qi Z <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com>>, Richardson, Bruce

> <bruce.richardson@intel.com<mailto:bruce.richardson@intel.com>>

>

> 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@networkplumber.org]

> Sent: Thursday, August 31, 2017 13:06

> To: Lu, Wenzhuo <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com>>

> Cc: Wang, Zhihong <zhihong.wang@intel.com<mailto:zhihong.wang@intel.com>>; dev@dpdk.org<mailto:dev@dpdk.org>; Zhang, Qi Z

> <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com>>; Li, Xiaoyun <xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com>>;

> Richardson, Bruce <bruce.richardson@intel.com<mailto:bruce.richardson@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@intel.com<mailto:wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com%3cmailto:wenzhuo.lu@intel.com>>> wrote:

> Hi Stephen,

>

>

> > -----Original Message-----

> > From: Stephen Hemminger

> >

> [mailto:stephen@networkplumber.org<mailto:stephen@networkplumber.o

> rg>]

> > Sent: Thursday, August 31, 2017 2:01 AM

> > To: Li, Xiaoyun <xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com%3cmailto:xiaoyun.li@intel.com>>>

> > Cc: Richardson, Bruce

> > <bruce.richardson@intel.com<mailto:bruce.richardson@intel.com<mailto:bruce.richardson@intel.com%3cmailto:bruce.richardson@intel.com>>>;

> > dev@dpdk.org<mailto:dev@dpdk.org<mailto:dev@dpdk.org%3cmailto:dev@dpdk.org>>; Lu, Wenzhuo

> > <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com%3cmailto:wenzhuo.lu@intel.com>>>; Wang, Zhihong

> > <zhihong.wang@intel.com<mailto:zhihong.wang@intel.com<mailto:zhihong.wang@intel.com%3cmailto:zhihong.wang@intel.com>>>; Zhang, Qi Z

> > <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com%3cmailto:qi.z.zhang@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@intel.com<mailto:xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com%3cmailto:xiaoyun.li@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@intel.com<mailto:xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com%3cmailto:xiaoyun.li@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 stor

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over
  2017-09-01 10:54 [dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over O Mahony, Billy
@ 2017-09-04  2:20 ` Li, Xiaoyun
  0 siblings, 0 replies; 2+ messages in thread
From: Li, Xiaoyun @ 2017-09-04  2:20 UTC (permalink / raw)
  To: O Mahony, Billy, dev
  Cc: stephen, Lu, Wenzhuo, Wang, Zhihong, Zhang, Qi Z, Richardson, Bruce

I've skimmed the bug. It seems that it has problems to call the implementation codes and only call the resolver codes.
But in fact, I only use FMV to avoid compilation issues (example: AVX512 aren't support if doesn't have compilation option -mavx512).
I just add the attribution such as " __attribute__((target("avx512f")))" to each function to enable the function pass the compilation.
I didn't use the ifunc as the attribution.
I tried -O0, it works well.



Best Regards,
Xiaoyun Li





-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of O Mahony, Billy
Sent: Friday, September 1, 2017 18:55
To: dev@dpdk.org
Cc: stephen@networkplumber.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wang, Zhihong <zhihong.wang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Richardson, Bruce <bruce.richardson@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over

Hi,



FYI, Just to note a bug I found when using FMV with -O flag:



https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81128



I see the fix is on the trunk now but not sure if it's been back ported to other point releases so dev's might need to be careful about which gcc versions they use and be aware that compiler support in the wild could be an issue. The only version marked 'Known to work' on the bug ticket is 8.0.



Apologies if this does not get added to the correct thread - I  don't subscribe to this dev list so I didn't have the original email to reply to.



Regards,

Billy.


> -------- Forwarded Message --------

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

> memcpy

> Date: Thu, 31 Aug 2017 05:24:25 +0000

> From: Li, Xiaoyun <xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com>>

> To: Stephen Hemminger 
> <stephen@networkplumber.org<mailto:stephen@networkplumber.org>>, Lu, 
> Wenzhuo

> <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com>>

> CC: Wang, Zhihong 
> <zhihong.wang@intel.com<mailto:zhihong.wang@intel.com>>, 
> dev@dpdk.org<mailto:dev@dpdk.org>

> <dev@dpdk.org<mailto:dev@dpdk.org>>, Zhang, Qi Z 
> <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com>>, Richardson, Bruce

> <bruce.richardson@intel.com<mailto:bruce.richardson@intel.com>>

>

> 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@networkplumber.org]

> Sent: Thursday, August 31, 2017 13:06

> To: Lu, Wenzhuo <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com>>

> Cc: Wang, Zhihong 
> <zhihong.wang@intel.com<mailto:zhihong.wang@intel.com>>; 
> dev@dpdk.org<mailto:dev@dpdk.org>; Zhang, Qi Z

> <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com>>; Li, Xiaoyun 
> <xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com>>;

> Richardson, Bruce 
> <bruce.richardson@intel.com<mailto:bruce.richardson@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@intel.com<mailto:wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com%3cmailto:wenzhuo.lu@intel.com>>> wrote:

> Hi Stephen,

>

>

> > -----Original Message-----

> > From: Stephen Hemminger

> >

> [mailto:stephen@networkplumber.org<mailto:stephen@networkplumber.o

> rg>]

> > Sent: Thursday, August 31, 2017 2:01 AM

> > To: Li, Xiaoyun 
> > <xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com<mailto:xiaoyun.li@
> > intel.com%3cmailto:xiaoyun.li@intel.com>>>

> > Cc: Richardson, Bruce

> > <bruce.richardson@intel.com<mailto:bruce.richardson@intel.com<mailto
> > :bruce.richardson@intel.com%3cmailto:bruce.richardson@intel.com>>>;

> > dev@dpdk.org<mailto:dev@dpdk.org<mailto:dev@dpdk.org%3cmailto:dev@dp
> > dk.org>>; Lu, Wenzhuo

> > <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com<mailto:wenzhuo.lu@
> > intel.com%3cmailto:wenzhuo.lu@intel.com>>>; Wang, Zhihong

> > <zhihong.wang@intel.com<mailto:zhihong.wang@intel.com<mailto:zhihong
> > .wang@intel.com%3cmailto:zhihong.wang@intel.com>>>; Zhang, Qi Z

> > <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com<mailto:qi.z.zhang@
> > intel.com%3cmailto:qi.z.zhang@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@intel.com<mailto:xiaoyun.li@intel.com<mailto:xiaoyun.li@intel.com%3cmailto:xiaoyun.li@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@intel.com<mailto:xiaoyun.li@intel.com<mailto:xiaoyun.l
> > > i@intel.com%3cmailto:xiaoyun.li@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 stor

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-04  2:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 10:54 [dpdk-dev] [PATCH 1/3] eal/x86: run-time dispatch over O Mahony, Billy
2017-09-04  2:20 ` Li, Xiaoyun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).