Message ID | 1448534997-24297-1-git-send-email-michael.qiu@intel.com (mailing list archive) |
---|---|
State | Accepted, 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 9A89CC3D0; Thu, 26 Nov 2015 11:50:10 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 11472C3C0 for <dev@dpdk.org>; Thu, 26 Nov 2015 11:50:08 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 26 Nov 2015 02:50:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,346,1444719600"; d="scan'208";a="2587644" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga004.fm.intel.com with ESMTP; 26 Nov 2015 02:50:06 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id tAQAo4Eb004736; Thu, 26 Nov 2015 18:50:04 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id tAQAo2U5024334; Thu, 26 Nov 2015 18:50:04 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tAQAo1H0024328; Thu, 26 Nov 2015 18:50:01 +0800 From: Michael Qiu <michael.qiu@intel.com> To: dev@dpdk.org Date: Thu, 26 Nov 2015 18:49:57 +0800 Message-Id: <1448534997-24297-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 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
Michael Qiu
Nov. 26, 2015, 10:49 a.m. UTC
gcc 4.3.4 does not include "immintrin.h", and will post below error:
lib/librte_sched/rte_sched.c:56:23: error:
immintrin.h: No such file or directory
To avoid this issue, a gcc version check is need and a flag to indicate
vector ablility.
Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
lib/librte_sched/rte_sched.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
Comments
2015-11-26 18:49, Michael Qiu: > gcc 4.3.4 does not include "immintrin.h", and will post below error: > lib/librte_sched/rte_sched.c:56:23: error: > immintrin.h: No such file or directory > > To avoid this issue, a gcc version check is need and a flag to indicate > vector ablility. [...] > +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > + > +#if defined(__AVX__) > #include <immintrin.h> > +#define SCHED_VECTOR_ENABLE > +#endif > + > +#else > + > +#include <x86intrin.h> > +#define SCHED_VECTOR_ENABLE > + > +#endif This kind of complication is managed by EAL. I think we should include rte_vect.h.
On 2015/11/27 5:29, Thomas Monjalon wrote: > 2015-11-26 18:49, Michael Qiu: >> gcc 4.3.4 does not include "immintrin.h", and will post below error: >> lib/librte_sched/rte_sched.c:56:23: error: >> immintrin.h: No such file or directory >> >> To avoid this issue, a gcc version check is need and a flag to indicate >> vector ablility. > [...] >> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) >> + >> +#if defined(__AVX__) >> #include <immintrin.h> >> +#define SCHED_VECTOR_ENABLE >> +#endif >> + >> +#else >> + >> +#include <x86intrin.h> >> +#define SCHED_VECTOR_ENABLE >> + >> +#endif > This kind of complication is managed by EAL. > I think we should include rte_vect.h. As I know here it needs a flag to identify whether the platform support AVX, if not it will not use it, so I don't know if we could only simply include rte_vect.h? Thanks, Michael > >
2015-11-27 02:26, Qiu, Michael: > On 2015/11/27 5:29, Thomas Monjalon wrote: > > 2015-11-26 18:49, Michael Qiu: > >> gcc 4.3.4 does not include "immintrin.h", and will post below error: > >> lib/librte_sched/rte_sched.c:56:23: error: > >> immintrin.h: No such file or directory > >> > >> To avoid this issue, a gcc version check is need and a flag to indicate > >> vector ablility. > > [...] > >> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > >> + > >> +#if defined(__AVX__) > >> #include <immintrin.h> > >> +#define SCHED_VECTOR_ENABLE > >> +#endif > >> + > >> +#else > >> + > >> +#include <x86intrin.h> > >> +#define SCHED_VECTOR_ENABLE > >> + > >> +#endif > > This kind of complication is managed by EAL. > > I think we should include rte_vect.h. > > As I know here it needs a flag to identify whether the platform support > AVX, if not it will not use it, so I don't know if we could only simply > include rte_vect.h? It's not exclusive. You can include rte_vect.h and check AVX to define SCHED_VECTOR_ENABLE.
really?I don't think so. AVX Marco only exist in the gcc version below 4.4, I still need to check if below or beyond 4.4 am I right? Thanks, Michael > 在 2015年11月27日,下午5:01,Thomas Monjalon <thomas.monjalon@6wind.com> 写道: > > 2015-11-27 02:26, Qiu, Michael: >>> On 2015/11/27 5:29, Thomas Monjalon wrote: >>> 2015-11-26 18:49, Michael Qiu: >>>> gcc 4.3.4 does not include "immintrin.h", and will post below error: >>>> lib/librte_sched/rte_sched.c:56:23: error: >>>> immintrin.h: No such file or directory >>>> >>>> To avoid this issue, a gcc version check is need and a flag to indicate >>>> vector ablility. >>> [...] >>>> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) >>>> + >>>> +#if defined(__AVX__) >>>> #include <immintrin.h> >>>> +#define SCHED_VECTOR_ENABLE >>>> +#endif >>>> + >>>> +#else >>>> + >>>> +#include <x86intrin.h> >>>> +#define SCHED_VECTOR_ENABLE >>>> + >>>> +#endif >>> This kind of complication is managed by EAL. >>> I think we should include rte_vect.h. >> >> As I know here it needs a flag to identify whether the platform support >> AVX, if not it will not use it, so I don't know if we could only simply >> include rte_vect.h? > > It's not exclusive. > You can include rte_vect.h and check AVX to define SCHED_VECTOR_ENABLE. >
> -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiu, Michael > Sent: Friday, November 27, 2015 11:53 AM > To: Thomas Monjalon > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 > > really?I don't think so. > > AVX Marco only exist in the gcc version below 4.4, I still need to check if below or beyond 4.4 am I right? > > Thanks, > Michael If you look at lib/librte_eal/common/include/arch/x86/rte_vect.h, you'll see the code similar to one you are trying to put into rte_shed.c: lib/librte_eal/common/include/arch/x86/rte_vect.h: ... #if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) #ifdef __SSE__ #include <xmmintrin.h> #endif #ifdef __SSE2__ #include <emmintrin.h> #endif #ifdef __SSE3__ #include <tmmintrin.h> #endif #if defined(__SSE4_2__) || defined(__SSE4_1__) #include <smmintrin.h> #endif #if defined(__AVX__) #include <immintrin.h> #endif #else #include <x86intrin.h> #endif ... So I think you can do just like that: #include <rte_vect.h> #if defined(__AVX__) #define SCHED_VECTOR_ENABLE #endif inside rte_sched.c Konstantin > > > > 在 2015年11月27日,下午5:01,Thomas Monjalon <thomas.monjalon@6wind.com> 写道: > > > > 2015-11-27 02:26, Qiu, Michael: > >>> On 2015/11/27 5:29, Thomas Monjalon wrote: > >>> 2015-11-26 18:49, Michael Qiu: > >>>> gcc 4.3.4 does not include "immintrin.h", and will post below error: > >>>> lib/librte_sched/rte_sched.c:56:23: error: > >>>> immintrin.h: No such file or directory > >>>> > >>>> To avoid this issue, a gcc version check is need and a flag to indicate > >>>> vector ablility. > >>> [...] > >>>> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > >>>> + > >>>> +#if defined(__AVX__) > >>>> #include <immintrin.h> > >>>> +#define SCHED_VECTOR_ENABLE > >>>> +#endif > >>>> + > >>>> +#else > >>>> + > >>>> +#include <x86intrin.h> > >>>> +#define SCHED_VECTOR_ENABLE > >>>> + > >>>> +#endif > >>> This kind of complication is managed by EAL. > >>> I think we should include rte_vect.h. > >> > >> As I know here it needs a flag to identify whether the platform support > >> AVX, if not it will not use it, so I don't know if we could only simply > >> include rte_vect.h? > > > > It's not exclusive. > > You can include rte_vect.h and check AVX to define SCHED_VECTOR_ENABLE. > >
I just replied that Marco AVX only exist in gcc version < 4.4 , otherwise it will not exist. What's your suggest will not work if gcc version greater than 4.3. So still need to check gcc version. Any other solution? Thanks, Michael > 在 2015年11月27日,下午8:34,Ananyev, Konstantin <konstantin.ananyev@intel.com> 写道: > > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiu, Michael >> Sent: Friday, November 27, 2015 11:53 AM >> To: Thomas Monjalon >> Cc: dev@dpdk.org >> Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 >> >> really?I don't think so. >> >> AVX Marco only exist in the gcc version below 4.4, I still need to check if below or beyond 4.4 am I right? >> >> Thanks, >> Michael > > > If you look at lib/librte_eal/common/include/arch/x86/rte_vect.h, you'll see the code similar > to one you are trying to put into rte_shed.c: > > lib/librte_eal/common/include/arch/x86/rte_vect.h: > ... > #if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > > #ifdef __SSE__ > #include <xmmintrin.h> > #endif > > #ifdef __SSE2__ > #include <emmintrin.h> > #endif > > #ifdef __SSE3__ > #include <tmmintrin.h> > #endif > > #if defined(__SSE4_2__) || defined(__SSE4_1__) > #include <smmintrin.h> > #endif > > #if defined(__AVX__) > #include <immintrin.h> > #endif > > #else > > #include <x86intrin.h> > > #endif > ... > > So I think you can do just like that: > > #include <rte_vect.h> > #if defined(__AVX__) > #define SCHED_VECTOR_ENABLE > #endif > > inside rte_sched.c > > Konstantin > > >> >> >>> 在 2015年11月27日,下午5:01,Thomas Monjalon <thomas.monjalon@6wind.com> 写道: >>> >>> 2015-11-27 02:26, Qiu, Michael: >>>>>> On 2015/11/27 5:29, Thomas Monjalon wrote: >>>>>> 2015-11-26 18:49, Michael Qiu: >>>>>> gcc 4.3.4 does not include "immintrin.h", and will post below error: >>>>>> lib/librte_sched/rte_sched.c:56:23: error: >>>>>> immintrin.h: No such file or directory >>>>>> >>>>>> To avoid this issue, a gcc version check is need and a flag to indicate >>>>>> vector ablility. >>>>> [...] >>>>>> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) >>>>>> + >>>>>> +#if defined(__AVX__) >>>>>> #include <immintrin.h> >>>>>> +#define SCHED_VECTOR_ENABLE >>>>>> +#endif >>>>>> + >>>>>> +#else >>>>>> + >>>>>> +#include <x86intrin.h> >>>>>> +#define SCHED_VECTOR_ENABLE >>>>>> + >>>>>> +#endif >>>>> This kind of complication is managed by EAL. >>>>> I think we should include rte_vect.h. >>>> >>>> As I know here it needs a flag to identify whether the platform support >>>> AVX, if not it will not use it, so I don't know if we could only simply >>>> include rte_vect.h? >>> >>> It's not exclusive. >>> You can include rte_vect.h and check AVX to define SCHED_VECTOR_ENABLE. >>>
> -----Original Message----- > From: Qiu, Michael > Sent: Friday, November 27, 2015 2:02 PM > To: Ananyev, Konstantin > Cc: Thomas Monjalon; dev@dpdk.org > Subject: Re: [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 > > I just replied that Marco AVX only exist in gcc version < 4.4 , otherwise it will not exist. If macro __AVX__ not defined, then #if defined(__AVX__) would always be false and SCHED_VECTOR_ENABLE also wouldn't be defined. So still don't understand why that is a problem Konstantin > > What's your suggest will not work if gcc version greater than 4.3. > > So still need to check gcc version. Any other solution? > > Thanks, > Michael > > > 在 2015年11月27日,下午8:34,Ananyev, Konstantin <konstantin.ananyev@intel.com> 写道: > > > > > >> -----Original Message----- > >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiu, Michael > >> Sent: Friday, November 27, 2015 11:53 AM > >> To: Thomas Monjalon > >> Cc: dev@dpdk.org > >> Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 > >> > >> really?I don't think so. > >> > >> AVX Marco only exist in the gcc version below 4.4, I still need to check if below or beyond 4.4 am I right? > >> > >> Thanks, > >> Michael > > > > > > If you look at lib/librte_eal/common/include/arch/x86/rte_vect.h, you'll see the code similar > > to one you are trying to put into rte_shed.c: > > > > lib/librte_eal/common/include/arch/x86/rte_vect.h: > > ... > > #if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > > > > #ifdef __SSE__ > > #include <xmmintrin.h> > > #endif > > > > #ifdef __SSE2__ > > #include <emmintrin.h> > > #endif > > > > #ifdef __SSE3__ > > #include <tmmintrin.h> > > #endif > > > > #if defined(__SSE4_2__) || defined(__SSE4_1__) > > #include <smmintrin.h> > > #endif > > > > #if defined(__AVX__) > > #include <immintrin.h> > > #endif > > > > #else > > > > #include <x86intrin.h> > > > > #endif > > ... > > > > So I think you can do just like that: > > > > #include <rte_vect.h> > > #if defined(__AVX__) > > #define SCHED_VECTOR_ENABLE > > #endif > > > > inside rte_sched.c > > > > Konstantin > > > > > >> > >> > >>> 在 2015年11月27日,下午5:01,Thomas Monjalon <thomas.monjalon@6wind.com> 写道: > >>> > >>> 2015-11-27 02:26, Qiu, Michael: > >>>>>> On 2015/11/27 5:29, Thomas Monjalon wrote: > >>>>>> 2015-11-26 18:49, Michael Qiu: > >>>>>> gcc 4.3.4 does not include "immintrin.h", and will post below error: > >>>>>> lib/librte_sched/rte_sched.c:56:23: error: > >>>>>> immintrin.h: No such file or directory > >>>>>> > >>>>>> To avoid this issue, a gcc version check is need and a flag to indicate > >>>>>> vector ablility. > >>>>> [...] > >>>>>> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > >>>>>> + > >>>>>> +#if defined(__AVX__) > >>>>>> #include <immintrin.h> > >>>>>> +#define SCHED_VECTOR_ENABLE > >>>>>> +#endif > >>>>>> + > >>>>>> +#else > >>>>>> + > >>>>>> +#include <x86intrin.h> > >>>>>> +#define SCHED_VECTOR_ENABLE > >>>>>> + > >>>>>> +#endif > >>>>> This kind of complication is managed by EAL. > >>>>> I think we should include rte_vect.h. > >>>> > >>>> As I know here it needs a flag to identify whether the platform support > >>>> AVX, if not it will not use it, so I don't know if we could only simply > >>>> include rte_vect.h? > >>> > >>> It's not exclusive. > >>> You can include rte_vect.h and check AVX to define SCHED_VECTOR_ENABLE. > >>>
Sorry for not explaining clearly. For gcc version start from version 4.4, x86intrin.h will be include, and inside x86intrin.h, immintrin.h will be directly include without check AVX (as I know, AVX is not exist when gcc >= 4.4),so no AVX macro does not mean vector disable. Only gcc < 4.4 and no macro AVX will disable vector. This is my understanding, may be wrong :) Thanks, Michael > 在 2015年11月27日,下午10:09,Ananyev, Konstantin <konstantin.ananyev@intel.com> 写道: > > > >> -----Original Message----- >> From: Qiu, Michael >> Sent: Friday, November 27, 2015 2:02 PM >> To: Ananyev, Konstantin >> Cc: Thomas Monjalon; dev@dpdk.org >> Subject: Re: [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 >> >> I just replied that Marco AVX only exist in gcc version < 4.4 , otherwise it will not exist. > > If macro __AVX__ not defined, then > #if defined(__AVX__) > would always be false and SCHED_VECTOR_ENABLE also wouldn't be defined. > So still don't understand why that is a problem > Konstantin > >> >> What's your suggest will not work if gcc version greater than 4.3. >> >> So still need to check gcc version. Any other solution? >> >> Thanks, >> Michael >> >>> 在 2015年11月27日,下午8:34,Ananyev, Konstantin <konstantin.ananyev@intel.com> 写道: >>> >>> >>>> -----Original Message----- >>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiu, Michael >>>> Sent: Friday, November 27, 2015 11:53 AM >>>> To: Thomas Monjalon >>>> Cc: dev@dpdk.org >>>> Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 >>>> >>>> really?I don't think so. >>>> >>>> AVX Marco only exist in the gcc version below 4.4, I still need to check if below or beyond 4.4 am I right? >>>> >>>> Thanks, >>>> Michael >>> >>> >>> If you look at lib/librte_eal/common/include/arch/x86/rte_vect.h, you'll see the code similar >>> to one you are trying to put into rte_shed.c: >>> >>> lib/librte_eal/common/include/arch/x86/rte_vect.h: >>> ... >>> #if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) >>> >>> #ifdef __SSE__ >>> #include <xmmintrin.h> >>> #endif >>> >>> #ifdef __SSE2__ >>> #include <emmintrin.h> >>> #endif >>> >>> #ifdef __SSE3__ >>> #include <tmmintrin.h> >>> #endif >>> >>> #if defined(__SSE4_2__) || defined(__SSE4_1__) >>> #include <smmintrin.h> >>> #endif >>> >>> #if defined(__AVX__) >>> #include <immintrin.h> >>> #endif >>> >>> #else >>> >>> #include <x86intrin.h> >>> >>> #endif >>> ... >>> >>> So I think you can do just like that: >>> >>> #include <rte_vect.h> >>> #if defined(__AVX__) >>> #define SCHED_VECTOR_ENABLE >>> #endif >>> >>> inside rte_sched.c >>> >>> Konstantin >>> >>> >>>> >>>> >>>>> 在 2015年11月27日,下午5:01,Thomas Monjalon <thomas.monjalon@6wind.com> 写道: >>>>> >>>>> 2015-11-27 02:26, Qiu, Michael: >>>>>>>> On 2015/11/27 5:29, Thomas Monjalon wrote: >>>>>>>> 2015-11-26 18:49, Michael Qiu: >>>>>>>> gcc 4.3.4 does not include "immintrin.h", and will post below error: >>>>>>>> lib/librte_sched/rte_sched.c:56:23: error: >>>>>>>> immintrin.h: No such file or directory >>>>>>>> >>>>>>>> To avoid this issue, a gcc version check is need and a flag to indicate >>>>>>>> vector ablility. >>>>>>> [...] >>>>>>>> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) >>>>>>>> + >>>>>>>> +#if defined(__AVX__) >>>>>>>> #include <immintrin.h> >>>>>>>> +#define SCHED_VECTOR_ENABLE >>>>>>>> +#endif >>>>>>>> + >>>>>>>> +#else >>>>>>>> + >>>>>>>> +#include <x86intrin.h> >>>>>>>> +#define SCHED_VECTOR_ENABLE >>>>>>>> + >>>>>>>> +#endif >>>>>>> This kind of complication is managed by EAL. >>>>>>> I think we should include rte_vect.h. >>>>>> >>>>>> As I know here it needs a flag to identify whether the platform support >>>>>> AVX, if not it will not use it, so I don't know if we could only simply >>>>>> include rte_vect.h? >>>>> >>>>> It's not exclusive. >>>>> You can include rte_vect.h and check AVX to define SCHED_VECTOR_ENABLE. >>>>>
> -----Original Message----- > From: Qiu, Michael > Sent: Friday, November 27, 2015 3:22 PM > To: Ananyev, Konstantin > Cc: Thomas Monjalon; dev@dpdk.org > Subject: Re: [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 > > Sorry for not explaining clearly. > > For gcc version start from version 4.4, x86intrin.h will be include, and inside x86intrin.h, immintrin.h will be directly include without > check AVX Yes, but inside immintrin.h there is a check. At least that what I am seeing for gcc4.4.3: #ifdef __AVX__ #include <avxintrin.h> #endif Isn't it the same for your case? Konstantin > (as I know, AVX is not exist when gcc >= 4.4),so no AVX macro does not mean vector disable. > > Only gcc < 4.4 and no macro AVX will disable vector. > > This is my understanding, may be wrong :) > > Thanks, > Michael > > > 在 2015年11月27日,下午10:09,Ananyev, Konstantin <konstantin.ananyev@intel.com> 写道: > > > > > > > >> -----Original Message----- > >> From: Qiu, Michael > >> Sent: Friday, November 27, 2015 2:02 PM > >> To: Ananyev, Konstantin > >> Cc: Thomas Monjalon; dev@dpdk.org > >> Subject: Re: [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 > >> > >> I just replied that Marco AVX only exist in gcc version < 4.4 , otherwise it will not exist. > > > > If macro __AVX__ not defined, then > > #if defined(__AVX__) > > would always be false and SCHED_VECTOR_ENABLE also wouldn't be defined. > > So still don't understand why that is a problem > > Konstantin > > > >> > >> What's your suggest will not work if gcc version greater than 4.3. > >> > >> So still need to check gcc version. Any other solution? > >> > >> Thanks, > >> Michael > >> > >>> 在 2015年11月27日,下午8:34,Ananyev, Konstantin <konstantin.ananyev@intel.com> 写道: > >>> > >>> > >>>> -----Original Message----- > >>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiu, Michael > >>>> Sent: Friday, November 27, 2015 11:53 AM > >>>> To: Thomas Monjalon > >>>> Cc: dev@dpdk.org > >>>> Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4 > >>>> > >>>> really?I don't think so. > >>>> > >>>> AVX Marco only exist in the gcc version below 4.4, I still need to check if below or beyond 4.4 am I right? > >>>> > >>>> Thanks, > >>>> Michael > >>> > >>> > >>> If you look at lib/librte_eal/common/include/arch/x86/rte_vect.h, you'll see the code similar > >>> to one you are trying to put into rte_shed.c: > >>> > >>> lib/librte_eal/common/include/arch/x86/rte_vect.h: > >>> ... > >>> #if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > >>> > >>> #ifdef __SSE__ > >>> #include <xmmintrin.h> > >>> #endif > >>> > >>> #ifdef __SSE2__ > >>> #include <emmintrin.h> > >>> #endif > >>> > >>> #ifdef __SSE3__ > >>> #include <tmmintrin.h> > >>> #endif > >>> > >>> #if defined(__SSE4_2__) || defined(__SSE4_1__) > >>> #include <smmintrin.h> > >>> #endif > >>> > >>> #if defined(__AVX__) > >>> #include <immintrin.h> > >>> #endif > >>> > >>> #else > >>> > >>> #include <x86intrin.h> > >>> > >>> #endif > >>> ... > >>> > >>> So I think you can do just like that: > >>> > >>> #include <rte_vect.h> > >>> #if defined(__AVX__) > >>> #define SCHED_VECTOR_ENABLE > >>> #endif > >>> > >>> inside rte_sched.c > >>> > >>> Konstantin > >>> > >>> > >>>> > >>>> > >>>>> 在 2015年11月27日,下午5:01,Thomas Monjalon <thomas.monjalon@6wind.com> 写道: > >>>>> > >>>>> 2015-11-27 02:26, Qiu, Michael: > >>>>>>>> On 2015/11/27 5:29, Thomas Monjalon wrote: > >>>>>>>> 2015-11-26 18:49, Michael Qiu: > >>>>>>>> gcc 4.3.4 does not include "immintrin.h", and will post below error: > >>>>>>>> lib/librte_sched/rte_sched.c:56:23: error: > >>>>>>>> immintrin.h: No such file or directory > >>>>>>>> > >>>>>>>> To avoid this issue, a gcc version check is need and a flag to indicate > >>>>>>>> vector ablility. > >>>>>>> [...] > >>>>>>>> +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) > >>>>>>>> + > >>>>>>>> +#if defined(__AVX__) > >>>>>>>> #include <immintrin.h> > >>>>>>>> +#define SCHED_VECTOR_ENABLE > >>>>>>>> +#endif > >>>>>>>> + > >>>>>>>> +#else > >>>>>>>> + > >>>>>>>> +#include <x86intrin.h> > >>>>>>>> +#define SCHED_VECTOR_ENABLE > >>>>>>>> + > >>>>>>>> +#endif > >>>>>>> This kind of complication is managed by EAL. > >>>>>>> I think we should include rte_vect.h. > >>>>>> > >>>>>> As I know here it needs a flag to identify whether the platform support > >>>>>> AVX, if not it will not use it, so I don't know if we could only simply > >>>>>> include rte_vect.h? > >>>>> > >>>>> It's not exclusive. > >>>>> You can include rte_vect.h and check AVX to define SCHED_VECTOR_ENABLE. > >>>>>
diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index d47cfc2..780b314 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -53,7 +53,21 @@ #endif #ifdef RTE_SCHED_VECTOR + +#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) + +#if defined(__AVX__) #include <immintrin.h> +#define SCHED_VECTOR_ENABLE +#endif + +#else + +#include <x86intrin.h> +#define SCHED_VECTOR_ENABLE + +#endif + #endif #define RTE_SCHED_TB_RATE_CONFIG_ERR (1e-7) @@ -1667,7 +1681,7 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos) return 1; } -#ifdef RTE_SCHED_VECTOR +#ifdef SCHED_VECTOR_ENABLE static inline int grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)