Thursday, October 7, 2010

Porting ICC to FreeBSD

I'm intrigued at the possibility for more speed out of FreeBSD by using Intel's C compiler. It's demonstrated some impressive benchmarks against gcc in the past, and we all know the version of gcc (4.2.1) that is included in FreeBSD 8.x (due to GPL license issues) is quite old, and doesn't properly recognize a Core2 let alone an i7 or Atom processor.

Here's my posting to the freesbsd-ports mailing list;


My first stage on this will be feasibility. I'm a pretty busy guy, so I don't want to waste time on a task that I won't complete. I'll either do it all, or I won't bother. It should take me a few weeks to get enough of a feel for things to make that call.

Fist stage is working with ICC on Linux to make sure I understand how it behaves. I don't think it will matter which distro too much, but if anyone has a suggestion, I'm open to it. I'll be able to do some basic comparisons with a newer GCC at the same time... or perhaps I'll go back in time to an older distro that has GCC 4.2.1 for a closer comparison to what FreeBSD has.

I'll be focusing on 64 bit FreeBSD only, and I'll work it from the 8.1 base. 9 is too much of a moving target.

At this stage, I'm not sure if I should bother with kernel or not. Unfortunately, unless someone has benchmarks showing the difference a FreeBSD kernel/world compiled with ICC is on a modern Intel Xeon or i7, I really don't know if it's worth it or not. I'll probably have to do it to see if it's worth it.

Personally, I'm interested in anything that can help make my ZFS installations move faster. I'm building them with 96+ gigs of RAM for L2ARC, so memory alloc, etc are important, along with checksum and compression calculations - Items that I know are improved in newer Intel chips. Is GCC/LLVM able to access them as well as ICC? Does it matter to real world speed if I can get 20% more out of them? We'll see.

My processor will probably be an i7, ultimately I can probably pull a spare production X5660 for a few days worth of testing later on.

I feel a modern processor is necessary so it's new features can be properly exploited. I expect that there should be less of a difference between ICC and GCC on older base P4 type architecture, but once again, that's something that I can test and report on.

Any comments or suggestions are welcome.


  1. Nice post. I have this problem now. I will run freebsd in atom embedded and don't know what to do to get more performance. In some reports, gcc 4.5 have binary speed much better then gcc 4.2.1 and llvm-clang in atom processor. However, Intel compiler is best then gcc 4.5 and llvm-clang (time to compile equal to clang, binary sometimes 30~35% faster then gcc 4.5). In debian, for test, try to compile kfreebsd source with icc 12 and failed in many ways (sure, is code to gcc or clang, not icc).

  2. Yes, I was going to play with kfreebsd as a base for my ICC port, but unfortunately work has been crazy for the last few months, so there isn't enough time to tackle this.

    For now, you'll be a bit better off with Clang in 9, but I seem to recall that Atom support is so-so in Clang as well because Apple doesn't care about it.