From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 1E19E1B1B1 for ; Mon, 2 Oct 2017 02:09:39 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 01 Oct 2017 17:09:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,466,1500966000"; d="scan'208";a="1177598423" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 01 Oct 2017 17:09:38 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 1 Oct 2017 17:09:38 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 1 Oct 2017 17:09:37 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Mon, 2 Oct 2017 08:09:36 +0800 From: "Li, Xiaoyun" To: "Ananyev, Konstantin" , "Richardson, Bruce" CC: "Lu, Wenzhuo" , "Zhang, Helin" , "dev@dpdk.org" Thread-Topic: [PATCH v3 3/3] efd: run-time dispatch over x86 EFD functions Thread-Index: AQHTNptDJLnYPAuYIUyt/2IK2un7V6LPMcQAgACGWyA= Date: Mon, 2 Oct 2017 00:09:35 +0000 Message-ID: References: <1506411689-94690-1-git-send-email-xiaoyun.li@intel.com> <1506411689-94690-4-git-send-email-xiaoyun.li@intel.com> <2601191342CEEE43887BDE71AB9772585FAA2BFF@IRSMSX103.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB9772585FAA2BFF@IRSMSX103.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTFjMWU1YjUtNDA0My00MDVmLTljMTgtYmMzOWUxNTJjNjE2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkpaZ0c1VzJFUUlnMEhXbmZJVlh4Sk5MTmliZFwvMm9QT09rSmxVZUN6RGI4PSJ9 x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 3/3] efd: run-time dispatch over x86 EFD functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Oct 2017 00:09:40 -0000 OK. Won't touch it in next version. Best Regards, Xiaoyun Li > -----Original Message----- > From: Ananyev, Konstantin > Sent: Monday, October 2, 2017 08:08 > To: Li, Xiaoyun ; Richardson, Bruce > > Cc: Lu, Wenzhuo ; Zhang, Helin > ; dev@dpdk.org > Subject: RE: [PATCH v3 3/3] efd: run-time dispatch over x86 EFD functions >=20 >=20 >=20 > > > > This patch dynamically selects x86 EFD functions at run-time. >=20 > I don't think it really does. > In fact, I am not sure that we need to touch EFD at all here - from what = I can > see, it already does dynamic selection properly. > Konstantin >=20 > > This patch uses function pointer and binds it to the relative function > > based on CPU flags at constructor time. > > > > Signed-off-by: Xiaoyun Li > > --- > > lib/librte_efd/rte_efd_x86.h | 41 > > ++++++++++++++++++++++++++++++++++++++--- > > 1 file changed, 38 insertions(+), 3 deletions(-) > > > > diff --git a/lib/librte_efd/rte_efd_x86.h > > b/lib/librte_efd/rte_efd_x86.h index 34f37d7..93b6743 100644 > > --- a/lib/librte_efd/rte_efd_x86.h > > +++ b/lib/librte_efd/rte_efd_x86.h > > @@ -43,12 +43,29 @@ > > #define EFD_LOAD_SI128(val) _mm_lddqu_si128(val) #endif > > > > +typedef efd_value_t > > +(*efd_lookup_internal_avx2_t)(const efd_hashfunc_t *group_hash_idx, > > + const efd_lookuptbl_t *group_lookup_table, > > + const uint32_t hash_val_a, const uint32_t hash_val_b); > > + > > +static efd_lookup_internal_avx2_t efd_lookup_internal_avx2_ptr; > > + > > static inline efd_value_t > > efd_lookup_internal_avx2(const efd_hashfunc_t *group_hash_idx, > > const efd_lookuptbl_t *group_lookup_table, > > const uint32_t hash_val_a, const uint32_t hash_val_b) { - > #ifdef > > RTE_MACHINE_CPUFLAG_AVX2 > > + return (*efd_lookup_internal_avx2_ptr)(group_hash_idx, > > + group_lookup_table, > > + hash_val_a, hash_val_b); > > +} > > + > > +#ifdef CC_SUPPORT_AVX2 > > +static inline efd_value_t > > +efd_lookup_internal_avx2_AVX2(const efd_hashfunc_t *group_hash_idx, > > + const efd_lookuptbl_t *group_lookup_table, > > + const uint32_t hash_val_a, const uint32_t hash_val_b) { > > efd_value_t value =3D 0; > > uint32_t i =3D 0; > > __m256i vhash_val_a =3D _mm256_set1_epi32(hash_val_a); @@ - > 74,13 > > +91,31 @@ efd_lookup_internal_avx2(const efd_hashfunc_t > *group_hash_idx, > > } > > > > return value; > > -#else > > +} > > +#endif > > + > > +static inline efd_value_t > > +efd_lookup_internal_avx2_DEFAULT(const efd_hashfunc_t > *group_hash_idx, > > + const efd_lookuptbl_t *group_lookup_table, > > + const uint32_t hash_val_a, const uint32_t hash_val_b) { > > RTE_SET_USED(group_hash_idx); > > RTE_SET_USED(group_lookup_table); > > RTE_SET_USED(hash_val_a); > > RTE_SET_USED(hash_val_b); > > /* Return dummy value, only to avoid compilation breakage */ > > return 0; > > -#endif > > +} > > > > +static void __attribute__((constructor)) > > +rte_efd_x86_init(void) > > +{ > > +#ifdef CC_SUPPORT_AVX2 > > + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) > > + efd_lookup_internal_avx2_ptr =3D > efd_lookup_internal_avx2_AVX2; > > + else > > + efd_lookup_internal_avx2_ptr =3D > efd_lookup_internal_avx2_DEFAULT; > > +#else > > + efd_lookup_internal_avx2_ptr =3D efd_lookup_internal_avx2_DEFAULT; > > +#endif > > } > > -- > > 2.7.4