Message ID | 1448904253-12929-2-git-send-email-jerin.jacob@caviumnetworks.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 CEA688D95; Mon, 30 Nov 2015 18:24:50 +0100 (CET) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0065.outbound.protection.outlook.com [157.56.110.65]) by dpdk.org (Postfix) with ESMTP id B1DE98D91 for <dev@dpdk.org>; Mon, 30 Nov 2015 18:24:48 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@caviumnetworks.com; Received: from localhost.localdomain.localdomain (122.167.201.210) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (TLS) id 15.1.331.20; Mon, 30 Nov 2015 17:24:45 +0000 From: Jerin Jacob <jerin.jacob@caviumnetworks.com> To: <dev@dpdk.org> Date: Mon, 30 Nov 2015 22:54:11 +0530 Message-ID: <1448904253-12929-2-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1448904253-12929-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1448904253-12929-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.167.201.210] X-ClientProxiedBy: MAXPR01CA0023.INDPRD01.PROD.OUTLOOK.COM (25.164.147.30) To BLUPR0701MB1714.namprd07.prod.outlook.com (25.163.85.140) X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 2:mNNtRMcVhc0oG9wsGoQT2yZ/46ejOwYf6YYv0Xk13CZ2bj2OR1aZY1FSUMVvg7BakZVJYH+TTqSycOcR1wZ2S1BSLNjhIBG8jPJxa4eMS7H28sxsDixoM76LWoe1i8DDvZjHz5z8AnuiwcCCBn5mbQ==;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Jw2ZaqzOwSLVBjXeDzIxuefT2sL4kHhvfwifzQqBDJnhbk= X-Microsoft-Antispam-PRVS: <BLUPR0701MB17145A43E48E6443833FDA5F8C000@BLUPR0701MB1714.namprd07.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:NnE61LumPEActe9Erip564yYK5l4o9btom6Grj2CARgLOxftMhoQcqNtPt6hK/j3o7+LKjpTwsJcNKl8K+70DkXetEsXPoQd4iNhCyJQtpPO5/GgypMKza1SfynEXyCRMktyjVFkcF3uAUuJW8yeAoN/mRVOcL3FRvi/4uOztT9KMgFhdVSnTJ8lCsXGrEOpjhTaGlrnExWAwD1w4L7LBkgm2io48xn5AHwjFUkTB2vCEDa44woq87GhEqzilLiFkEu1qJL8GYcbfgV0HXVyMVsKiuxQsx93PxLK0ZQdhH+5QN8ppCdqR6J9s+6UOpoLQaAYJOcYjdI94gnp1XwqAC2uDo1hZ+B5T/EUf1+uesWams8d6h7zq1mS9rcJBLGz7w1TLtWFGV6mLX4Hy7Z9tf88G9IgXwQ9lmYM5GPcGjn2Uu64zkNuBkDvJeLf3YNI X-Forefront-PRVS: 0776C39A48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(189002)(199003)(2351001)(42186005)(107886002)(48376002)(110136002)(5004730100002)(33646002)(5008740100001)(229853001)(47776003)(66066001)(76176999)(50466002)(97736004)(19580405001)(36756003)(106356001)(101416001)(105586002)(92566002)(81156007)(50226001)(19580395003)(5001960100002)(87976001)(189998001)(50986999)(2950100001)(86362001)(77096005)(6116002)(4001430100002)(3846002)(5003940100001)(40100003)(586003)(1096002)(122386002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:FZkn9O8PMxMdjhijco8GV4NfS12TavCnRgyaslO?= =?us-ascii?Q?LtAboR+8UxYgUyyX+TWxdY2BxgU8gRUQiHKqacXiNFyQmfWHppoRW8zcfK2K?= =?us-ascii?Q?/cj3aMZqzqhU1TODc/5+taDVlmVl0xGdi0SEqdN0ZPLHRfIge2t3K+j0c6rR?= =?us-ascii?Q?VgUtATwG/0ccZp0deJLggV2pPr8xD6V0Pp1MuXTJOsTXdsRwUCxwf1eO5Tq2?= =?us-ascii?Q?3A/kVkW++tPwxjFgQJq34+lTbONP35vZwBpJv0lmDRalkmUuCWZNXcufzs9D?= =?us-ascii?Q?zWQdxzjvq9q1Gqk7GKdQBR+AWntlYXi76VjqHQLhskTfMjpqEneRCMikxt7k?= =?us-ascii?Q?V4VZaEKG278ad1b1Kyq3CR/fk+JnYVaQxZGXinLQn5b5zwnTwdmr1AGuJBqR?= =?us-ascii?Q?iWIxIcDEd/cGzd69vGBMdgS+F02/Uh/xnT6doQS3pQmacbMAudohKl7+OWlW?= =?us-ascii?Q?SHFzDnAjEK+zkZUdRNof+/SyBW+JmIcSRPmzf5cgfpvohS2ifTRHx8wv57mM?= =?us-ascii?Q?d1aS6nugBT/3fwYL4SMCu8Rkd+2U5kPSzmYfRDYvzNJFoRHiLsljSO+KFc6r?= =?us-ascii?Q?nAXQQbR68Pfz39kObr18lHxXcgM0+0NaA/8ChLU1ZbWEXr/QYUbJrpzajiLO?= =?us-ascii?Q?xdLs0KwvoTrU5ERtXY2hFXJdrjIOFLaA1IJe2QOTVBma60HKicaxl+uds4XG?= =?us-ascii?Q?apBSz4Aq0Papg90iQLiTNRotFGGgYF1cliZJFdASytwTRHr+EzYWXTo/vH+s?= =?us-ascii?Q?PoanrYK/yTwf4RgFCzdFwX5DFz1mkHbiYou/Et7ZpEKQyiVP3kVPLYBiS2jz?= =?us-ascii?Q?cH0mzkBPPfJZX7fRzGIoECHaSjc0nKVTTkfE2vvlK1mh1XOE0gTeDsBB5vzT?= =?us-ascii?Q?MP4jzMYAZK9qgykARQmZ8XZb6DKkqDf1Jwa4nnnYmImqPtnSa5V0cpMBaN+v?= =?us-ascii?Q?8njBkUmS97/Ku2bM2z8iuprWcFtrSZfilPdeiBLASVb/x3mtS/wSkU220mvt?= =?us-ascii?Q?q7XtSVBQ9hcCveuiPU4sai06ngHUUH4GpMKHpPb56hR2pUHG64XAl9Nvrr40?= =?us-ascii?Q?xm1GGw4QepKm1J7TJDMJJBMU9RT8XfpsOcY4ycHwHj7DeJaAJBb5FB3rncEn?= =?us-ascii?Q?jna0AKAuSDHllThMTBtwmVPmQ4Ljle/Kh?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 5:Q4hG5HckKlOEiYtvh6hEB1M74NHXriIYNIZ90YZvlWkorkkS2Ko9ZVef7gB+JHCdsQiiZc7sUAynYIJetHgU32we4RtE9GbI25iSZDHlTV2Ogng00uc/W8/Uk7pebet0n4wEWcYxtmUKjt9EdwMOow==; 24:qP04dnOkCjxJucosvXw5hGnnezOZdakYrVCUatcUrkQFOlLFvVUNieYu8NBn5qpDU2PEGtUU1n09p26Ec5CRwWCHV3dvePP7Z9Iv2ob55tc= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2015 17:24:45.3725 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH 1/3] eal: introduce rte_vect_* abstractions 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
Jerin Jacob
Nov. 30, 2015, 5:24 p.m. UTC
introduce rte_vect_* abstractions to remove SSE/AVX specific
code in the common code(i.e the test applications)
The patch does not provide any functional change for IA, the goal is to
have infrastructure to reuse the common vector-based test code across
all the architectures.
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
lib/librte_eal/common/include/arch/arm/rte_vect.h | 17 ++++++++++++++++-
lib/librte_eal/common/include/arch/x86/rte_vect.h | 8 ++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
Comments
On Mon, 30 Nov 2015 22:54:11 +0530 Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote: > introduce rte_vect_* abstractions to remove SSE/AVX specific > code in the common code(i.e the test applications) > > The patch does not provide any functional change for IA, the goal is to Does IA mean Intel Architecture? > have infrastructure to reuse the common vector-based test code across > all the architectures. > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > --- > lib/librte_eal/common/include/arch/arm/rte_vect.h | 17 ++++++++++++++++- > lib/librte_eal/common/include/arch/x86/rte_vect.h | 8 ++++++++ > 2 files changed, 24 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/include/arch/arm/rte_vect.h b/lib/librte_eal/common/include/arch/arm/rte_vect.h > index 21cdb4d..d300951 100644 > --- a/lib/librte_eal/common/include/arch/arm/rte_vect.h > +++ b/lib/librte_eal/common/include/arch/arm/rte_vect.h > @@ -33,13 +33,14 @@ > #ifndef _RTE_VECT_ARM_H_ > #define _RTE_VECT_ARM_H_ > > -#include "arm_neon.h" > +#include <arm_neon.h> > > #ifdef __cplusplus > extern "C" { > #endif > > typedef int32x4_t xmm_t; > +typedef int32x4_t __m128i; As Jianbo pointed out recently, the __m128i type should be refactored in a general rte_vect API too. If we do something like #if SSE typedef __m128i rte_128i; #elif NEON typedef int32x4_y rte_128i; #endif does it make somebody angry? I am afraid that it will influence a lot of code. However, from the ABI point of view, it is OK, isn't it? > > #define XMM_SIZE (sizeof(xmm_t)) > #define XMM_MASK (XMM_SIZE - 1) > @@ -53,6 +54,20 @@ typedef union rte_xmm { > double pd[XMM_SIZE / sizeof(double)]; > } __attribute__((aligned(16))) rte_xmm_t; > > +/* rte_vect_* abstraction implementation using NEON */ > + > +/* loads the __m128i value from address p(does not need to be 16-byte aligned)*/ > +#define rte_vect_loadu_sil128(p) vld1q_s32((const int32_t *)p) > + > +/* sets the 4 signed 32-bit integer values and returns the __m128i variable */ > +static inline __m128i __attribute__((always_inline)) > +rte_vect_set_epi32(int i3, int i2, int i1, int i0) > +{ > + int32_t data[4] = {i0, i1, i2, i3}; > + > + return vld1q_s32(data); > +} > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/librte_eal/common/include/arch/x86/rte_vect.h b/lib/librte_eal/common/include/arch/x86/rte_vect.h > index b698797..91c6523 100644 > --- a/lib/librte_eal/common/include/arch/x86/rte_vect.h > +++ b/lib/librte_eal/common/include/arch/x86/rte_vect.h > @@ -125,6 +125,14 @@ typedef union rte_ymm { > }) > #endif /* (defined(__ICC) && __ICC < 1210) */ > > +/* rte_vect_* abstraction implementation using SSE */ > + > +/* loads the __m128i value from address p(does not need to be 16-byte aligned)*/ > +#define rte_vect_loadu_sil128(p) _mm_loadu_si128(p) > + > +/* sets the 4 signed 32-bit integer values and returns the __m128i variable */ > +#define rte_vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0) > + > #ifdef __cplusplus > } > #endif I like this approach. It is a question whether to inherit names from SSE. However, why to reinvent the wheel... We probably need other people to give their ideas about such generalization of the API. I think, there should be an autotest of the rte_vect API. Is it possible to create one? Regards Jan
On Wed, Dec 02, 2015 at 02:43:34PM +0100, Jan Viktorin wrote: > On Mon, 30 Nov 2015 22:54:11 +0530 > Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote: > > > introduce rte_vect_* abstractions to remove SSE/AVX specific > > code in the common code(i.e the test applications) > > > > The patch does not provide any functional change for IA, the goal is to > > Does IA mean Intel Architecture? Yes. > > > have infrastructure to reuse the common vector-based test code across > > all the architectures. > > > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > > --- > > lib/librte_eal/common/include/arch/arm/rte_vect.h | 17 ++++++++++++++++- > > lib/librte_eal/common/include/arch/x86/rte_vect.h | 8 ++++++++ > > 2 files changed, 24 insertions(+), 1 deletion(-) > > > > diff --git a/lib/librte_eal/common/include/arch/arm/rte_vect.h b/lib/librte_eal/common/include/arch/arm/rte_vect.h > > index 21cdb4d..d300951 100644 > > --- a/lib/librte_eal/common/include/arch/arm/rte_vect.h > > +++ b/lib/librte_eal/common/include/arch/arm/rte_vect.h > > @@ -33,13 +33,14 @@ > > #ifndef _RTE_VECT_ARM_H_ > > #define _RTE_VECT_ARM_H_ > > > > -#include "arm_neon.h" > > +#include <arm_neon.h> > > > > #ifdef __cplusplus > > extern "C" { > > #endif > > > > typedef int32x4_t xmm_t; > > +typedef int32x4_t __m128i; > > As Jianbo pointed out recently, the __m128i type should be refactored in > a general rte_vect API too. If we do something like > > #if SSE > typedef __m128i rte_128i; > #elif NEON > typedef int32x4_y rte_128i; > #endif > > does it make somebody angry? I am afraid that it will influence a lot of > code. However, from the ABI point of view, it is OK, isn't it? > > > > > #define XMM_SIZE (sizeof(xmm_t)) > > #define XMM_MASK (XMM_SIZE - 1) > > @@ -53,6 +54,20 @@ typedef union rte_xmm { > > double pd[XMM_SIZE / sizeof(double)]; > > } __attribute__((aligned(16))) rte_xmm_t; > > > > +/* rte_vect_* abstraction implementation using NEON */ > > + > > +/* loads the __m128i value from address p(does not need to be 16-byte aligned)*/ > > +#define rte_vect_loadu_sil128(p) vld1q_s32((const int32_t *)p) > > + > > +/* sets the 4 signed 32-bit integer values and returns the __m128i variable */ > > +static inline __m128i __attribute__((always_inline)) > > +rte_vect_set_epi32(int i3, int i2, int i1, int i0) > > +{ > > + int32_t data[4] = {i0, i1, i2, i3}; > > + > > + return vld1q_s32(data); > > +} > > + > > #ifdef __cplusplus > > } > > #endif > > diff --git a/lib/librte_eal/common/include/arch/x86/rte_vect.h b/lib/librte_eal/common/include/arch/x86/rte_vect.h > > index b698797..91c6523 100644 > > --- a/lib/librte_eal/common/include/arch/x86/rte_vect.h > > +++ b/lib/librte_eal/common/include/arch/x86/rte_vect.h > > @@ -125,6 +125,14 @@ typedef union rte_ymm { > > }) > > #endif /* (defined(__ICC) && __ICC < 1210) */ > > > > +/* rte_vect_* abstraction implementation using SSE */ > > + > > +/* loads the __m128i value from address p(does not need to be 16-byte aligned)*/ > > +#define rte_vect_loadu_sil128(p) _mm_loadu_si128(p) > > + > > +/* sets the 4 signed 32-bit integer values and returns the __m128i variable */ > > +#define rte_vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0) > > + > > #ifdef __cplusplus > > } > > #endif > > I like this approach. It is a question whether to inherit names from > SSE. However, why to reinvent the wheel... > > We probably need other people to give their ideas about such > generalization of the API. Yes, I would like get the feedback from other people. ret_vect_* abstraction only for the common code (i.e test code) which typically used to call the SIMD DPDK API's across the architecture. > > I think, there should be an autotest of the rte_vect API. Is it > possible to create one? Yes > > Regards > Jan > > -- > Jan Viktorin E-mail: Viktorin@RehiveTech.com > System Architect Web: www.RehiveTech.com > RehiveTech > Brno, Czech Republic
diff --git a/lib/librte_eal/common/include/arch/arm/rte_vect.h b/lib/librte_eal/common/include/arch/arm/rte_vect.h index 21cdb4d..d300951 100644 --- a/lib/librte_eal/common/include/arch/arm/rte_vect.h +++ b/lib/librte_eal/common/include/arch/arm/rte_vect.h @@ -33,13 +33,14 @@ #ifndef _RTE_VECT_ARM_H_ #define _RTE_VECT_ARM_H_ -#include "arm_neon.h" +#include <arm_neon.h> #ifdef __cplusplus extern "C" { #endif typedef int32x4_t xmm_t; +typedef int32x4_t __m128i; #define XMM_SIZE (sizeof(xmm_t)) #define XMM_MASK (XMM_SIZE - 1) @@ -53,6 +54,20 @@ typedef union rte_xmm { double pd[XMM_SIZE / sizeof(double)]; } __attribute__((aligned(16))) rte_xmm_t; +/* rte_vect_* abstraction implementation using NEON */ + +/* loads the __m128i value from address p(does not need to be 16-byte aligned)*/ +#define rte_vect_loadu_sil128(p) vld1q_s32((const int32_t *)p) + +/* sets the 4 signed 32-bit integer values and returns the __m128i variable */ +static inline __m128i __attribute__((always_inline)) +rte_vect_set_epi32(int i3, int i2, int i1, int i0) +{ + int32_t data[4] = {i0, i1, i2, i3}; + + return vld1q_s32(data); +} + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/include/arch/x86/rte_vect.h b/lib/librte_eal/common/include/arch/x86/rte_vect.h index b698797..91c6523 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_vect.h +++ b/lib/librte_eal/common/include/arch/x86/rte_vect.h @@ -125,6 +125,14 @@ typedef union rte_ymm { }) #endif /* (defined(__ICC) && __ICC < 1210) */ +/* rte_vect_* abstraction implementation using SSE */ + +/* loads the __m128i value from address p(does not need to be 16-byte aligned)*/ +#define rte_vect_loadu_sil128(p) _mm_loadu_si128(p) + +/* sets the 4 signed 32-bit integer values and returns the __m128i variable */ +#define rte_vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0) + #ifdef __cplusplus } #endif