Skip to contentSkip to conversation

lib/librte_sched: Fix compile with gcc 4.3.4

PATCH Superseded Michael Qiu 3 participants 15 messages Nov 26, 2015 – Dec 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/librte_sched: Fix compile with gcc 4.3.4

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.

---
 lib/librte_sched/rte_sched.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
lib/librte_sched/rte_sched.c +15 -1
index d47cfc2..780b314 100644
@@ -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)
Signature · 1 line
1.9.3
#1 lore raw

2015-11-26 18:49, Michael Qiu:

Quoted 6 lines

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.

[...]

lib/librte_sched/rte_sched.c line 69

Quoted 13 lines
lib/librte_sched/rte_sched.c +12 -0
+#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.

#2 lore raw
Quoted 8 lines · Thomas Monjalon

2015-11-26 18:49, Michael Qiu:

Quoted 6 lines

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.

[...]

Quoted 15 lines

lib/librte_sched/rte_sched.c line 69

Quoted 13 lines
lib/librte_sched/rte_sched.c +12 -0
+#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

Quoted 2 lines
#3 lore raw

2015-11-27 02:26, Qiu, Michael:

Quoted 25 lines · Thomas Monjalon
Quoted 8 lines

2015-11-26 18:49, Michael Qiu:

Quoted 6 lines

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.

[...]

Quoted 15 lines

lib/librte_sched/rte_sched.c line 69

Quoted 13 lines
lib/librte_sched/rte_sched.c +12 -0
+#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.

Quoted 3 lines

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.

#4 lore raw

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

Quoted 35 lines · 在 2015年11月27日,下午5:01,Thomas Monjalon <[email protected]> 写道:

2015-11-27 02:26, Qiu, Michael:

Quoted 25 lines
Quoted 9 lines · Thomas Monjalon

2015-11-26 18:49, Michael Qiu:

Quoted 6 lines

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.

[...]

Quoted 15 lines

lib/librte_sched/rte_sched.c line 69

Quoted 13 lines
lib/librte_sched/rte_sched.c +3 -0
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#if defined(__AVX__)

#include <immintrin.h>

lib/librte_sched/rte_sched.c +9 -0
+#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.

Quoted 3 lines

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.

#5 lore raw
Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiu, Michael
Sent: Friday, November 27, 2015 11:53 AM
To: Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4

Quoted 6 lines

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

Quoted 37 lines
Quoted 37 lines · 在 2015年11月27日,下午5:01,Thomas Monjalon <[email protected]> 写道:

2015-11-27 02:26, Qiu, Michael:

Quoted 25 lines
Quoted 9 lines · Thomas Monjalon

2015-11-26 18:49, Michael Qiu:

Quoted 6 lines

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.

[...]

Quoted 15 lines

lib/librte_sched/rte_sched.c line 69

Quoted 13 lines
lib/librte_sched/rte_sched.c +3 -0
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#if defined(__AVX__)

#include <immintrin.h>

lib/librte_sched/rte_sched.c +9 -0
+#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.

Quoted 3 lines

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.

#6 lore raw

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

Quoted 101 lines · Konstantin
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiu, Michael
Sent: Friday, November 27, 2015 11:53 AM
To: Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4

Quoted 6 lines

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

Quoted 37 lines
Quoted 37 lines · 在 2015年11月27日,下午5:01,Thomas Monjalon <[email protected]> 写道:

2015-11-27 02:26, Qiu, Michael:

Quoted 25 lines
Quoted 9 lines
Quoted 8 lines · Thomas Monjalon

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.

[...]

Quoted 15 lines

lib/librte_sched/rte_sched.c line 69

Quoted 13 lines
lib/librte_sched/rte_sched.c +3 -0
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#if defined(__AVX__)

#include <immintrin.h>

lib/librte_sched/rte_sched.c +9 -0
+#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.

Quoted 3 lines

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.

#7 lore raw
Quoted 10 lines

-----Original Message-----
From: Qiu, Michael
Sent: Friday, November 27, 2015 2:02 PM
To: Ananyev, Konstantin
Cc: Thomas Monjalon; [email protected]
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

Quoted 109 lines

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

Quoted 101 lines · Konstantin
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiu, Michael
Sent: Friday, November 27, 2015 11:53 AM
To: Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4

Quoted 6 lines

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

Quoted 37 lines
Quoted 37 lines · 在 2015年11月27日,下午5:01,Thomas Monjalon <[email protected]> 写道:

2015-11-27 02:26, Qiu, Michael:

Quoted 25 lines
Quoted 9 lines
Quoted 8 lines · Thomas Monjalon

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.

[...]

Quoted 15 lines

Review

Quoted 13 lines
(quoted diff) +3 -0
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#if defined(__AVX__)

#include <immintrin.h>

(quoted diff) +9 -0
+#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.

Quoted 3 lines

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.

#8 lore raw

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

Quoted 128 lines · Konstantin
Quoted 11 lines

-----Original Message-----
From: Qiu, Michael
Sent: Friday, November 27, 2015 2:02 PM
To: Ananyev, Konstantin
Cc: Thomas Monjalon; [email protected]
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

Quoted 109 lines

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

Quoted 101 lines · Konstantin
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiu, Michael
Sent: Friday, November 27, 2015 11:53 AM
To: Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4

Quoted 6 lines

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

Quoted 37 lines
Quoted 37 lines · 在 2015年11月27日,下午5:01,Thomas Monjalon <[email protected]> 写道:

2015-11-27 02:26, Qiu, Michael:

Quoted 25 lines
Quoted 9 lines
Quoted 8 lines · Thomas Monjalon

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.

[...]

Quoted 15 lines

Review

Quoted 13 lines
(quoted diff) +3 -0
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#if defined(__AVX__)

#include <immintrin.h>

(quoted diff) +9 -0
+#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.

Quoted 3 lines

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.

#9 lore raw
Quoted 9 lines

-----Original Message-----
From: Qiu, Michael
Sent: Friday, November 27, 2015 3:22 PM
To: Ananyev, Konstantin
Cc: Thomas Monjalon; [email protected]
Subject: Re: [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4

Quoted 4 lines

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

Quoted 137 lines

(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

Quoted 128 lines · Konstantin
Quoted 11 lines

-----Original Message-----
From: Qiu, Michael
Sent: Friday, November 27, 2015 2:02 PM
To: Ananyev, Konstantin
Cc: Thomas Monjalon; [email protected]
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

Quoted 109 lines

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

Quoted 101 lines · Konstantin
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiu, Michael
Sent: Friday, November 27, 2015 11:53 AM
To: Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4

Quoted 6 lines

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

Quoted 37 lines
Quoted 37 lines · 在 2015年11月27日,下午5:01,Thomas Monjalon <[email protected]> 写道:

2015-11-27 02:26, Qiu, Michael:

Quoted 25 lines
Quoted 9 lines
Quoted 8 lines · Thomas Monjalon

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.

[...]

Quoted 15 lines

Review

Quoted 13 lines
(quoted diff) +3 -0
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#if defined(__AVX__)

#include <immintrin.h>

(quoted diff) +9 -0
+#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.

Quoted 3 lines

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.

#10 lore raw

PATCH v2 1/1 lib/librte_sched: Fix compile with gcc 4.3.4

In reply to 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.

Fixes 42ec27a0178a ("sched: enable SSE optimizations in config")

---
v2 --> v1:
include header file rte_vect.h instead of gcc version check change __AVX__ to __SSE2__ since all vector function are SSE2 related.

 lib/librte_sched/rte_sched.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
lib/librte_sched/rte_sched.c +7 -2
index d47cfc2..0d46618 100644
@@ -42,6 +42,7 @@
 #include <rte_prefetch.h>
 #include <rte_branch_prediction.h>
 #include <rte_mbuf.h>
+#include <rte_vect.h>
 
 #include "rte_sched.h"
 #include "rte_bitmap.h"
@@ -53,7 +54,11 @@
 #endif
 
 #ifdef RTE_SCHED_VECTOR
-#include <immintrin.h>
+
+#if defined(__SSE2__)
+#define SCHED_VECTOR_ENABLE
+#endif
+
 #endif
 
 #define RTE_SCHED_TB_RATE_CONFIG_ERR          (1e-7)
@@ -1667,7 +1672,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)
Signature · 1 line
1.9.3
#11 lore raw

2015-12-02 10:09, Michael Qiu:

Quoted 3 lines

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

This compiler issue is fixed with rte_vect.h.

Quoted 2 lines

To avoid this issue, a gcc version check is need and a flag to indicate vector ablility.

It is another issue: we need SSE2 support.

lib/librte_sched/rte_sched.c line 45

Quoted 7 lines
lib/librte_sched/rte_sched.c +1 -0
@@ -42,6 +42,7 @@
 #include <rte_prefetch.h>
 #include <rte_branch_prediction.h>
 #include <rte_mbuf.h>
+#include <rte_vect.h>

Shouldn't be in #ifdef RTE_SCHED_VECTOR ?

lib/librte_sched/rte_sched.c line 60

Quoted 11 lines
lib/librte_sched/rte_sched.c +4 -1
 #include "rte_sched.h"
 #include "rte_bitmap.h"
@@ -53,7 +54,11 @@
 #endif
 
 #ifdef RTE_SCHED_VECTOR
-#include <immintrin.h>
+
+#if defined(__SSE2__)
+#define SCHED_VECTOR_ENABLE
+#endif

I think the flag should SCHED_VECTOR_SSE2

With this fix, the need for disabling SCHED_VECTOR for non-x86 platforms should disappear.
But it may be safe to disable it (another patch).
Thanks

#12 lore raw

I will make v3 patch to fix the issue.

Thanks,
Michael

Quoted 37 lines · Thomas Monjalon

2015-12-02 10:09, Michael Qiu:

Quoted 3 lines

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

This compiler issue is fixed with rte_vect.h.

Quoted 2 lines

To avoid this issue, a gcc version check is need and a flag to indicate vector ablility.

It is another issue: we need SSE2 support.

lib/librte_sched/rte_sched.c line 45

Quoted 7 lines
lib/librte_sched/rte_sched.c +1 -0
@@ -42,6 +42,7 @@
 #include <rte_prefetch.h>
 #include <rte_branch_prediction.h>
 #include <rte_mbuf.h>
+#include <rte_vect.h>

Shouldn't be in #ifdef RTE_SCHED_VECTOR ?

lib/librte_sched/rte_sched.c line 60

Quoted 11 lines
lib/librte_sched/rte_sched.c +4 -1
 #include "rte_sched.h"
 #include "rte_bitmap.h"
@@ -53,7 +54,11 @@
 #endif
 
 #ifdef RTE_SCHED_VECTOR
-#include <immintrin.h>
+
+#if defined(__SSE2__)
+#define SCHED_VECTOR_ENABLE
+#endif

I think the flag should SCHED_VECTOR_SSE2

With this fix, the need for disabling SCHED_VECTOR for non-x86 platforms should disappear.
But it may be safe to disable it (another patch).
Thanks

#13 lore raw

PATCH v3 1/1 lib/librte_sched: Fix compile with gcc 4.3.4

In reply to 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

This compiler issue is fixed with rte_vect.h

There is another issue, need SSE2 support

Fixes 42ec27a0178a ("sched: enable SSE optimizations in config")

---
v3 --> v2:
reformat commit log
move rte_vect.h inside RTE_SCHED_VECTOR

v2 --> v1:
include header file rte_vect.h instead of gcc version check change __AVX__ to __SSE2__ since all vector function are SSE2 related

 lib/librte_sched/rte_sched.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
lib/librte_sched/rte_sched.c +7 -2
index d47cfc2..21ebf25 100644
@@ -53,7 +53,12 @@
 #endif
 
 #ifdef RTE_SCHED_VECTOR
-#include <immintrin.h>
+#include <rte_vect.h>
+
+#if defined(__SSE2__)
+#define SCHED_VECTOR_SSE2
+#endif
+
 #endif
 
 #define RTE_SCHED_TB_RATE_CONFIG_ERR          (1e-7)
@@ -1667,7 +1672,7 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos)
 	return 1;
 }
 
-#ifdef RTE_SCHED_VECTOR
+#ifdef SCHED_VECTOR_SSE2
 
 static inline int
 grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
Signature · 1 line
1.9.3
#14 lore raw

2015-12-02 10:39, Michael Qiu:

Quoted 11 lines

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

This compiler issue is fixed with rte_vect.h

There is another issue, need SSE2 support

Fixes 42ec27a0178a ("sched: enable SSE optimizations in config")

Applied, thanks