Kodi Community Forum

Full Version: [HOWTO] Build XBMC specifically for the Atom using GCC 4.5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
First off, this is probably a bad idea and not useful at all!
I honestly can't tell a difference performance wise, but I like knowing I've done all I can to improve things! Smile

Doing this might break your setup in all sorts of ways I can't help to fix! Only try this if you don't mind reinstalling your system.

I've only tried this on Ubuntu Lucid. You should probably uninstall any XBMC packages you have installed before trying it!

To compile XBMC for the Atom processor GCC 4.5 is needed since it adds support for the Atom through the -march=atom compile flag.

To install GCC 4.5 on lucid you need to add the toolchain-test repository:
Code:
sudo apt-add-repositoriy ppa:ubuntu-toolchain/test
sudo apt-get install gcc-4.5 g++-4.5
sudo apt-get update
sudo apt-get dist-upgrade

To enable easy switching between GCC 4.4 and GCC 4.5:
Code:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 30 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4
sudo update-alternatives --config gcc
Select GCC 4.5, obviously.

Checkout the XBMC svn and run bootstrap it:
Code:
svn checkout http://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk xbmc
cd xbmc
./bootstrap

Create an script in the svn directory for easy updating later. Paste this info a text file and make it executable with chmod +x update.sh:
Code:
#!/bin/bash
FLAGS="-march=atom -ffast-math -fexcess-precision=fast -floop-parallelize-all \
-ftree-parallelize-loops=4 -pipe -fomit-frame-pointer"
export CFLAGS="$FLAGS"
export CXXFLAGS="$FLAGS"
svn up
svn=$(svn info | awk '/^Revision:/{print $2}')
./configure --disable-debug --prefix=/usr --with-cpu=host \
&& make -j2 \
&& sudo checkinstall --pkgname=xbmc --pkgversion=1:10.08~svn$svn-lucid1 -y

Run the script with ./update.sh
To update to latest revision, compile and install XBMC in the future, just run the script again.
You'll have backups from all previously compiled revisions in your svn directory.

Some explanations of the options used:
-march=atom #produces code specifically for the Atom CPU's in order pipeline execution
-fexcess-precision=fast # disables the GCC 4.5 strict floating point C99 standards conformance for improved floating point performance
-floop-parallelize-all -ftree-parallelize-loops=4 # Enable the new automatic parallelization of loops introduced in GCC 4.5.
-ffast-math #I doubt XBMC does any math functions, but since I don't know for sure and XBMC doesn't need to follow IEEE or ISO rules/specifications it can't hurt either.
--with-cpu=host #builds the internal ffmpeg for the host cpu only

Again, only try this if you don't mind reinstalling your system.

Good luck!

---
Could someone with better knowledge of the code tell me what parts of XBMC ignores the CFLAGS and CXXFLAGS variables? I'm sure ffmpeg does, and for a good reason, but maybe there are more.
ffmpeg does not ignore CFLAGS actually. Have you seen any benefit in doing the compile this way?
elupus Wrote:ffmpeg does not ignore CFLAGS actually. Have you seen any benefit in doing the compile this way?

I havn't had time to compare a lot yet since I did the build today.

This reason I wanted to try this is that the Atom is the first processor since the dark ages that doesnt support out-of-order execution. Since GCC 4.5 is aware of this and can reorder the commands in the pipeline accordingly, there should be an measurable improvement. If I can find a way to measure that is! Smile

I'll try to compare it to an ICC build too and report my findings.
I agree. With atom cpus optimized compilation can bring great improvements, much more than out-of-order cpus.

My xbmc box runs gentoo and it's entirely compiled with atom optimizations (I have a 330 dual core). I'm not using gcc 4.5, it's still on the unstable branch in gentoo, but instead custom hand-made atom optimizations with gcc 4.4.3, there's no "atom" march in gcc < 4.5.

These are my CFLAGS, tested against ggc 4.5 + march "atom" result in almost the same performance.

Code:
CFLAGS="-march=core2 --param l1-cache-line-size=64
--param l1-cache-size=32 --param l2-cache-size=512
-O2 -funswitch-loops -fpredictive-commoning
-fgcse-after-reload -ftree-vectorize
-fomit-frame-pointer -mfpmath=sse -pipe"

BTW, compile xbmc or whatever with custom optimization in gentoo is as easy as copy/paste CFLAGS and "# emerge xbmc" Wink
I'd be very interested in the performance improvement of this. And I am sure all the Revo and ASROCK guys here will!
Many people here have a zotac IONitx, mine is with atom 330, ION 1st generation.
If you find any benchmark I can run it on my box and then we can compare results with "standard" installs.

Here is reported a chart with different compiles: http://software.intel.com/en-us/articles...r-the-mid/
JumJum can you upload the DEB package of your compiled xbmc, so I can test it on my Zotac IONITX-A?
Anyone able to get debs yet or run a benchmark?
I am running a Zotac Atom 230 (Single Core)..... would love to know how much (if any) this would help.

My build is running fairly solid at the moment, but when Dharma goes official I may look into this method if it appears worth while.
I could try nbench for a quick benchmark, but might not be very significant.

The best would be find something xbmc-related so we can have an idea of xbmc improvements.
Is there some sort of video playback benchmark we could use?
BurningSky Wrote:JumJum can you upload the DEB package of your compiled xbmc, so I can test it on my Zotac IONITX-A?

This is the x86 build I did, but as I said, there's no noticable difference in CPU usage or other performance as far as I can tell.

I'm going to be able to answer any support questions about this build. No time atm, sorry.

http://dl.dropbox.com/u/8945791/xbmc_1%3...1_i386.deb
snake111, can you please provide me your ION optimized full build script ?
Does anyone have a .deb for an atom-optimized XBMC build in 64-bit architecture? Since the dual core atom 330 chip is also 64 bit capable why bother doing a 32-bit compile/deb?
ugmoe2000 Wrote:Does anyone have a .deb for an atom-optimized XBMC build in 64-bit architecture? Since the dual core atom 330 chip is also 64 bit capable why bother doing a 32-bit compile/deb?

Hi, there is an OpenELEC.tv OS Atom optimized build with gcc-4.5.1. look at http://www.openelec.tv or in this thread: http://forum.xbmc.org/showthread.php?tid=61340
Pages: 1 2 3