Skip to contentSkip to conversation

RFC: remove build-type CPU flag macros

PATCH Applied Bruce Richardson 4 participants 11 messages Aug 5, 2020 – Aug 7, 2020

lore
Share & tools
lore
#0 lore raw

cover RFC: remove build-type CPU flag macros

I DPDK as part of our build on all architectures, we define a set of RTE_MACHINE_CPUFLAG values which are then used in the code. However, as best I can see, each of these macros just duplicates a shorter macro provided by the compiler, e.g. RTE_MACHINE_CPUFLAG_SSE3 == __SSE3__, RTE_MACHINE_CPUFLAG_ALTIVEC == __ALTIVEC__, etc.

Therefore, I propose we remove these macros in 20.11 and just use the compiler provided ones directly. As such, I'm including a deprecation notice patch for this change. Please review and ack the deprecation notice if you approve.

Thanks.

Bruce Richardson (1):
doc: add deprecation notice for CPU build flags

 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 doc: add deprecation notice for CPU build flags

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

---
 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -0
index ea4cfa7a4..68a63f345 100644
@@ -17,6 +17,11 @@ Deprecation Notices
   can be got using the ``pip``, or ``pip3``, tool for downloading python
   packages.
 
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.
+
 * kvargs: The function ``rte_kvargs_process`` will get a new parameter
   for returning key match count. It will ease handling of no-match case.
 
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#2 lore raw

Re: [dpdk-dev] [PATCH 1/1] doc: add deprecation notice for CPU build flags

Quoted 6 lines · Bruce Richardson

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

Quoted 23 lines
---
 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -1
index ea4cfa7a4..68a63f345 100644
@@ -17,6 +17,11 @@ Deprecation Notices
   can be got using the ``pip``, or ``pip3``, tool for downloading python
   packages.
 
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.
+
 * kvargs: The function ``rte_kvargs_process`` will get a new parameter
   for returning key match count. It will ease handling of no-match case.
 
--

2.25.1

#3 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

In reply to Bruce Richardson

05/08/2020 16:21, Bruce Richardson:

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 12 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

#4 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

Quoted 5 lines · Thomas Monjalon

05/08/2020 16:21, Bruce Richardson:

Quoted 4 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

Quoted 13 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 8 lines

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

Sure, if you think it's worthwhile keeping them, we can do so. It's just right now they seem to be largely a waste of space. For #2, I'm not sure when we would want to grep for them all, except possibly to remove them. :-)

#5 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

05/08/2020 17:07, Bruce Richardson:

Quoted 20 lines · Thomas Monjalon
Quoted 5 lines

05/08/2020 16:21, Bruce Richardson:

Quoted 4 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

Quoted 13 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 8 lines

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

Quoted 4 lines

Sure, if you think it's worthwhile keeping them, we can do so. It's just right now they seem to be largely a waste of space. For #2, I'm not sure when we would want to grep for them all, except possibly to remove them. :-)

For instance, in a lib, I grep where we have CPU specific code.

We probably need more opinions, I can change my mind.

#6 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

Quoted 21 lines · Thomas Monjalon

05/08/2020 17:07, Bruce Richardson:

Quoted 20 lines · Thomas Monjalon
Quoted 18 lines

05/08/2020 16:21, Bruce Richardson:

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 12 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

Quoted 9 lines
Quoted 4 lines

Sure, if you think it's worthwhile keeping them, we can do so. It's just right now they seem to be largely a waste of space. For #2, I'm not sure when we would want to grep for them all, except possibly to remove them. :-)

For instance, in a lib, I grep where we have CPU specific code.

We probably need more opinions, I can change my mind.

Yes, we need some more opinions here.

For the above point, yes it's useful to be able to grep for these things, but it does assume that everybody uses the DPDK-defines and doesn't use the compiler ones directly. There are a few instances where there seems to be x86, ARM or PPC compiler flags already directly used in the code.

As well as brevity, the other big reason I see for removing them is to avoid having to maintain these lists of flags for future use. Right now, with -march=skylake-avx512, gcc will define 7 different AVX feature flags. DPDK, on the other hand, only provides equivalent defines for 3 of them. We have no automatic way of pulling all newly added flags from gcc/clang into our build, so we just add them on an as-needed basis, which makes it more awkward for those adding new features that may depend on the flags. If we always try to add in all flags to keep things in sync, we are just duplicating the efforts the compiler authors have already done for us, and wasting the effort for those flags that are unused.

/Bruce

#7 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

05/08/2020 18:45, Bruce Richardson:

Quoted 38 lines · Thomas Monjalon
Quoted 21 lines

05/08/2020 17:07, Bruce Richardson:

Quoted 20 lines · Thomas Monjalon
Quoted 18 lines

05/08/2020 16:21, Bruce Richardson:

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 12 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

Quoted 9 lines
Quoted 4 lines

Sure, if you think it's worthwhile keeping them, we can do so. It's just right now they seem to be largely a waste of space. For #2, I'm not sure when we would want to grep for them all, except possibly to remove them. :-)

For instance, in a lib, I grep where we have CPU specific code.

We probably need more opinions, I can change my mind.

Yes, we need some more opinions here.

For the above point, yes it's useful to be able to grep for these things, but it does assume that everybody uses the DPDK-defines and doesn't use the compiler ones directly. There are a few instances where there seems to be x86, ARM or PPC compiler flags already directly used in the code.

Quoted 10 lines

As well as brevity, the other big reason I see for removing them is to avoid having to maintain these lists of flags for future use. Right now, with -march=skylake-avx512, gcc will define 7 different AVX feature flags. DPDK, on the other hand, only provides equivalent defines for 3 of them. We have no automatic way of pulling all newly added flags from gcc/clang into our build, so we just add them on an as-needed basis, which makes it more awkward for those adding new features that may depend on the flags. If we always try to add in all flags to keep things in sync, we are just duplicating the efforts the compiler authors have already done for us, and wasting the effort for those flags that are unused.

You see, you can provide good arguments :) Maybe some of them deserve to be part of the patch.

#8 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

Any other opinions?

05/08/2020 19:02, Thomas Monjalon:

Quoted 54 lines

05/08/2020 18:45, Bruce Richardson:

Quoted 38 lines · Thomas Monjalon
Quoted 21 lines

05/08/2020 17:07, Bruce Richardson:

Quoted 20 lines · Thomas Monjalon
Quoted 18 lines

05/08/2020 16:21, Bruce Richardson:

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 12 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

Quoted 9 lines
Quoted 4 lines

Sure, if you think it's worthwhile keeping them, we can do so. It's just right now they seem to be largely a waste of space. For #2, I'm not sure when we would want to grep for them all, except possibly to remove them. :-)

For instance, in a lib, I grep where we have CPU specific code.

We probably need more opinions, I can change my mind.

Yes, we need some more opinions here.

For the above point, yes it's useful to be able to grep for these things, but it does assume that everybody uses the DPDK-defines and doesn't use the compiler ones directly. There are a few instances where there seems to be x86, ARM or PPC compiler flags already directly used in the code.

Quoted 10 lines

As well as brevity, the other big reason I see for removing them is to avoid having to maintain these lists of flags for future use. Right now, with -march=skylake-avx512, gcc will define 7 different AVX feature flags. DPDK, on the other hand, only provides equivalent defines for 3 of them. We have no automatic way of pulling all newly added flags from gcc/clang into our build, so we just add them on an as-needed basis, which makes it more awkward for those adding new features that may depend on the flags. If we always try to add in all flags to keep things in sync, we are just duplicating the efforts the compiler authors have already done for us, and wasting the effort for those flags that are unused.

You see, you can provide good arguments :) Maybe some of them deserve to be part of the patch.

Acked-by
#9 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

In reply to Bruce Richardson
Quoted 38 lines · Bruce Richardson
Quoted 21 lines · Thomas Monjalon

05/08/2020 17:07, Bruce Richardson:

Quoted 20 lines · Thomas Monjalon
Quoted 18 lines

05/08/2020 16:21, Bruce Richardson:

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 12 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

Quoted 9 lines
Quoted 4 lines

Sure, if you think it's worthwhile keeping them, we can do so. It's just right now they seem to be largely a waste of space. For #2, I'm not sure when we would want to grep for them all, except possibly to remove them. :-)

For instance, in a lib, I grep where we have CPU specific code.

We probably need more opinions, I can change my mind.

Yes, we need some more opinions here.

For the above point, yes it's useful to be able to grep for these things, but it does assume that everybody uses the DPDK-defines and doesn't use the compiler ones directly. There are a few instances where there seems to be x86, ARM or PPC compiler flags already directly used in the code.

Quoted 11 lines

As well as brevity, the other big reason I see for removing them is to avoid having to maintain these lists of flags for future use. Right now, with -march=skylake-avx512, gcc will define 7 different AVX feature flags. DPDK, on the other hand, only provides equivalent defines for 3 of them. We have no automatic way of pulling all newly added flags from gcc/clang into our build, so we just add them on an as-needed basis, which makes it more awkward for those adding new features that may depend on the flags. If we always try to add in all flags to keep things in sync, we are just duplicating the efforts the compiler authors have already done for us, and wasting the effort for those flags that are unused.

Sounds reasonable,

#10 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH 1/1] doc: add deprecation notice for CPU build flags

06/08/2020 23:41, Ferruh Yigit:

Quoted 51 lines · Bruce Richardson
Quoted 38 lines · Thomas Monjalon
Quoted 21 lines

05/08/2020 17:07, Bruce Richardson:

Quoted 20 lines · Thomas Monjalon
Quoted 18 lines

05/08/2020 16:21, Bruce Richardson:

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 23

Quoted 12 lines

The RTE_MACHINE_CPUFLAGS_* macros in DPDK build just duplicate info from the compiler macros, so we can remove them and just use the compiler versions directly.

---

doc/guides/rel_notes/deprecation.rst +4 -0
+* build macros: The macros defining RTE_MACHINE_CPUFLAG_* will be removed
+  from the build. The information provided by these macros is available
+  through standard compiler macros. For example, RTE_MACHINE_CPUFLAG_SSE3
+  duplicates the compiler-provided macro __SSE3__.

I see 2 advantages of having alias:
- if 2 compilers differ, we can manage
- we can find all such macros with grep RTE_MACHINE_CPUFLAG

Quoted 9 lines
Quoted 4 lines

Sure, if you think it's worthwhile keeping them, we can do so. It's just right now they seem to be largely a waste of space. For #2, I'm not sure when we would want to grep for them all, except possibly to remove them. :-)

For instance, in a lib, I grep where we have CPU specific code.

We probably need more opinions, I can change my mind.

Yes, we need some more opinions here.

For the above point, yes it's useful to be able to grep for these things, but it does assume that everybody uses the DPDK-defines and doesn't use the compiler ones directly. There are a few instances where there seems to be x86, ARM or PPC compiler flags already directly used in the code.

Quoted 11 lines

As well as brevity, the other big reason I see for removing them is to avoid having to maintain these lists of flags for future use. Right now, with -march=skylake-avx512, gcc will define 7 different AVX feature flags. DPDK, on the other hand, only provides equivalent defines for 3 of them. We have no automatic way of pulling all newly added flags from gcc/clang into our build, so we just add them on an as-needed basis, which makes it more awkward for those adding new features that may depend on the flags. If we always try to add in all flags to keep things in sync, we are just duplicating the efforts the compiler authors have already done for us, and wasting the effort for those flags that are unused.

Quoted 3 lines

Sounds reasonable,

Applied