All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ACL: fix build for native-icc target on haswell fails
@ 2015-11-20 15:38 Konstantin Ananyev
  2015-11-20 15:59 ` Declan Doherty
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Ananyev @ 2015-11-20 15:38 UTC (permalink / raw)
  To: dev

On HSW box with icc 16.0.0 build for x86_64-native-linuxapp-icc fails with:
icc: command line warning #10120: overriding '-march=native' with '-msse4.1'
...
dpdk.org/x86_64-native-linuxapp-icc/include/rte_memcpy.h(96): error: identifier "__m256i" is undefined

The reason is that icc treats "-march=native ... -msse4.1"
in a different way, then gcc and clang.
For icc it means override all flags enabled with
'-march=native' with '-msse4.1'.
Even when '-march=native' is a superset for '-msse4.1'.
To overcome the problem add a check is SSE4.1 compilation flag already enabled.
If yes, then no need to add '-msse4.1'
Similar change for avx2 compilation option.

Fixes: 074f54ad03ee ("acl: fix build and runtime for default target")

Reported-by: Declan Doherty <declan.doherty@intel.com>
Reported-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_acl/Makefile | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

v2 changes:
- merged with latest mainline

diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 27f91d5..897237d 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -48,31 +48,42 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += rte_acl.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_bld.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
+
 ifeq ($(CONFIG_RTE_ARCH_ARM64),y)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
+CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
 else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
+#check if flag for SSE4.1 is already on, if not set it up manually
+	ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),)
+		CFLAGS_acl_run_sse.o += -msse4.1
+	endif
 endif
 
-CFLAGS_acl_run_sse.o += -msse4.1
-CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
-
 #
 # If the compiler supports AVX2 instructions,
 # then add support for AVX2 classify method.
 #
 
-CC_AVX2_SUPPORT=$(shell $(CC) -march=core-avx2 -dM -E - </dev/null 2>&1 | \
-grep -q AVX2 && echo 1)
+#check if flag for AVX2 is already on, if not set it up manually
+ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2)
+	CC_AVX2_SUPPORT=1
+else
+	CC_AVX2_SUPPORT=\
+	$(shell $(CC) -march=core-avx2 -dM -E - </dev/null 2>&1 | \
+	grep -q AVX2 && echo 1)
+	ifeq ($(CC_AVX2_SUPPORT), 1)
+		ifeq ($(CC), icc)
+		CFLAGS_acl_run_avx2.o += -march=core-avx2
+		else
+		CFLAGS_acl_run_avx2.o += -mavx2
+		endif
+	endif
+endif
 
 ifeq ($(CC_AVX2_SUPPORT), 1)
 	SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_avx2.c
 	CFLAGS_rte_acl.o += -DCC_AVX2_SUPPORT
-	ifeq ($(CC), icc)
-	CFLAGS_acl_run_avx2.o += -march=core-avx2
-	else
-	CFLAGS_acl_run_avx2.o += -mavx2
-	endif
 endif
 
 # install this header file
-- 
1.8.5.3

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

* Re: [PATCH v2] ACL: fix build for native-icc target on haswell fails
  2015-11-20 15:38 [PATCH v2] ACL: fix build for native-icc target on haswell fails Konstantin Ananyev
@ 2015-11-20 15:59 ` Declan Doherty
  2015-11-20 16:15   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Declan Doherty @ 2015-11-20 15:59 UTC (permalink / raw)
  To: Konstantin Ananyev, dev



On 20/11/15 15:38, Konstantin Ananyev wrote:
> On HSW box with icc 16.0.0 build for x86_64-native-linuxapp-icc fails with:
> icc: command line warning #10120: overriding '-march=native' with '-msse4.1'
> ...
> dpdk.org/x86_64-native-linuxapp-icc/include/rte_memcpy.h(96): error: identifier "__m256i" is undefined
>
> The reason is that icc treats "-march=native ... -msse4.1"
> in a different way, then gcc and clang.
> For icc it means override all flags enabled with
> '-march=native' with '-msse4.1'.
> Even when '-march=native' is a superset for '-msse4.1'.
> To overcome the problem add a check is SSE4.1 compilation flag already enabled.
> If yes, then no need to add '-msse4.1'
> Similar change for avx2 compilation option.
>
> Fixes: 074f54ad03ee ("acl: fix build and runtime for default target")
>
> Reported-by: Declan Doherty <declan.doherty@intel.com>
> Reported-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
>   lib/librte_acl/Makefile | 31 +++++++++++++++++++++----------
>   1 file changed, 21 insertions(+), 10 deletions(-)
>
> v2 changes:
> - merged with latest mainline
>
> diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
> index 27f91d5..897237d 100644
> --- a/lib/librte_acl/Makefile
> +++ b/lib/librte_acl/Makefile
> @@ -48,31 +48,42 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += rte_acl.c
>   SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_bld.c
>   SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c
>   SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
> +
>   ifeq ($(CONFIG_RTE_ARCH_ARM64),y)
>   SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
> +CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
>   else
>   SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
> +#check if flag for SSE4.1 is already on, if not set it up manually
> +	ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),)
> +		CFLAGS_acl_run_sse.o += -msse4.1
> +	endif
>   endif
>   
> -CFLAGS_acl_run_sse.o += -msse4.1
> -CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
> -
>   #
>   # If the compiler supports AVX2 instructions,
>   # then add support for AVX2 classify method.
>   #
>   
> -CC_AVX2_SUPPORT=$(shell $(CC) -march=core-avx2 -dM -E - </dev/null 2>&1 | \
> -grep -q AVX2 && echo 1)
> +#check if flag for AVX2 is already on, if not set it up manually
> +ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2)
> +	CC_AVX2_SUPPORT=1
> +else
> +	CC_AVX2_SUPPORT=\
> +	$(shell $(CC) -march=core-avx2 -dM -E - </dev/null 2>&1 | \
> +	grep -q AVX2 && echo 1)
> +	ifeq ($(CC_AVX2_SUPPORT), 1)
> +		ifeq ($(CC), icc)
> +		CFLAGS_acl_run_avx2.o += -march=core-avx2
> +		else
> +		CFLAGS_acl_run_avx2.o += -mavx2
> +		endif
> +	endif
> +endif
>   
>   ifeq ($(CC_AVX2_SUPPORT), 1)
>   	SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_avx2.c
>   	CFLAGS_rte_acl.o += -DCC_AVX2_SUPPORT
> -	ifeq ($(CC), icc)
> -	CFLAGS_acl_run_avx2.o += -march=core-avx2
> -	else
> -	CFLAGS_acl_run_avx2.o += -mavx2
> -	endif
>   endif
>   
>   # install this header file

Acked-by: Declan Doherty <declan.doherty@intel.com>

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

* Re: [PATCH v2] ACL: fix build for native-icc target on haswell fails
  2015-11-20 15:59 ` Declan Doherty
@ 2015-11-20 16:15   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-11-20 16:15 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

2015-11-20 15:59, Declan Doherty:
> On 20/11/15 15:38, Konstantin Ananyev wrote:
> > On HSW box with icc 16.0.0 build for x86_64-native-linuxapp-icc fails with:
> > icc: command line warning #10120: overriding '-march=native' with '-msse4.1'
> > ...
> > dpdk.org/x86_64-native-linuxapp-icc/include/rte_memcpy.h(96): error: identifier "__m256i" is undefined
> >
> > The reason is that icc treats "-march=native ... -msse4.1"
> > in a different way, then gcc and clang.
> > For icc it means override all flags enabled with
> > '-march=native' with '-msse4.1'.
> > Even when '-march=native' is a superset for '-msse4.1'.
> > To overcome the problem add a check is SSE4.1 compilation flag already enabled.
> > If yes, then no need to add '-msse4.1'
> > Similar change for avx2 compilation option.
> >
> > Fixes: 074f54ad03ee ("acl: fix build and runtime for default target")
> >
> > Reported-by: Declan Doherty <declan.doherty@intel.com>
> > Reported-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
> > Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> Acked-by: Declan Doherty <declan.doherty@intel.com>

Applied, thanks

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

end of thread, other threads:[~2015-11-20 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 15:38 [PATCH v2] ACL: fix build for native-icc target on haswell fails Konstantin Ananyev
2015-11-20 15:59 ` Declan Doherty
2015-11-20 16:15   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.