add Kconfig option for optimizing for cell
PATCH 1/1 add Kconfig option for optimizing for cell
Since the PPE on cell is an in-order core, it suffers significantly from wrong instruction scheduling. This adds an Kconfig option that enables passing -mtune=cell to gcc in order to generate object code that runs well on cell.
---
arch/powerpc/Makefile +4 -0
@@ -92,6 +92,10 @@ else endif endif +ifeq ($(CONFIG_TUNE_CELL),y) + CFLAGS += $(call cc-option,-mtune=cell) +endif + # No AltiVec instruction when building kernel CFLAGS += $(call cc-option,-mno-altivec)
arch/powerpc/platforms/Kconfig.cputype +12 -0
@@ -71,6 +71,18 @@ config POWER4 depends on PPC64 def_bool y +config TUNE_CELL + bool "Optimize for Cell Broadband Engine" + depends on PPC64 + help + Cause the compiler to optimize for the PPE of the Cell Broadband + Engine. This will make the code run considerably faster on Cell + but somewhat slower on other machines. This option only changes + the scheduling of instructions, not the selection of instructions + itself, so the resulting kernel will keep running on all other + machines. When building a kernel that is supposed to run only + on Cell, you should also select the POWER4_ONLY option. + config 6xx bool
Quoted 4 lines · Arnd Bergmann
Since the PPE on cell is an in-order core, it suffers significantly from wrong instruction scheduling. This adds an
Kconfigoption that enables passing -mtune=cell to gcc in order to generate object code that runs well on cell.
Which version of gcc supports that?
josh
Quoted 8 lines · Josh Boyer
Quoted 4 lines · Arnd Bergmann
Since the PPE on cell is an in-order core, it suffers significantly from wrong instruction scheduling. This adds an
Kconfigoption that enables passing -mtune=cell to gcc in order to generate object code that runs well on cell.Which version of gcc supports that?
gcc-4.3 will be the first official release that has everything in it, and I think 4.1 has some parts. However, there are many patched gcc versions in various distributions, so I tried to avoid being too specific about the version here.
Of course, on gcc versions that don't support -mtune=cell, the Kconfig option does not make a difference.
Arnd <><
Quoted 10 lines · Arnd Bergmann
Quoted 8 lines · Josh Boyer
Quoted 4 lines · Arnd Bergmann
Since the PPE on cell is an in-order core, it suffers significantly from wrong instruction scheduling. This adds an
Kconfigoption that enables passing -mtune=cell to gcc in order to generate object code that runs well on cell.Which version of gcc supports that?
Quoted 7 lines
gcc-4.3 will be the first official release that has everything in it, and I think 4.1 has some parts. However, there are many patched gcc versions in various distributions, so I tried to avoid being too specific about the version here.
Of course, on gcc versions that don't support -mtune=cell, the
Kconfigoption does not make a difference.
Sure. I was just wondering if mentioning the first official GCC version in the Kconfig description would help prevent users from selecting the option for GCCs that don't support it and then being confused later when nothing happens. Your call though.
josh
arch/powerpc/platforms/Kconfig.cputype config POWER4
Quoted 9 lines
arch/powerpc/platforms/Kconfig.cputype +9
-0+config TUNE_CELL + bool "Optimize for Cell Broadband Engine" + depends on PPC64 + help + Cause the compiler to optimize for the PPE of the Cell Broadband + Engine. This will make the code run considerably faster on Cell + but somewhat slower on other machines. This option only changes + the scheduling of instructions, not the selection of instructions + itself,
It _does_ change instruction selection, which is the main factor in the slowdown on other machines (and a big part of the speedup on Cell, too). It doesn't change which insns the compiler is allowed to use though, which is probably what you wanted to say?
Segher
Quoted 6 lines · Segher Boessenkool
=20
Quoted 5 lines
+config
TUNE_CELL+=A0=A0=A0=A0=A0bool "Optimize for Cell Broadband Engine" +=A0=A0=A0=A0=A0depends on PPC64 +=A0=A0=A0=A0=A0help +=A0=A0=A0=A0=A0 =A0Cause the compiler to optimize for the PPE of the C=
ell Broadband
Quoted 1 line
Quoted 1 line
+=A0=A0=A0=A0=A0 =A0Engine. This will make the code run considerably fa=
ster on Cell
Quoted 1 line
Quoted 1 line
+=A0=A0=A0=A0=A0 =A0but somewhat slower on other machines. This option =
only changes
Quoted 1 line
Quoted 1 line
+=A0=A0=A0=A0=A0 =A0the scheduling of instructions, not the selection o=
f instructions
Quoted 6 lines
Quoted 1 line
+=A0=A0=A0=A0=A0 =A0itself,
=20
It _does_ change instruction selection, which is the main factor in the slowdown on other machines (and a big part of the speedup on Cell, too). =A0It doesn't change which insns the compiler is allowed to use though, which is probably what you wanted to say?
Right, thanks for the correction.
Arnd <><
Quoted 4 lines · Arnd Bergmann
Since the PPE on cell is an in-order core, it suffers significantly from wrong instruction scheduling. This adds an
Kconfigoption that enables passing -mtune=cell to gcc in order to generate object code that runs well on cell.
Do we have an option which is useful for a multiplatform kernel (and for userspace) and which lies between the two extremes? Something which will improve performance on Cell (and POWER6?) without sucking too hard elsewhere?
Signature · 1 line
dwmw2
Quoted 10 lines · David Woodhouse
Quoted 4 lines · Arnd Bergmann
Since the PPE on cell is an in-order core, it suffers significantly from wrong instruction scheduling. This adds an
Kconfigoption that enables passing -mtune=cell to gcc in order to generate object code that runs well on cell.Do we have an option which is useful for a multiplatform kernel (and for userspace) and which lies between the two extremes? Something which will improve performance on Cell (and POWER6?) without sucking too hard elsewhere?
No, not really. The impact of -mtune=cell should not be too bad on other out-of-order CPUs, but we don't have any good measurements to back that up, and it may also be really bad for POWER6 and other in-order cores.
Arnd <><