Message ID | 1445877458-31052-17-git-send-email-viktorin@rehivetech.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 361508F9E; Mon, 26 Oct 2015 17:39:49 +0100 (CET) Received: from wes1-so1.wedos.net (wes1-so1.wedos.net [46.28.106.15]) by dpdk.org (Postfix) with ESMTP id 477C18D8D for <dev@dpdk.org>; Mon, 26 Oct 2015 17:39:32 +0100 (CET) Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz [147.229.13.147]) by wes1-so1.wedos.net (Postfix) with ESMTPSA id 3nl21w0Nnzz5GR; Mon, 26 Oct 2015 17:39:32 +0100 (CET) From: Jan Viktorin <viktorin@rehivetech.com> To: Thomas Monjalon <thomas.monjalon@6wind.com>, David Hunt <david.hunt@intel.com>, dev@dpdk.org Date: Mon, 26 Oct 2015 17:37:38 +0100 Message-Id: <1445877458-31052-17-git-send-email-viktorin@rehivetech.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1445877458-31052-1-git-send-email-viktorin@rehivetech.com> References: <1445877458-31052-1-git-send-email-viktorin@rehivetech.com> Subject: [dpdk-dev] [PATCH v2 16/16] acl: check for SSE 4.1 support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Jan Viktorin
Oct. 26, 2015, 4:37 p.m. UTC
The main goal of this check is to avoid passing the -msse4.1
option to the GCC that does not support it (like arm toolchains).
Anyway, the ACL library does not compile on ARM.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_acl/Makefile | 4 ++++
1 file changed, 4 insertions(+)
Comments
> -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jan Viktorin > Sent: Monday, October 26, 2015 4:38 PM > To: Thomas Monjalon; Hunt, David; dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2 16/16] acl: check for SSE 4.1 support > > The main goal of this check is to avoid passing the -msse4.1 > option to the GCC that does not support it (like arm toolchains). > > Anyway, the ACL library does not compile on ARM. > > Signed-off-by: Jan Viktorin <viktorin@rehivetech.com> > --- > lib/librte_acl/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile > index 7a1cf8a..401fb8c 100644 > --- a/lib/librte_acl/Makefile > +++ b/lib/librte_acl/Makefile > @@ -50,7 +50,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c > SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c > SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c > > +CC_SSE4_1_SUPPORT := $(shell $(CC) -msse4.1 -dM -E - < /dev/null >/dev/null 2>&1 && echo 1) > + > +ifeq ($(CC_SSE4_1_SUPPORT),1) > CFLAGS_acl_run_sse.o += -msse4.1 > +endif I don't think acl_run_sse.c would compile if SSE4_1 is not supported. So, I think you need to do same thing, as is done for AVX2: Compile in acl_run_sse.c only if SSE41 is supported by the compiler: - SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c - -CFLAGS_acl_run_sse.o += -msse4.1 +CC_SSE41_SUPPORT=$(shell $(CC) -msse4.1 -dM -E - </dev/null 2>&1 | \ grep -q && echo 1) +ifeq ($(CC_SSE41_SUPPORT), 1) + SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c + CFLAGS_rte_acl.o += -DCC_SSE41_SUPPORT + CFLAGS_acl_run_sse.o += -msse4.1 +endif And then change rte_acl_init() accordingly. Something like: int __attribute__ ((weak)) rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, __rte_unused uint32_t num, __rte_unused uint32_t categories) { return -ENOTSUP; } .... static void __attribute__((constructor)) rte_acl_init(void) { enum rte_acl_classify_alg alg = RTE_ACL_CLASSIFY_DEFAULT; #if defined(CC_AVX2_SUPPORT) if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) alg = RTE_ACL_CLASSIFY_AVX2; else if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1)) #elif defined (CC_SSE41_SUPPORT) if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1)) alg = RTE_ACL_CLASSIFY_SSE; #endif rte_acl_set_default_classify(alg); } After that, I suppose, you should be able to build and (probably use) librte_acl on arm. Konstantin
Hello Konstantin, thank you for those hints! I reworked the code a little bit - refactored the LPM vector operations into rte_vect.h which helped to the ACL library as well. I will sort it out a little and send the v3 of the series. The LPM and ACL now seem to be much more sane on ARM. Regards Jan On Tue, 27 Oct 2015 15:55:48 +0000 "Ananyev, Konstantin" <konstantin.ananyev@intel.com> wrote: > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jan Viktorin > > Sent: Monday, October 26, 2015 4:38 PM > > To: Thomas Monjalon; Hunt, David; dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v2 16/16] acl: check for SSE 4.1 support > > > > The main goal of this check is to avoid passing the -msse4.1 > > option to the GCC that does not support it (like arm toolchains). > > > > Anyway, the ACL library does not compile on ARM. > > > > Signed-off-by: Jan Viktorin <viktorin@rehivetech.com> > > --- > > lib/librte_acl/Makefile | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile > > index 7a1cf8a..401fb8c 100644 > > --- a/lib/librte_acl/Makefile > > +++ b/lib/librte_acl/Makefile > > @@ -50,7 +50,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c > > SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c > > SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c > > > > +CC_SSE4_1_SUPPORT := $(shell $(CC) -msse4.1 -dM -E - < /dev/null >/dev/null 2>&1 && echo 1) > > + > > +ifeq ($(CC_SSE4_1_SUPPORT),1) > > CFLAGS_acl_run_sse.o += -msse4.1 > > +endif > > I don't think acl_run_sse.c would compile if SSE4_1 is not supported. > So, I think you need to do same thing, as is done for AVX2: > Compile in acl_run_sse.c only if SSE41 is supported by the compiler: > > - SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c > - > -CFLAGS_acl_run_sse.o += -msse4.1 > > +CC_SSE41_SUPPORT=$(shell $(CC) -msse4.1 -dM -E - </dev/null 2>&1 | \ > grep -q && echo 1) > +ifeq ($(CC_SSE41_SUPPORT), 1) > + SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c > + CFLAGS_rte_acl.o += -DCC_SSE41_SUPPORT > + CFLAGS_acl_run_sse.o += -msse4.1 > +endif > > And then change rte_acl_init() accordingly. > Something like: > > int __attribute__ ((weak)) > rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx, > __rte_unused const uint8_t **data, > __rte_unused uint32_t *results, > __rte_unused uint32_t num, > __rte_unused uint32_t categories) > { > return -ENOTSUP; > } > > .... > > static void __attribute__((constructor)) > rte_acl_init(void) > { > enum rte_acl_classify_alg alg = RTE_ACL_CLASSIFY_DEFAULT; > > #if defined(CC_AVX2_SUPPORT) > if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) > alg = RTE_ACL_CLASSIFY_AVX2; > else if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1)) > #elif defined (CC_SSE41_SUPPORT) > if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1)) > alg = RTE_ACL_CLASSIFY_SSE; > #endif > > rte_acl_set_default_classify(alg); > } > > After that, I suppose, you should be able to build and (probably use) librte_acl on arm. > Konstantin > > >
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile index 7a1cf8a..401fb8c 100644 --- a/lib/librte_acl/Makefile +++ b/lib/librte_acl/Makefile @@ -50,7 +50,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c +CC_SSE4_1_SUPPORT := $(shell $(CC) -msse4.1 -dM -E - < /dev/null >/dev/null 2>&1 && echo 1) + +ifeq ($(CC_SSE4_1_SUPPORT),1) CFLAGS_acl_run_sse.o += -msse4.1 +endif # # If the compiler supports AVX2 instructions,