Skip to contentSkip to conversation

net/i40e: disable AVX512 for Windows

PATCH In review David Marchand 3 participants 6 messages Jan 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: disable AVX512 for Windows

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")

---
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(-)
drivers/net/i40e/meson.build +1 -1
index c0acdf4fd4..c9a1a50407 100644
@@ -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')
Signature · 1 line
2.23.0
#1 lore raw
Quoted 2 lines · David Marchand

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.

Signature · 1 line
David Marchand
#2 lore raw
Quoted 10 lines · David Marchand
Quoted 2 lines · David Marchand

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/[email protected]/T/#mc47abfa0b72b068f26f4b8deb0dacea840d721e9

#3 lore raw
In reply to David Marchand
Quoted 12 lines · David Marchand

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(-)
drivers/net/i40e/meson.build +0 -0
index c0acdf4fd4..c9a1a50407 100644

drivers/net/i40e/meson.build if arch_subdir == 'x86' · line 60

Quoted 8 lines
drivers/net/i40e/meson.build +1 -1
@@ -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"?

#4 lore raw
Quoted 24 lines · Dmitry Kozlyuk
Quoted 12 lines · David Marchand

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(-)
drivers/net/i40e/meson.build +0 -0
index c0acdf4fd4..c9a1a50407 100644

drivers/net/i40e/meson.build if arch_subdir == 'x86' · line 60

Quoted 8 lines
drivers/net/i40e/meson.build +1 -1
@@ -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.

Quoted 4 lines

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?

Quoted 2 lines

A nit, is there a reason to prefer "x == true" over "x"?

#5 lore raw
Quoted 25 lines · Ferruh Yigit
Quoted 24 lines · Dmitry Kozlyuk
Quoted 12 lines · David Marchand

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(-)
drivers/net/i40e/meson.build +0 -0
index c0acdf4fd4..c9a1a50407 100644

drivers/net/i40e/meson.build if arch_subdir == 'x86' · line 60

Quoted 8 lines
drivers/net/i40e/meson.build +1 -1
@@ -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.

Quoted 7 lines
Quoted 4 lines

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