[v2] net/i40e: fix avx code error on MinGW

Message ID 20210202143258.108477-1-leyi.rong@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/i40e: fix avx code error on MinGW |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-testing warning Testing issues

Commit Message

Leyi Rong Feb. 2, 2021, 2:32 p.m. UTC
  Adds extra cflags '-fno-asynchronous-unwind-tables'
to avoid the MinGW build error:
	Error: invalid register for .seh_savexmm

Fixes: 5c38c33f7880 ("net/i40e: disable AVX512 with MinGW")

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/i40e/meson.build | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Dmitry Kozlyuk Feb. 2, 2021, 11:07 p.m. UTC | #1
On Tue,  2 Feb 2021 22:32:58 +0800, Leyi Rong wrote:
> Adds extra cflags '-fno-asynchronous-unwind-tables'
> to avoid the MinGW build error:
> 	Error: invalid register for .seh_savexmm
> 
> Fixes: 5c38c33f7880 ("net/i40e: disable AVX512 with MinGW")
> 
> Signed-off-by: Leyi Rong <leyi.rong@intel.com>

Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

Re: -fno-asynchronous-unwind-tables, when cross-compiling from Linux, I
observe bit-to-bit identical i40e_rxtx_vec_avx512.c.obj. My guess it that this
option somehow affects GCC inlining heuristics. Similar issue existed in
librte_acl (at least a year ago win GCC 6, I believe), where GCC generated
incorrect code unless certain functions had been inlined (caught by test
app). No an AVX expert, just my 2c.
  
Qi Zhang Feb. 4, 2021, 10:41 a.m. UTC | #2
> -----Original Message-----
> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Sent: Wednesday, February 3, 2021 7:08 AM
> To: Rong, Leyi <leyi.rong@intel.com>
> Cc: david.marchand@redhat.com; Zhang, Qi Z <qi.z.zhang@intel.com>; Yigit,
> Ferruh <ferruh.yigit@intel.com>; thomas@monjalon.net; Richardson, Bruce
> <bruce.richardson@intel.com>; talshn@nvidia.com; Kadam, Pallavi
> <pallavi.kadam@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; aconole@redhat.com; dev@dpdk.org;
> ci@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix avx code error on MinGW
> 
> On Tue,  2 Feb 2021 22:32:58 +0800, Leyi Rong wrote:
> > Adds extra cflags '-fno-asynchronous-unwind-tables'
> > to avoid the MinGW build error:
> > 	Error: invalid register for .seh_savexmm
> >
> > Fixes: 5c38c33f7880 ("net/i40e: disable AVX512 with MinGW")
> >
> > Signed-off-by: Leyi Rong <leyi.rong@intel.com>
> 
> Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> 
> Re: -fno-asynchronous-unwind-tables, when cross-compiling from Linux, I
> observe bit-to-bit identical i40e_rxtx_vec_avx512.c.obj. My guess it that this
> option somehow affects GCC inlining heuristics. Similar issue existed in
> librte_acl (at least a year ago win GCC 6, I believe), where GCC generated
> incorrect code unless certain functions had been inlined (caught by test app).
> No an AVX expert, just my 2c.

Applied to dpdk-next-net-intel.

Thanks
Qi
  
Ferruh Yigit Feb. 4, 2021, 12:36 p.m. UTC | #3
On 2/4/2021 10:41 AM, Zhang, Qi Z wrote:
> 
> 
>> -----Original Message-----
>> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
>> Sent: Wednesday, February 3, 2021 7:08 AM
>> To: Rong, Leyi <leyi.rong@intel.com>
>> Cc: david.marchand@redhat.com; Zhang, Qi Z <qi.z.zhang@intel.com>; Yigit,
>> Ferruh <ferruh.yigit@intel.com>; thomas@monjalon.net; Richardson, Bruce
>> <bruce.richardson@intel.com>; talshn@nvidia.com; Kadam, Pallavi
>> <pallavi.kadam@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Xing,
>> Beilei <beilei.xing@intel.com>; aconole@redhat.com; dev@dpdk.org;
>> ci@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix avx code error on MinGW
>>
>> On Tue,  2 Feb 2021 22:32:58 +0800, Leyi Rong wrote:
>>> Adds extra cflags '-fno-asynchronous-unwind-tables'
>>> to avoid the MinGW build error:
>>> 	Error: invalid register for .seh_savexmm
>>>
>>> Fixes: 5c38c33f7880 ("net/i40e: disable AVX512 with MinGW")
>>>
>>> Signed-off-by: Leyi Rong <leyi.rong@intel.com>
>>
>> Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
>>
>> Re: -fno-asynchronous-unwind-tables, when cross-compiling from Linux, I
>> observe bit-to-bit identical i40e_rxtx_vec_avx512.c.obj. My guess it that this
>> option somehow affects GCC inlining heuristics. Similar issue existed in
>> librte_acl (at least a year ago win GCC 6, I believe), where GCC generated
>> incorrect code unless certain functions had been inlined (caught by test app).
>> No an AVX expert, just my 2c.
> 
> Applied to dpdk-next-net-intel.
> 

Hi Thomas, David,

Do you prefer to get this directly to the main repo, since it is fixing the 
windows build?
  
Thomas Monjalon Feb. 4, 2021, 12:59 p.m. UTC | #4
04/02/2021 13:36, Ferruh Yigit:
> On 2/4/2021 10:41 AM, Zhang, Qi Z wrote:
> > From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> >> On Tue,  2 Feb 2021 22:32:58 +0800, Leyi Rong wrote:
> >>> Adds extra cflags '-fno-asynchronous-unwind-tables'
> >>> to avoid the MinGW build error:
> >>> 	Error: invalid register for .seh_savexmm
> >>>
> >>> Fixes: 5c38c33f7880 ("net/i40e: disable AVX512 with MinGW")
> >>>
> >>> Signed-off-by: Leyi Rong <leyi.rong@intel.com>
> >>
> >> Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> >>
> >> Re: -fno-asynchronous-unwind-tables, when cross-compiling from Linux, I
> >> observe bit-to-bit identical i40e_rxtx_vec_avx512.c.obj. My guess it that this
> >> option somehow affects GCC inlining heuristics. Similar issue existed in
> >> librte_acl (at least a year ago win GCC 6, I believe), where GCC generated
> >> incorrect code unless certain functions had been inlined (caught by test app).
> >> No an AVX expert, just my 2c.
> > 
> > Applied to dpdk-next-net-intel.
> > 
> 
> Hi Thomas, David,
> 
> Do you prefer to get this directly to the main repo, since it is fixing the 
> windows build?

Given it will be pulled shortly, I think it's OK through next-net.
  
David Marchand Feb. 4, 2021, 1:43 p.m. UTC | #5
On Thu, Feb 4, 2021 at 1:36 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 2/4/2021 10:41 AM, Zhang, Qi Z wrote:
> >
> >
> >> -----Original Message-----
> >> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> >> Sent: Wednesday, February 3, 2021 7:08 AM
> >> To: Rong, Leyi <leyi.rong@intel.com>
> >> Cc: david.marchand@redhat.com; Zhang, Qi Z <qi.z.zhang@intel.com>; Yigit,
> >> Ferruh <ferruh.yigit@intel.com>; thomas@monjalon.net; Richardson, Bruce
> >> <bruce.richardson@intel.com>; talshn@nvidia.com; Kadam, Pallavi
> >> <pallavi.kadam@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Xing,
> >> Beilei <beilei.xing@intel.com>; aconole@redhat.com; dev@dpdk.org;
> >> ci@dpdk.org
> >> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix avx code error on MinGW
> >>
> >> On Tue,  2 Feb 2021 22:32:58 +0800, Leyi Rong wrote:
> >>> Adds extra cflags '-fno-asynchronous-unwind-tables'
> >>> to avoid the MinGW build error:
> >>>     Error: invalid register for .seh_savexmm
> >>>
> >>> Fixes: 5c38c33f7880 ("net/i40e: disable AVX512 with MinGW")
> >>>
> >>> Signed-off-by: Leyi Rong <leyi.rong@intel.com>
> >>
> >> Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> >>
> >> Re: -fno-asynchronous-unwind-tables, when cross-compiling from Linux, I
> >> observe bit-to-bit identical i40e_rxtx_vec_avx512.c.obj. My guess it that this
> >> option somehow affects GCC inlining heuristics. Similar issue existed in
> >> librte_acl (at least a year ago win GCC 6, I believe), where GCC generated
> >> incorrect code unless certain functions had been inlined (caught by test app).
> >> No an AVX expert, just my 2c.
> >
> > Applied to dpdk-next-net-intel.
> >
>
> Hi Thomas, David,
>
> Do you prefer to get this directly to the main repo, since it is fixing the
> windows build?

I have no issue with the main branch for mingw.
The windows builds at UNH seem unavailable, so we can wait for the
next-net merge.
  
Lincoln Lavoie Feb. 4, 2021, 9:57 p.m. UTC | #6
Hi All,

The jobs for Windows compile are running, so it may just be the patch
hasn't caught up in the queue.

Cheers,
Lincoln

On Thu, Feb 4, 2021 at 8:43 AM David Marchand <david.marchand@redhat.com>
wrote:

> On Thu, Feb 4, 2021 at 1:36 PM Ferruh Yigit <ferruh.yigit@intel.com>
> wrote:
> >
> > On 2/4/2021 10:41 AM, Zhang, Qi Z wrote:
> > >
> > >
> > >> -----Original Message-----
> > >> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > >> Sent: Wednesday, February 3, 2021 7:08 AM
> > >> To: Rong, Leyi <leyi.rong@intel.com>
> > >> Cc: david.marchand@redhat.com; Zhang, Qi Z <qi.z.zhang@intel.com>;
> Yigit,
> > >> Ferruh <ferruh.yigit@intel.com>; thomas@monjalon.net; Richardson,
> Bruce
> > >> <bruce.richardson@intel.com>; talshn@nvidia.com; Kadam, Pallavi
> > >> <pallavi.kadam@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>;
> Xing,
> > >> Beilei <beilei.xing@intel.com>; aconole@redhat.com; dev@dpdk.org;
> > >> ci@dpdk.org
> > >> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix avx code error on
> MinGW
> > >>
> > >> On Tue,  2 Feb 2021 22:32:58 +0800, Leyi Rong wrote:
> > >>> Adds extra cflags '-fno-asynchronous-unwind-tables'
> > >>> to avoid the MinGW build error:
> > >>>     Error: invalid register for .seh_savexmm
> > >>>
> > >>> Fixes: 5c38c33f7880 ("net/i40e: disable AVX512 with MinGW")
> > >>>
> > >>> Signed-off-by: Leyi Rong <leyi.rong@intel.com>
> > >>
> > >> Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > >>
> > >> Re: -fno-asynchronous-unwind-tables, when cross-compiling from Linux,
> I
> > >> observe bit-to-bit identical i40e_rxtx_vec_avx512.c.obj. My guess it
> that this
> > >> option somehow affects GCC inlining heuristics. Similar issue existed
> in
> > >> librte_acl (at least a year ago win GCC 6, I believe), where GCC
> generated
> > >> incorrect code unless certain functions had been inlined (caught by
> test app).
> > >> No an AVX expert, just my 2c.
> > >
> > > Applied to dpdk-next-net-intel.
> > >
> >
> > Hi Thomas, David,
> >
> > Do you prefer to get this directly to the main repo, since it is fixing
> the
> > windows build?
>
> I have no issue with the main branch for mingw.
> The windows builds at UNH seem unavailable, so we can wait for the
> next-net merge.
>
>
> --
> David Marchand
>
>
  

Patch

diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index f5fc5a17e0..ce3cc658e9 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -28,6 +28,10 @@  includes += include_directories('base')
 if arch_subdir == 'x86'
 	sources += files('i40e_rxtx_vec_sse.c')
 
+	if is_windows and cc.get_id() != 'clang'
+		cflags += ['-fno-asynchronous-unwind-tables']
+	endif
+
 	# compile AVX2 version if either:
 	# a. we have AVX supported in minimum instruction set baseline
 	# b. it's not minimum instruction set, but supported by compiler
@@ -54,10 +58,6 @@  if arch_subdir == 'x86'
 		cc.has_argument('-mavx512f') and
 		cc.has_argument('-mavx512bw'))
 
-	if is_windows and cc.get_id() != 'clang'
-		i40e_avx512_cc_support = false
-	endif
-
 	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
 		cflags += ['-DCC_AVX512_SUPPORT']
 		avx512_args = [cflags, '-mavx512f', '-mavx512bw']