net/i40e: disable AVX512 for Windows

Message ID 20210120164016.26745-1-david.marchand@redhat.com (mailing list archive)
State Rejected, archived
Delegated to: Qi Zhang
Headers
Series net/i40e: disable AVX512 for Windows |

Checks

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

Commit Message

David Marchand Jan. 20, 2021, 4:40 p.m. UTC
  AVX512 does not seem supported with FC32 and Windows mingw:

FAILED:
drivers/net/i40e/libi40e_avx512_lib.a.p/i40e_rxtx_vec_avx512.c.obj
x86_64-w64-mingw32-gcc -Idrivers/net/i40e/libi40e_avx512_lib.a.p
-Idrivers/net/i40e -I../../dpdk/drivers/net/i40e -Idrivers/net/i40e/base
-I../../dpdk/drivers/net/i40e/base -Ilib/librte_ethdev
-I../../dpdk/lib/librte_ethdev -I. -I../../dpdk -Iconfig
-I../../dpdk/config -Ilib/librte_eal/include
-I../../dpdk/lib/librte_eal/include -Ilib/librte_eal/windows/include
-I../../dpdk/lib/librte_eal/windows/include -Ilib/librte_eal/x86/include
-I../../dpdk/lib/librte_eal/x86/include -Ilib/librte_eal/common
-I../../dpdk/lib/librte_eal/common -Ilib/librte_eal
-I../../dpdk/lib/librte_eal -Ilib/librte_kvargs
-I../../dpdk/lib/librte_kvargs -Ilib/librte_net
-I../../dpdk/lib/librte_net -Ilib/librte_mbuf
-I../../dpdk/lib/librte_mbuf -Ilib/librte_mempool
-I../../dpdk/lib/librte_mempool -Ilib/librte_ring
-I../../dpdk/lib/librte_ring -Ilib/librte_meter
-I../../dpdk/lib/librte_meter -I../../dpdk/lib/librte_metrics
-Ilib/librte_telemetry -I../../dpdk/lib/librte_telemetry
-Ilib/librte_hash -I../../dpdk/lib/librte_hash -Ilib/librte_rcu
-I../../dpdk/lib/librte_rcu
-I/home/dmarchan/intel-ipsec-mb/install/include
-fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Werror -O2 -g -include rte_config.h -Wextra -Wcast-qual
-Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs
-Wold-style-definition -Wpointer-arith -Wsign-compare
-Wstrict-prototypes -Wundef -Wwrite-strings
-Wno-address-of-packed-member -Wno-packed-not-aligned
-Wno-missing-field-initializers -D_GNU_SOURCE -D_WIN32_WINNT=0x0A00
-D__USE_MINGW_ANSI_STDIO -march=native -DALLOW_EXPERIMENTAL_API
-DALLOW_INTERNAL_API -Wno-format-truncation -DPF_DRIVER -DVF_DRIVER
-DINTEGRATED_VF -DX722_A0_SUPPORT -DCC_AVX2_SUPPORT -DCC_AVX512_SUPPORT
-mavx512f -mavx512bw -march=skylake-avx512 -MD -MQ
drivers/net/i40e/libi40e_avx512_lib.a.p/i40e_rxtx_vec_avx512.c.obj -MF
drivers/net/i40e/libi40e_avx512_lib.a.p/i40e_rxtx_vec_avx512.c.obj.d -o
drivers/net/i40e/libi40e_avx512_lib.a.p/i40e_rxtx_vec_avx512.c.obj -c
../../dpdk/drivers/net/i40e/i40e_rxtx_vec_avx512.c
{standard input}: Assembler messages:
{standard input}:112: Error: invalid register for .seh_savexmm
{standard input}:114: Error: invalid register for .seh_savexmm
{standard input}:116: Error: invalid register for .seh_savexmm
{standard input}:118: Error: invalid register for .seh_savexmm
...

Fixes: e6a6a138919f ("net/i40e: add AVX512 vector path")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
There is probably better to do rather than disabling AVX512 globally for
Windows but since I saw no patch fixing this, here it is.

---
 drivers/net/i40e/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

David Marchand Jan. 20, 2021, 5:46 p.m. UTC | #1
On Wed, Jan 20, 2021 at 5:40 PM David Marchand
<david.marchand@redhat.com> wrote:
> There is probably better to do rather than disabling AVX512 globally for
> Windows but since I saw no patch fixing this, here it is.

Interesting...
This patch does not work with UNH job.
Seeing the same error but now on a different file, I am not sure what is wrong.
  
Ferruh Yigit Jan. 20, 2021, 5:56 p.m. UTC | #2
On 1/20/2021 5:46 PM, David Marchand wrote:
> On Wed, Jan 20, 2021 at 5:40 PM David Marchand
> <david.marchand@redhat.com> wrote:
>> There is probably better to do rather than disabling AVX512 globally for
>> Windows but since I saw no patch fixing this, here it is.
> 
> Interesting...
> This patch does not work with UNH job.
> Seeing the same error but now on a different file, I am not sure what is wrong.
> 
> 

I have just replied to the original thread [1], the problem seems not just 
related to the 'i40e_rxtx_vec_avx512.c'.

[1]
http://inbox.dpdk.org/dev/20201215021945.103396-1-leyi.rong@intel.com/T/#mc47abfa0b72b068f26f4b8deb0dacea840d721e9
  
Dmitry Kozlyuk Jan. 20, 2021, 6:21 p.m. UTC | #3
On Wed, 20 Jan 2021 17:40:16 +0100, David Marchand wrote:
> There is probably better to do rather than disabling AVX512 globally for
> Windows but since I saw no patch fixing this, here it is.
>
> ---
>  drivers/net/i40e/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
> index c0acdf4fd4..c9a1a50407 100644
> --- a/drivers/net/i40e/meson.build
> +++ b/drivers/net/i40e/meson.build
> @@ -54,7 +54,7 @@ if arch_subdir == 'x86'
>  		cc.has_argument('-mavx512f') and
>  		cc.has_argument('-mavx512bw'))
>  
> -	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
> +	if not is_windows and (i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true)
>  		cflags += ['-DCC_AVX512_SUPPORT']
>  		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
>  		if cc.has_argument('-march=skylake-avx512')

Clang doesn't seem to be affected, suggesting a cc.get_id() == 'gcc' check.

The error seems related to SEH (structured exception handling). Some MinGW
flavours don't use it, which can explain why the bug isn't not 100%
reproducible. IMO, just disabling AVX512 for MinGW is enough.

A nit, is there a reason to prefer "x == true" over "x"?
  
Ferruh Yigit Jan. 20, 2021, 6:24 p.m. UTC | #4
On 1/20/2021 6:21 PM, Dmitry Kozlyuk wrote:
> On Wed, 20 Jan 2021 17:40:16 +0100, David Marchand wrote:
>> There is probably better to do rather than disabling AVX512 globally for
>> Windows but since I saw no patch fixing this, here it is.
>>
>> ---
>>   drivers/net/i40e/meson.build | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
>> index c0acdf4fd4..c9a1a50407 100644
>> --- a/drivers/net/i40e/meson.build
>> +++ b/drivers/net/i40e/meson.build
>> @@ -54,7 +54,7 @@ if arch_subdir == 'x86'
>>   		cc.has_argument('-mavx512f') and
>>   		cc.has_argument('-mavx512bw'))
>>   
>> -	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
>> +	if not is_windows and (i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true)
>>   		cflags += ['-DCC_AVX512_SUPPORT']
>>   		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
>>   		if cc.has_argument('-march=skylake-avx512')
> 
> Clang doesn't seem to be affected, suggesting a cc.get_id() == 'gcc' check.
> 
> The error seems related to SEH (structured exception handling). Some MinGW
> flavours don't use it, which can explain why the bug isn't not 100%
> reproducible. IMO, just disabling AVX512 for MinGW is enough.
> 

Is there a way to disable it selectively, only for the compiler versions that 
doesn't support it?

> A nit, is there a reason to prefer "x == true" over "x"?
>
  
Dmitry Kozlyuk Jan. 20, 2021, 7:27 p.m. UTC | #5
On Wed, 20 Jan 2021 18:24:43 +0000, Ferruh Yigit wrote:
> On 1/20/2021 6:21 PM, Dmitry Kozlyuk wrote:
> > On Wed, 20 Jan 2021 17:40:16 +0100, David Marchand wrote:  
> >> There is probably better to do rather than disabling AVX512 globally for
> >> Windows but since I saw no patch fixing this, here it is.
> >>
> >> ---
> >>   drivers/net/i40e/meson.build | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
> >> index c0acdf4fd4..c9a1a50407 100644
> >> --- a/drivers/net/i40e/meson.build
> >> +++ b/drivers/net/i40e/meson.build
> >> @@ -54,7 +54,7 @@ if arch_subdir == 'x86'
> >>   		cc.has_argument('-mavx512f') and
> >>   		cc.has_argument('-mavx512bw'))
> >>   
> >> -	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
> >> +	if not is_windows and (i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true)
> >>   		cflags += ['-DCC_AVX512_SUPPORT']
> >>   		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
> >>   		if cc.has_argument('-march=skylake-avx512')  
> > 
> > Clang doesn't seem to be affected, suggesting a cc.get_id() == 'gcc' check.
> > 
> > The error seems related to SEH (structured exception handling). Some MinGW
> > flavours don't use it, which can explain why the bug isn't not 100%
> > reproducible. IMO, just disabling AVX512 for MinGW is enough.
> >   
> 
> Is there a way to disable it selectively, only for the compiler versions that 
> doesn't support it?

It was a guesswork and it proved wrong, setsmp/longjmp flavour [1] with
GCC 8.1.0 also fails. Fedora 32 has GCC 9.2.1 (works), while Fedora 33 has
GCC 10.2.1 (fails). I use a reproducible environment [2] with GCC 9.3.0,
which succeeds. Seems like GCC 9 is the only known version that works, which
is pretty close to "doesn't work with MinGW at all".

[1]:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z

[2]: https://github.com/PlushBeaver/nix-shells/tree/master/dpdk
  

Patch

diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index c0acdf4fd4..c9a1a50407 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -54,7 +54,7 @@  if arch_subdir == 'x86'
 		cc.has_argument('-mavx512f') and
 		cc.has_argument('-mavx512bw'))
 
-	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
+	if not is_windows and (i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true)
 		cflags += ['-DCC_AVX512_SUPPORT']
 		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
 		if cc.has_argument('-march=skylake-avx512')