Add ccache support
cover Add ccache support
These two patches make it easy to use ccache with U-Boot to speed up iterative builds.
The results of building SoC MXS without ccache:
real 1m29.286s user 7m1.972s sys 0m46.668s
The results of building SoC MXS with ccache for the first time:
real 1m37.551s user 7m23.632s sys 0m59.332s
The results of building SoC MXS with ccache again:
real 0m41.968s user 1m9.912s sys 0m20.028s
The speedup is significant.
Marek Vasut (2):
common: Add CCACHE variable to allow use of ccache
common: Use separate dirs for each board for ccache
MAKEALL | 7 +++++++ config.mk | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
--- config.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
config.mk +5 -3
@@ -98,6 +98,8 @@ else HOSTCC = gcc endif +HOSTCC := $(CCACHE) $(HOSTCC) + ifeq ($(HOSTOS),cygwin) HOSTCFLAGS += -ansi endif
@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) # -AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gcc CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm
@@ -320,7 +322,7 @@ endif ######################################################################### -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE \ +export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE CCACHE \ AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
Signature · 1 line
1.7.10.4
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Dear Marek Vasut,
Quoted 5 lines · In message <[email protected]> you wrote:
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
...
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) · line 152
Quoted 10 lines
config.mk +2
-2-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gcc CPP = $(CC) -E
Why not for CPP ?
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The use of Microsoft crippleware systems is a sin that carries with
it its own punishment.
-- Tom Christiansen in <[email protected]>PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Dear Wolfgang Denk,
Quoted 11 lines
Dear Marek Vasut,
Quoted 5 lines · In message <[email protected]> you wrote:
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
...
Quoted 7 lines
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
Quoted 7 lines
config.mk +1
-1-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo
"$(CROSS_COMPILE)ld";
Quoted 8 lines
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) · line 152
Quoted 6 lines
config.mk +1
-1fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gcc CPP = $(CC) -EWhy not for CPP ?
CPP is invoked via $(CC) -E and CCACHE is set for CC right above, so that'd call ccache twice.
Best regards,
Marek Vasut
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
In reply to Marek VasutQuoted 48 lines · Marek Vasut
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>---
config.mk | 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)config.mk +4
-2@@ -98,6 +98,8 @@ else HOSTCC = gcc endif +HOSTCC := $(CCACHE) $(HOSTCC) + ifeq ($(HOSTOS),cygwin) HOSTCFLAGS += -ansi endif@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) # -AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gcc CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm
config.mk endif · line 328
Quoted 8 lines
config.mk +1
-1@@ -320,7 +322,7 @@ endif ######################################################################### -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE \ +export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE CCACHE \ AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
Where did this patch go? I found it useful.
York
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Dear York Sun,
Quoted 42 lines · Marek Vasut
Quoted 41 lines
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>---
config.mk | 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)config.mk +2
-0@@ -98,6 +98,8 @@ else HOSTCC = gcc endif +HOSTCC := $(CCACHE) $(HOSTCC) + ifeq ($(HOSTOS),cygwin)HOSTCFLAGS += -ansi
endifconfig.mk +0
-0@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) #
Quoted 7 lines
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
Quoted 7 lines
config.mk +1
-1-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo
"$(CROSS_COMPILE)ld";
Quoted 9 lines
Quoted 9 lines
config.mk +1
-1fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gcc CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm
Quoted 6 lines
config.mk endif · line 324
Quoted 6 lines
config.mk +0
-1@@ -320,7 +322,7 @@ endif ######################################################################## # -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE
\
Quoted 6 lines
Quoted 6 lines
config.mk +1
-0+export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE CCACHE \AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
export
CONFIG_SYS_TEXT_BASEPLATFORM_CPPFLAGSPLATFORM_RELFLAGS
CPPFLAGS
Quoted 3 lines
Quoted 1 line
CFLAGS AFLAGS
Where did this patch go? I found it useful.
It needs additional fixes, try running with MAKEALL and you will see the problem -- the problem is you would need separate ccache for each MAKEALL thread.
Best regards,
Marek Vasut
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Quoted 73 lines · Marek Vasut
Dear York Sun,
Quoted 42 lines · Marek Vasut
Quoted 41 lines
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>---
config.mk | 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)config.mk +0
-0@@ -98,6 +98,8 @@ elseHOSTCC = gcc
endifconfig.mk +2
-0+HOSTCC := $(CCACHE) $(HOSTCC) +ifeq ($(HOSTOS),cygwin)
HOSTCFLAGS += -ansi
endifconfig.mk +0
-0@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) #Quoted 7 lines
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
Quoted 7 lines
config.mk +1
-1-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo"$(CROSS_COMPILE)ld";
Quoted 9 lines
Quoted 9 lines
config.mk +1
-1fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gccCPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nmQuoted 6 lines
config.mk endif · line 324
Quoted 6 lines
config.mk +0
-1@@ -320,7 +322,7 @@ endif ######################################################################## # -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE\
Quoted 5 lines
Quoted 5 lines
config.mk +1
-0+export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE CCACHE \AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
Quoted 8 lines
Quoted 1 line
Quoted 1 line
export
CONFIG_SYS_TEXT_BASEPLATFORM_CPPFLAGSPLATFORM_RELFLAGSCPPFLAGS
Quoted 3 lines
Quoted 1 line
CFLAGS AFLAGS
Where did this patch go? I found it useful.
It needs additional fixes, try running with MAKEALL and you will see the problem -- the problem is you would need separate ccache for each MAKEALL thread.
I didn't use this patch but I modified config.mk as this patch did. MAKEALL works fine for "-a powerpc". It cuts my compiling time more than half for 660+ boards.
York
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Dear sun york-R58495,
Quoted 86 lines · Marek Vasut
Quoted 85 lines
Dear York Sun,
Quoted 42 lines · Marek Vasut
Quoted 41 lines
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>---
config.mk | 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)config.mk +0
-0@@ -98,6 +98,8 @@ elseHOSTCC = gcc
endifconfig.mk +2
-0+HOSTCC := $(CCACHE) $(HOSTCC) +ifeq ($(HOSTOS),cygwin)
HOSTCFLAGS += -ansi
endifconfig.mk +0
-0@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) #Quoted 7 lines
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
Quoted 7 lines
config.mk +1
-1-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo"$(CROSS_COMPILE)ld";
Quoted 9 lines
Quoted 9 lines
config.mk +1
-1fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gccCPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nmQuoted 6 lines
config.mk endif · line 324
Quoted 6 lines
config.mk +0
-1@@ -320,7 +322,7 @@ endif ####################################################################### # # -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE\
Quoted 6 lines
Quoted 6 lines
config.mk +1
-0+export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE CCACHE \AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
export
CONFIG_SYS_TEXT_BASEPLATFORM_CPPFLAGSPLATFORM_RELFLAGSCPPFLAGS
Quoted 3 lines
Quoted 1 line
CFLAGS AFLAGS
Where did this patch go? I found it useful.
Quoted 7 lines
Quoted 3 lines
It needs additional fixes, try running with MAKEALL and you will see the problem -- the problem is you would need separate ccache for each MAKEALL thread.
I didn't use this patch but I modified config.mk as this patch did. MAKEALL works fine for "-a powerpc". It cuts my compiling time more than half for 660+ boards.
That is still poor, it should be much faster. If you use separate ccache for each board, then it will be _much_ more performant.
The problem is that when rebuilding all of those 680 configurations, the cached files get replaced by ones based on different board config all the time => you need to rebuild them => you loose performance.
Best regards,
Marek Vasut
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Quoted 96 lines · Marek Vasut
Dear sun york-R58495,
Quoted 86 lines · Marek Vasut
Quoted 85 lines
Dear York Sun,
Quoted 42 lines · Marek Vasut
Quoted 41 lines
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>---
config.mk | 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)config.mk +0
-0@@ -98,6 +98,8 @@ elseHOSTCC = gcc
endifconfig.mk +2
-0+HOSTCC := $(CCACHE) $(HOSTCC) +ifeq ($(HOSTOS),cygwin)
HOSTCFLAGS += -ansi
endifconfig.mk +0
-0@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) #Quoted 7 lines
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
Quoted 7 lines
config.mk +1
-1-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo"$(CROSS_COMPILE)ld";
Quoted 9 lines
Quoted 9 lines
config.mk +1
-1fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gccCPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nmQuoted 6 lines
config.mk endif · line 324
Quoted 6 lines
config.mk +0
-1@@ -320,7 +322,7 @@ endif ####################################################################### # # -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE\
Quoted 6 lines
Quoted 6 lines
config.mk +1
-0+export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE CCACHE \AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
export
CONFIG_SYS_TEXT_BASEPLATFORM_CPPFLAGSPLATFORM_RELFLAGSCPPFLAGS
Quoted 3 lines
Quoted 1 line
CFLAGS AFLAGS
Where did this patch go? I found it useful.
Quoted 7 lines
Quoted 3 lines
It needs additional fixes, try running with MAKEALL and you will see the problem -- the problem is you would need separate ccache for each MAKEALL thread.
I didn't use this patch but I modified config.mk as this patch did. MAKEALL works fine for "-a powerpc". It cuts my compiling time more than half for 660+ boards.
Quoted 7 lines
That is still poor, it should be much faster. If you use separate ccache for each board, then it will be _much_ more performant.
The problem is that when rebuilding all of those 680 configurations, the cached files get replaced by ones based on different board config all the time => you need to rebuild them => you loose performance.
I kind of get it. I have to increase my ccache size a lot (more than 2GB) to get consistent cache hit. I thought that was because I was using out-of-tree build when setting BUILD_NBUILDS. For the first time I run MAKEALL with ccache, it was completely miss. I mean zero hit. It would be nice to be able hit the cache. I was read the ccache document to understand how the path is involved when calculating the hash. How do you plan to make it work?
York
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Quoted 102 lines · On Aug 21, 2013, at 10:45 PM, sun york-R58495 wrote:
Quoted 99 lines · Marek Vasut
Dear sun york-R58495,
Quoted 86 lines · Marek Vasut
Quoted 85 lines
Dear York Sun,
Quoted 42 lines · Marek Vasut
Quoted 41 lines
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>---
config.mk | 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)config.mk +0
-0@@ -98,6 +98,8 @@ elseHOSTCC = gcc
endifconfig.mk +2
-0+HOSTCC := $(CCACHE) $(HOSTCC) +ifeq ($(HOSTOS),cygwin)
HOSTCFLAGS += -ansi
endifconfig.mk +0
-0@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) #Quoted 7 lines
config.mk binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
Quoted 7 lines
config.mk +1
-1-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo"$(CROSS_COMPILE)ld";
Quoted 9 lines
Quoted 9 lines
config.mk +1
-1fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gccCPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nmQuoted 6 lines
config.mk endif · line 324
Quoted 6 lines
config.mk +0
-1@@ -320,7 +322,7 @@ endif ####################################################################### # # -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE\
Quoted 6 lines
Quoted 6 lines
config.mk +1
-0+export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE CCACHE \AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
export
CONFIG_SYS_TEXT_BASEPLATFORM_CPPFLAGSPLATFORM_RELFLAGSCPPFLAGS
Quoted 3 lines
Quoted 1 line
CFLAGS AFLAGS
Where did this patch go? I found it useful.
Quoted 7 lines
Quoted 3 lines
It needs additional fixes, try running with MAKEALL and you will see the problem -- the problem is you would need separate ccache for each MAKEALL thread.
I didn't use this patch but I modified config.mk as this patch did. MAKEALL works fine for "-a powerpc". It cuts my compiling time more than half for 660+ boards.
That is still poor, it should be much faster. If you use separate ccache for each board, then it will be _much_ more performant.
Quoted 7 lines
Quoted 4 lines
The problem is that when rebuilding all of those 680 configurations, the cached files get replaced by ones based on different board config all the time => you need to rebuild them => you loose performance.
I kind of get it. I have to increase my ccache size a lot (more than 2GB) to get consistent cache hit. I thought that was because I was using out-of-tree build when setting
BUILD_NBUILDS. For the first time I run MAKEALL with ccache, it was completely miss. I mean zero hit. It would be nice to be able hit the cache. I was read the ccache document to understand how the path is involved when calculating the hash. How do you plan to make it work?
I forgot to mention, if the ccache size is at default (1GB), I don't see any performance improvement by using ccache. I think that's what you meant the cached files get replaced. I don't understand what you mean to use separated ccache for each board. Would it be equivalent to have a big cache? I was compiling with and without BUILD_NBUILDS, and my cache size is more than 3GB now. I could see the improvement by 2x~3x faster, but not more.
York
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Dear sun york-R58495,
Quoted 115 lines · On Aug 21, 2013, at 10:45 PM, sun york-R58495 wrote:
Quoted 106 lines · Marek Vasut
Quoted 98 lines
Dear sun york-R58495,
Quoted 88 lines · Marek Vasut
Quoted 87 lines
Dear York Sun,
Quoted 43 lines · Marek Vasut
Quoted 42 lines
Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache. In case the user wants to use ccache, exporting CCACHE=ccache will do the trick. It is of course possible to either make the cross-compiler name into a shellscript which invokes the ccache and the compiler, but setting this variable makes use of ccache easier and more convenient.
Using ccache becomes convenient when using MAKEALL for large build tests, where the speedup after building the cache for the first time is about 4-6 times.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>---
config.mk | 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)config.mk +0
-0@@ -98,6 +98,8 @@ elseHOSTCC = gcc
endifconfig.mk +2
-0+HOSTCC := $(CCACHE) $(HOSTCC) +ifeq ($(HOSTOS),cygwin)
HOSTCFLAGS += -ansi
endifconfig.mk +0
-0@@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) #Quoted 7 lines
config.mk binutils-version = $(shell $(SHELL) · line 153
Quoted 7 lines
config.mk +1
-1-AS = $(CROSS_COMPILE)as +AS = $(CCACHE) $(CROSS_COMPILE)as # Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo"$(CROSS_COMPILE)ld";
Quoted 9 lines
Quoted 9 lines
config.mk +1
-1fi;) -CC = $(CROSS_COMPILE)gcc +CC = $(CCACHE) $(CROSS_COMPILE)gccCPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nmQuoted 7 lines
Quoted 7 lines
config.mk +0
-1@@ -320,7 +322,7 @@ endif #################################################################### ### # # -export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP
CROSS_COMPILE\
Quoted 6 lines
Quoted 6 lines
+export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP
CROSS_COMPILECCACHE \AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
export
CONFIG_SYS_TEXT_BASEPLATFORM_CPPFLAGSPLATFORM_RELFLAGSCPPFLAGS
Quoted 3 lines
Quoted 1 line
CFLAGS AFLAGS
Where did this patch go? I found it useful.
Quoted 7 lines
Quoted 3 lines
It needs additional fixes, try running with MAKEALL and you will see the problem -- the problem is you would need separate ccache for each MAKEALL thread.
I didn't use this patch but I modified config.mk as this patch did. MAKEALL works fine for "-a powerpc". It cuts my compiling time more than half for 660+ boards.
Quoted 6 lines
That is still poor, it should be much faster. If you use separate ccache for each board, then it will be _much_ more performant.
The problem is that when rebuilding all of those 680 configurations, the cached files get replaced by ones based on different board config all the time => you need to rebuild them => you loose performance.
Quoted 7 lines
I kind of get it. I have to increase my ccache size a lot (more than 2GB) to get consistent cache hit. I thought that was because I was using out-of-tree build when setting
BUILD_NBUILDS. For the first time I run MAKEALL with ccache, it was completely miss. I mean zero hit. It would be nice to be able hit the cache. I was read the ccache document to understand how the path is involved when calculating the hash. How do you plan to make it work?
Quoted 7 lines
I forgot to mention, if the ccache size is at default (1GB), I don't see any performance improvement by using ccache. I think that's what you meant the cached files get replaced. I don't understand what you mean to use separated ccache for each board. Would it be equivalent to have a big cache? I was compiling with and without
BUILD_NBUILDS, and my cache size is more than 3GB now. I could see the improvement by 2x~3x faster, but not more.
There is an env variable to configure separate ccache cache dir , so just by setting that. But then , when each build ends, you would need to clean it up somehow. It was mentioned in the discussion with the patch. You can try working on this some more and post a patch, then we can talk about further forging of this.
Best regards,
Marek Vasut
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Quoted 7 lines · Marek Vasut
There is an env variable to configure separate ccache cache dir , so just by setting that. But then , when each build ends, you would need to clean it up somehow. It was mentioned in the discussion with the patch. You can try working on this some more and post a patch, then we can talk about further forging of this.
I fixed the 2nd patch and I am running MAKEALL with individual board folder for ccache. The compiling time for the first run on my laptop is 56 minutes. The 2nd run is 23 minutes. About the same improvement if using a big unified cache for all boards. By the way, each board cache is about 7~8MB.
You set my expectation high. I was hoping to get 10x or more improvement.
York
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Dear York Sun,
Quoted 7 lines · Marek Vasut
Quoted 5 lines
There is an env variable to configure separate ccache cache dir , so just by setting that. But then , when each build ends, you would need to clean it up somehow. It was mentioned in the discussion with the patch. You can try working on this some more and post a patch, then we can talk about further forging of this.
Quoted 7 lines
I fixed the 2nd patch and I am running MAKEALL with individual board folder for ccache. The compiling time for the first run on my laptop is 56 minutes. The 2nd run is 23 minutes. About the same improvement if using a big unified cache for all boards. By the way, each board cache is about 7~8MB.
You set my expectation high. I was hoping to get 10x or more improvement.
It should be more, try checking if there is no bottleneck.
Best regards,
Marek Vasut
PATCH 1/2 common: Add CCACHE variable to allow use of ccache
Quoted 15 lines · Marek Vasut
Dear York Sun,
Quoted 13 lines · Marek Vasut
Quoted 5 lines
There is an env variable to configure separate ccache cache dir , so just by setting that. But then , when each build ends, you would need to clean it up somehow. It was mentioned in the discussion with the patch. You can try working on this some more and post a patch, then we can talk about further forging of this.
I fixed the 2nd patch and I am running MAKEALL with individual board folder for ccache. The compiling time for the first run on my laptop is 56 minutes. The 2nd run is 23 minutes. About the same improvement if using a big unified cache for all boards. By the way, each board cache is about 7~8MB.
Quoted 4 lines
Quoted 1 line
You set my expectation high. I was hoping to get 10x or more improvement.
It should be more, try checking if there is no bottleneck.
I can send you the patch. Will you be able to test?
York
PATCH 2/2 common: Use separate dirs for each board for ccache
In reply to Marek VasutWhen using ccache in MAKEALL, use separate directory for the cache for each board. This way we can avoid rewriting the same files by building other boards.
--- MAKEALL | 7 +++++++ 1 file changed, 7 insertions(+)
MAKEALL +7 -0
@@ -673,6 +673,13 @@ build_target() { MAKE=make fi + # Use per-board CCACHE directory + if [ "x${CCACHE}" != "x" ] ; then + export CCACHE_DIR="`${CCACHE} -s | grep "^cache directory" | \ + tr -s " " | cut -d " " -f 3`/u-boot/${target}" ; + mkdir -p "${CCACHE_DIR}" + fi + ${MAKE} distclean >/dev/null ${MAKE} -s ${target}_config
Signature · 1 line
1.7.10.4
PATCH 2/2 common: Use separate dirs for each board for ccache
Dear Marek Vasut,
Quoted 6 lines
When using ccache in MAKEALL, use separate directory for the cache for each board. This way we can avoid rewriting the same files by building other boards.
Signed-off-by Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>
This one will need more work, sorry.
Best regards,
Marek Vasut
PATCH 2/2 common: Use separate dirs for each board for ccache
In reply to Marek VasutDear Marek Vasut,
MAKEALL build_target() { · line 677
Quoted 2 lines · In message <[email protected]> you wrote:
MAKEALL +2
-0+ # Use per-board CCACHE directory + if [ "x${CCACHE}" != "x" ] ; then
Why not simply:
if [ "${CCACHE}" ] ; then?
MAKEALL build_target() { · line 681
Quoted 4 lines
MAKEALL +4
-0+ export CCACHE_DIR="`${CCACHE} -s | grep "^cache directory" | \ + tr -s " " | cut -d " " -f 3`/u-boot/${target}" ; + mkdir -p "${CCACHE_DIR}" + fi
How can I cleanup all the mess of created files and directories after a build?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Do not simplify the design of a program if a way can be found to make it complex and wonderful.
PATCH 2/2 common: Use separate dirs for each board for ccache
Dear Wolfgang Denk,
Quoted 12 lines
Dear Marek Vasut,
MAKEALL build_target() { · line 677
Quoted 2 lines · In message <[email protected]> you wrote:
MAKEALL +2
-0+ # Use per-board CCACHE directory + if [ "x${CCACHE}" != "x" ] ; thenWhy not simply:
if [ "${CCACHE}" ] ; then?
Quoted 7 lines
MAKEALL build_target() { · line 681
Quoted 4 lines
MAKEALL +4
-0+ export CCACHE_DIR="`${CCACHE} -s | grep "^cache directory" | \ + tr -s " " | cut -d " " -f 3`/u-boot/${target}" ; + mkdir -p "${CCACHE_DIR}" + fiHow can I cleanup all the mess of created files and directories after a build?
Ignoring this patch, it's FUBAR, sorry.
Best regards,
Marek Vasut