Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#12113 - Use more IRAM for asap/spc/nsf

Attached to Project: Rockbox
Opened by Andree Buschmann (Buschel) - Saturday, 14 May 2011, 00:10 GMT+2
Last edited by Andree Buschmann (Buschel) - Sunday, 15 May 2011, 18:09 GMT+2
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Release 3.8.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

During measurements of the memory layout of the aac-decoder I recognized that several of our codecs do merely use IRAM (see http://www.rockbox.org/wiki/CodecMemoryUsage) -- at least on iPod Video.

The attached patch moves several arrays to to IRAM. It would be great if somebody with some test file for those format could make a performance test. Maybe it is also possible to attach small samples to this flyspray entry.
   spc_asap_nsf_v01.patch (13.9 KiB)
 apps/codecs/asap.c                  |    8 ++--
 apps/codecs/nsf.c                   |    4 +-
 apps/codecs/libasap/asap.c          |   66 +++++++++++++++++++-----------------
 apps/codecs/libasap/asap_internal.h |    2 -
 apps/codecs/libasap/acpu.c          |    4 +-
 apps/codecs/libasap/asap.h          |    4 +-
 apps/codecs/libspc/spc_codec.h      |    6 +--
 apps/codecs/libspc/spc_dsp.c        |    2 -
 8 files changed, 52 insertions(+), 44 deletions(-)

This task depends upon

Closed by  Andree Buschmann (Buschel)
Sunday, 15 May 2011, 18:09 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Submitted with r29883, r29886 and r29887.
Comment by Andree Buschmann (Buschel) - Saturday, 14 May 2011, 12:32 GMT+2
Some measures for patch v04 on an iPod Video:
nsf: nearly twice as fast now, nevertheless still faaar away from realtime (~11 times on the iPod Video)
sap: ~10% faster
spc: ~5% faster

   spc_asap_nsf_v04.patch (18.6 KiB)
 apps/codecs/asap.c                  |    8 ++--
 apps/codecs/nsf.c                   |   40 +++++++++++----------
 apps/codecs/libasap/anylang.h       |    4 +-
 apps/codecs/libasap/asap.c          |   66 +++++++++++++++++++-----------------
 apps/codecs/libasap/asap_internal.h |    2 -
 apps/codecs/libasap/acpu.c          |    4 +-
 apps/codecs/libasap/asap.h          |    4 +-
 apps/codecs/libspc/spc_codec.h      |    6 +--
 apps/codecs/libspc/spc_dsp.c        |    2 -
 9 files changed, 73 insertions(+), 63 deletions(-)

Comment by MichaelGiacomelli (saratoga) - Saturday, 14 May 2011, 19:17 GMT+2
On my e200v1 I get 44.45MHz (svn) and 42.51MHz (patch).
Comment by Andree Buschmann (Buschel) - Saturday, 14 May 2011, 20:24 GMT+2
New version which does some CPU-specific configuration. This compiles for iPod 3G (PP5002), iPod Video (PP5022) and iPod nano 2G (S5L870x). The patch will need compilation and performance testing on other CPUs -- especially Coldfire MCF5249 and MCF5250.

Performance on an iPod Video (svn / v07) with my samples
Tetris.nsf: 1713 MHz / 881 MHz => +94%
Ghostbusters.sap: 6.78 MHz / 5.91 MHz => +15%
Dragon1.spc: 48.16 MHz / 45.55 MHz => +6%

Performance gains on iPod nano 2G look similar:
Tetris.nsf: 1448 MHz / 829 MHz => +75%
Ghostbusters.sap: 8.86 MHz / 7.63 MHz => +16%
Dragon1.spc: 38.30 MHz / 36.61 MHz => +5%
   spc_asap_nsf_v07.patch (24.6 KiB)
 apps/codecs/asap.c                  |    8 ++--
 apps/codecs/nsf.c                   |   64 +++++++++++++++++++++-------------
 apps/codecs/libasap/asap.c          |   66 +++++++++++++++++++-----------------
 apps/codecs/libasap/asap_internal.h |    2 -
 apps/codecs/libasap/acpu.c          |    4 +-
 apps/codecs/libasap/asap.h          |    4 +-
 apps/codecs/libspc/spc_codec.h      |   52 +++++++++++++++++-----------
 apps/codecs/libspc/spc_dsp.c        |   11 ++----
 apps/codecs/libspc/spc_emu.c        |    2 -
 apps/codecs/libspc/spc_cpu.c        |    2 -
 10 files changed, 123 insertions(+), 92 deletions(-)

Comment by Andree Buschmann (Buschel) - Saturday, 14 May 2011, 21:01 GMT+2
Test files attached.
Comment by Michael Sevakis (MikeS) - Saturday, 14 May 2011, 22:52 GMT+2
My results
========

SVN r29864 / w/ FS#12113 

H100 (MCF5249):
Dragon01.spc: 77.06MHz / 77.09MHz (-0.04%)
Ghostbusters.sap: 19.28MHz / 8.94MHz (+115.65%)
Tetris-Tengen.nsf: 1536.95MHz:259.87s /1542.52MHz:261.25s (-0.53%)

X5 (MCF5250):
Dragon01.spc: 77.33MHz / 86.62MHz (-12.01%)
Ghostbusters.sap: 19.36MHz / 8.99MHz (+115.35%)
Tetris-Tengen.nsf: 1546.52MHz:261.25s / 2406.69MHz:406.82s (-55.72%)

Yes, it was boosted. I even ran the x5 ones twice and double-checked everything. :\
Comment by Michael Sevakis (MikeS) - Saturday, 14 May 2011, 23:28 GMT+2
New Results
==========

SVN / Pastbin patch:
X5 (MCF5250):
Dragon01.spc: 77.33MHz / 77.35MHz (-0.03%)
Ghostbusters.sap: 19.36MHz / 9.00MHz (+115.11%)
Tetris-Tengen.nsf: 1546.52MHz:261.25s / 1498.01MHz:253.07s (+3.23%)
(the one in the previous post should have been -35.78%)
Comment by Andree Buschmann (Buschel) - Saturday, 14 May 2011, 23:44 GMT+2
The above test was based on this 7b-version.
   spc_asap_nsf_v07b.patch (24.9 KiB)
 apps/codecs/asap.c                  |    8 ++--
 apps/codecs/nsf.c                   |   65 +++++++++++++++++++++--------------
 apps/codecs/libasap/asap.c          |   66 +++++++++++++++++++-----------------
 apps/codecs/libasap/asap_internal.h |    2 -
 apps/codecs/libasap/acpu.c          |    4 +-
 apps/codecs/libasap/asap.h          |    4 +-
 apps/codecs/libspc/spc_codec.h      |   54 ++++++++++++++++++-----------
 apps/codecs/libspc/spc_dsp.c        |   11 ++----
 apps/codecs/libspc/spc_emu.c        |    2 -
 apps/codecs/libspc/spc_cpu.c        |    2 -
 10 files changed, 125 insertions(+), 93 deletions(-)

Comment by Jens Arnold (amiconn) - Sunday, 15 May 2011, 10:37 GMT+2
Here are a few results from the PP front, SVN r29879/ Patch 7b

iPod 2nd Gen (PP5002):
Dragon 01.spc: 48.89 MHz, 113.07 s / 48.89 MHz, 113.08 s (± 0)
Ghostbusters.sap: 11.46 MHz, 30.07 s / 10.11 MHz, 26.52 s (+13.4 %)
Tetris-Tengen.nsf: 2749.14 MHz, 720.07 s / 1026.95 MHz, 269.37 s (+167.7 %)

iPod Color (PP5020):
Dragon 01.spc: 48.23 MHz, 111.55 s / 52.92 MHz, 122.38 s (-8.8 %) <==
Ghostbusters.sap: 6.89 MHz, 18.09 s / 6.54 MHz, 17.16 s (+5.4 %)
Tetris-Tengen.nsf: 1731.60 MHz, 454.05 s / 1125.17 MHz, 295.01 s (+53.9 %)
Comment by Andree Buschmann (Buschel) - Sunday, 15 May 2011, 13:58 GMT+2
This version disables further IRAM usage in the spc codec for PP5020. This seems to be the fastest configuration for this CPU and is the same as svn.
   spc_asap_nsf_v08.patch (25.4 KiB)
 apps/codecs/asap.c                  |    8 ++--
 apps/codecs/nsf.c                   |   65 +++++++++++++++++++++--------------
 apps/codecs/libasap/asap.c          |   66 +++++++++++++++++++-----------------
 apps/codecs/libasap/asap_internal.h |    2 -
 apps/codecs/libasap/acpu.c          |    4 +-
 apps/codecs/libasap/asap.h          |    4 +-
 apps/codecs/libspc/spc_codec.h      |   62 ++++++++++++++++++++++-----------
 apps/codecs/libspc/spc_dsp.c        |   11 ++----
 apps/codecs/libspc/spc_emu.c        |    2 -
 apps/codecs/libspc/spc_cpu.c        |    2 -
 10 files changed, 133 insertions(+), 93 deletions(-)

Comment by Andree Buschmann (Buschel) - Sunday, 15 May 2011, 14:31 GMT+2
Another change was neccessary for spc to keep svn's IRAM configuration.
   spc_asap_nsf_v09.patch (25.8 KiB)
 apps/codecs/spc.c                   |    2 -
 apps/codecs/asap.c                  |    8 ++--
 apps/codecs/nsf.c                   |   65 +++++++++++++++++++++--------------
 apps/codecs/libasap/asap.c          |   66 +++++++++++++++++++-----------------
 apps/codecs/libasap/asap_internal.h |    2 -
 apps/codecs/libasap/acpu.c          |    4 +-
 apps/codecs/libasap/asap.h          |    4 +-
 apps/codecs/libspc/spc_codec.h      |   62 ++++++++++++++++++++++-----------
 apps/codecs/libspc/spc_dsp.c        |   11 ++----
 apps/codecs/libspc/spc_emu.c        |    2 -
 apps/codecs/libspc/spc_cpu.c        |    2 -
 11 files changed, 134 insertions(+), 94 deletions(-)

Comment by Andree Buschmann (Buschel) - Sunday, 15 May 2011, 17:14 GMT+2
ASAP and NSF have been submitted, resync patch.
   spc_asap_nsf_v10.patch (7.7 KiB)
 apps/codecs/spc.c              |    2 -
 apps/codecs/libspc/spc_codec.h |   58 +++++++++++++++++++++++++++--------------
 apps/codecs/libspc/spc_dsp.c   |   11 +++----
 apps/codecs/libspc/spc_emu.c   |    2 -
 apps/codecs/libspc/spc_cpu.c   |    2 -
 5 files changed, 47 insertions(+), 28 deletions(-)

Comment by Andree Buschmann (Buschel) - Sunday, 15 May 2011, 18:02 GMT+2
Test by amiconn: SPC: 47.97 MHz, 110,93 s on PP5020 with patch v10

Loading...