Re: SDK migration 0.9.5 -> 0.10.0 increase CPU usage

Nashif, Anas
 

Nicolas,

Can you please open an issue on GH with all this data?

Can you also provide some info about how you measure the numbers below?

 

Thanks,

Anas

 

From: devel@... [mailto:devel@...] On Behalf Of nicolas lantz
Sent: Friday, March 29, 2019 10:24 AM
To: Nashif, Anas <anas.nashif@...>; devel@...
Cc: Zięcik, Piotr <piotr.ziecik@...>
Subject: Re: [Zephyr-devel] SDK migration 0.9.5 -> 0.10.0 increase CPU usage

 

Hi,

I confirm that (in my test case) New SDK 0.10.0 toolchain seems to significantly increase CPU usage, the new SDK 0.10.0 Newlib a lot.
The details of my investigation below...


------------------------------------------------------------------
Test case
------------------------------------------------------------------
I do CPU average usage test on an audio compression task using the opus codec.

------------------------------------------------------------------
Measures
------------------------------------------------------------------
With CONFIG_SPEED_OPTIMIZATIONS=y

SDK 0.9.5
- Newlibc => 51% CPU usage
- minimal lib => 58% CPU usage

SDK 0.10.0
- Newlibc => 75% CPU usage
- minimal lib => 60% CPU usage

------------------
This gives
------------------
CPU usage between SDK 0.9.5 and SDK 0.10.0 with Newlibc : +47%
CPU usage between SDK 0.9.5 and SDK 0.10.0 with minimal lib : +3%

------------------------------------------------------------------
Investigations
------------------------------------------------------------------
SDK 0.9.5 is built on newllib 2.4.0
SDK 0.10.0 is built  on newlib 3.1.0,

But it seem that there is no difference on string function source code (memmove, memcpy, memset),

------------------------------------------------------------------
Assumption (in my test case)
------------------------------------------------------------------
SDK 0.10.0 toolchain reduce the CPU performance vs the SDK 0.9.5 of about 3%
Newlibc is compiled differently between the SDK 0.9.5 and the SDK 0.10.0 as it increase the CPU usage of about 47-3 = 44%
On SDK 0.9.5 Newlib  is more efficient that minial lib of about 58-51 = 7%

------------------------------------------------------------------
Trial :
------------------------------------------------------------------
I replace the source code of the three more used function (memmove, memcpy, memset) in minimal lib with the one from Newlib source.
I build my projet with the SDK 0.10.0

------------------
Measures
------------------
CPU usage :  53%
=> gain from minimal libc current source code of   -13%
=> gain from Newlib : - 41%
=> I find the performance I had with NewLib and SDK 0.9.5 with additional CPU usage of about 4%


------------------------------------------------------------------
Suggestions for improvement
------------------------------------------------------------------
- compile newlib differently in SDK
- use improved code for the minimal lib




Nicolas

 
Nicolas LANTZ
M : +33 (0)6 19 07 43 43
T : +33 (0)9 52 96 81 86
www.ubicore.net

Le 27/03/2019 à 17:19, nicolas lantz a écrit :

Anas,

The processor is an nrf52840, and the opus codec is imported from the "nRFready Smart Remote 3 for nRF52 Series" project.

The project is build with the NEWLIB_LIBC and i have also imported some C Flags in the CMakeLists.txt  to disable Floating point use and enable some DSP extensions available on Nordic chip .

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
 -DARM_MATH_CM4 \
 -DDISABLE_FLOAT_API \
 -DFIXED_POINT \
 -DHAVE_ALLOCA_H \
 -DUSE_ALLOCA \
 -DHAVE_LRINT \
 -DHAVE_LRINTF \
 -DOPUS_ARM_ASM \
 -DOPUS_ARM_INLINE_ASM \
 -DOPUS_ARM_INLINE_EDSP \
 -DOPUS_ARM_INLINE_MEDIA \
 -DOPUS_ARM_MAY_HAVE_EDSP \
 -DOPUS_ARM_PRESUME_EDSP \
 -DVAR_ARRAYS \
 -DOPUS_BUILD \
 -DHAVE_CONFIG_H \
 -g \
")

I guess the new toolchain does not treat these optimizations the same way...


My first demo with opus :
https://gitlab.com/ubicore/zephyr/commit/177a410c6902ecacb9552c907f1e4f60e7a23b1a


Nicolas
 
Nicolas LANTZ
M : +33 (0)6 19 07 43 43
T : +33 (0)9 52 96 81 86
www.ubicore.net

Le 27/03/2019 à 15:21, Nashif, Anas a écrit :

Nicolas,

Which architecture? I did not see any issues.

 

Anas

 

From: devel@... [mailto:devel@...] On Behalf Of nicolas lantz
Sent: Wednesday, March 27, 2019 9:37 AM
To: devel@...
Subject: [Zephyr-devel] SDK migration 0.9.5 -> 0.10.0 increase CPU usage

 

Hi all,

I just migrate from SDK 0.9.5 to SDK 0.10.0 on my projet and i have between 40% to 90% of additional CPU usage with the new toolchain on the audio compression and decompression tasks (using opus codec).

This over cpu consumption append both with build optimisation configured in debug and speed mode.

Does anyone have some any info or explanation ?

Thanks


-- 
Nicolas
 
Nicolas LANTZ
M : +33 (0)6 19 07 43 43
T : +33 (0)9 52 96 81 86
www.ubicore.net

 

 

Join devel@lists.zephyrproject.org to automatically receive all group messages.