Need "wrapper" to compile the Linux kernel with ICC

132 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting - thaidog

Awsone! A few questions... how did you compile your intel kernel: Did you use:

make HOSTCC=intelwrapper CC=intelwrapperAr=xiar LD=xild

or

make HOSTCC=intelwrapper CC=intelwrapper

and did you use:

export set CC=intelwrapper'

for the nvidia compile?

I use 'make HOSTCC=intelwrapper CC=intelwrapper' and 'export set CC=intelwrapper'. In theory, we should use 'AR=xiar LD=xild' but since there are no IPO opt, you can use gcc linker directly. What problem have you meet?

Quoting - zhenhua.zhang

I use 'make HOSTCC=intelwrapper CC=intelwrapper' and 'export set CC=intelwrapper'. In theory, we should use 'AR=xiar LD=xild' but since there are no IPO opt, you can use gcc linker directly. What problem have you meet?

I have not had a chance to try yet unfortnately. So it should still work with AR=xiar LD=xild? just want to make sure before I update the wiki.

Quoting - thaidog

I have not had a chance to try yet unfortnately. So it should still work with AR=xiar LD=xild? just want to make sure before I update the wiki.

Yes, it still works withxiar & xild. But you don't have toadd them in your command line unless you are using IPO.

Quoting - (Intel)

Yes, it still works withxiar & xild. But you don't have toadd them in your command line unless you are using IPO.

Is our kernel able to use IPO at all now?

Quoting - thaidog

Is our kernel able to use IPO at all now?

I didn't get a chance toturn onIPO with 10.1or 11.0 compiler yet. I'll try it for sure some time later. If you see any problem with IPO, please let me know.

Quoting - (Intel)

Quoting - thaidog

Is our kernel able to use IPO at all now?

I didn't get a chance toturn onIPO with 10.1or 11.0 compiler yet. I'll try it for sure some time later. If you see any problem with IPO, please let me know.

Ok will do! :)

Quoting - (Intel)

I didn't get a chance toturn onIPO with 10.1or 11.0 compiler yet. I'll try it for sure some time later. If you see any problem with IPO, please let me know.

me and newper were talking... it apeears there have been some changes:

"Something about IPO:
According to intel's doc,icc8 has an option called -ipo_obj,that
forces the compiler to create real object files when used with
-ipo,but now this option disappeared.
I tried to undef inline in the compiler-intel.h,but it seem has no use."

Is that going to be an issue?

FYI I just started a Google Group for this:

http://groups.google.com/group/linuxdna

I would also like to announce that our project LinuxDNA now has an offical partnership wth Dream Linux! If you have not tried Dream Linux you should download it. You will never have to go back to Windows once you do! We will be crating an ICC optimized version of Dream Linux for Atom based netbooks like the Asus Eee PC! Since there are no GCC specific optimizations available for the Atom cpu our Dream Linux build will be the fastest thing out there period! Pleas join our Google group if you would like to contribute and be a part of our team!

Quoting - bustaf

Hi
you have fault syntax in your link
Is wrote http://www.lnuxdna.com/icc_dev_vm.tar.lzma
But are
http://www.linuxdna.com/icc_dev_vm.tar.lzma
Also
I am sorry that i can not make immediately
I have an task with RS/6000 AIX must be finished this week
Best regards

bustaf:

I was wondering if you see ny freexes with SuSE? I have reports that onDemend cpu freq scaling is not available with compiling on SuSE and that they are getting radom freezes. I have no idea why this would be happending... they are a linux newbie however.

Are you seeing anything like that on SuSE or OpenSuSE?

my wrapper
ARGS=$@

# Add "-gcc" in the prevention of icc.cfg have "-no-gcc"

ICCARGS="-fno-builtin -gcc"

if [ -z "$ICC" ]
then
 ICC=icc
fi

if [ -z "$GCC" ]
then
 GCC=gcc
fi

for ARG in $@

do

case $ARG in

-fno-stack-protector )
 ICCARGS="$ICCARGS -fno-stack-security-check"
 ;;
-O2 | -O3 )
 ICCARGS="$ICCARGS -O2"
 ;;

-v )
 $ICC --version 2>&1 | grep "icc"
 exit 0
 ;;

*/boot/* )
 $GCC $ARGS
 exit $?
 ;;

# ignore these gcc options
-fno-unit-at-a-time | -fno-inline | -g | -gstabs |-maccumulate-outgoing-args|-mno-3dnow|-mno-mmx | -mno-sse | -mno-sse2 |-mpreferred-stack-boundary=2 |-msoft-float | -nostdinc | -pipe | -Wall | -Werror | -Wno-pointer-sign )
 ;;

* )
 ICCARGS="$ICCARGS $ARG"
 ;;
esac
done
$ICC $ICCARGS
exit $?

my kernel is 2.6.28.8, icc is 11.081.

what i have modified:
Makefile
script/Makefile.build
script/Makefile.modpost
add /opt/intel/Compiler/11.0/081/lib/ia32/libirc_s.a

include/linux/compiler-intel.h
add #undef __compiler_offsetof

then i make CC=kicc HOSTCC=kicc LD=xild AR=xiar V=1 bzImage

bzImage is ok, but when i make modules, i got this:
Building modules, stage 2.
make -f /usr/src/linux-2.6.28.8-icc/scripts/Makefile.modpost
scripts/mod/modpost -o /usr/src/linux-2.6.28.8-icc/Module.symvers -S -K /usr/src/linux-2.6.28.8-icc/Module.markers -M /usr/src/linux-2.6.28.8-icc/Module.markers -s
ERROR: "snd_pcm_format_width" [sound/pci/hda/snd-hda-intel.ko] undefined!
ERROR: "kmalloc_caches" [sound/pci/hda/snd-hda-intel.ko] undefined!
ERROR: "pci_bus_read_config_byte" [sound/pci/hda/snd-hda-intel.ko] undefined!
ERROR: "__kmalloc" [sound/pci/hda/snd-hda-intel.ko] undefined!
ERROR: "msleep" [sound/pci/hda/snd-hda-intel.ko] undefined!
....
ERROR: "kmalloc_caches" [arch/x86/kernel/test_nx.ko] undefined!
ERROR: "printk" [arch/x86/kernel/test_nx.ko] undefined!
WARNING: modpost: Found 14 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
make[1]: *** [__modpost] 1
make: *** [modules] 2

so, anyone have got the same problem? need help.

Thanks

Quoting - thaidog

bustaf:

I was wondering if you see ny freexes with SuSE? I have reports that onDemend cpu freq scaling is not available with compiling on SuSE and that they are getting radom freezes. I have no idea why this would be happending... they are a linux newbie however.

Are you seeing anything like that on SuSE or OpenSuSE?

Find
#define __EXPORT_SYMBOL(sym, sec)
extern typeof(sym) sym;
__CRC_SYMBOL(sym, sec)
static const char __kstrtab_##sym[]
__attribute__((section("__ksymtab_strings"), aligned(1)))
= MODULE_SYMBOL_PREFIX #sym;
static const struct kernel_symbol __ksymtab_##sym
__used
__attribute__((section("__ksymtab" sec), unused))
= { (unsigned long)&sym, __kstrtab_##sym }
in include/linux/module.h
remove 'static',before const char __kstrtab_##sym[] and const struct kernel_symbol __ksymtab_##sym

thanks!

i tried. bzImage is ok, modules get a new error!

[shell]Building modules, stage 2.
make -f /usr/src/linux-2.6.28.8/scripts/Makefile.modpost
  scripts/mod/modpost   -o /usr/src/linux-2.6.28.8/Module.symvers    -S -K /usr/src/linux-2.6.28.8/Module.markers -M /usr/src/linux-2.6.28.8/Module.markers   -s
ERROR: "__bad_udelay" [drivers/net/e1000e/e1000e.ko] undefined!
WARNING: modpost: Found 14 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
[/shell]

Quoting - newper

Find
#define __EXPORT_SYMBOL(sym, sec)
extern typeof(sym) sym;
__CRC_SYMBOL(sym, sec)
static const char __kstrtab_##sym[]
__attribute__((section("__ksymtab_strings"), aligned(1)))
= MODULE_SYMBOL_PREFIX #sym;
static const struct kernel_symbol __ksymtab_##sym
__used
__attribute__((section("__ksymtab" sec), unused))
= { (unsigned long)&sym, __kstrtab_##sym }
in include/linux/module.h
remove 'static',before const char __kstrtab_##sym[] and const struct kernel_symbol __ksymtab_##sym

i used the icc kernel and gcc modules boot

it looks like everything is ok ....

but i want to know how to build the modules using icc?

Quoting - beartung

i found two symbols which kernel not defined...

nm vmlinux-icc|grep ' U ':
U ____ilog2_NaN
U __bad_udelay

so when i make modules got error:

ERROR: "__bad_udelay" [drivers/net/e1000e/e1000e.ko] undefined!

Quoting - beartung

Try this,though it's really not a good solution
Open arch/x86/include/asm/delay.h
Delete these:

extern void __bad_udelay(void);
extern void __bad_ndelay(void);

(n) > 20000 ? __bad_udelay() :

(n) > 20000 ? __bad_ndelay() :

Quoting - newper

Try this,though it's really not a good solution
Open arch/x86/include/asm/delay.h
Delete these:

extern void __bad_udelay(void);
extern void __bad_ndelay(void);

(n) > 20000 ? __bad_udelay() :

(n) > 20000 ? __bad_ndelay() :

newper's workaround should work. Thanks newper.

Feilong

thanks newper and Feilong

i have changed icc to 10.1.022, both kernel and modules built. it works well : )

i will try icc 11 using your way too.

Quoting - Feilong H. (Intel)

newper's workaround should work. Thanks newper.

Feilong

Feilong we have someone wanting to compile an IA64 kernel... you have done that before right?

Quoting - thaidog
Feilong we have someone wanting to compile an IA64 kernel... you have done that before right?

Didyou meant to say Intel 64 or IA-64 (Itanium)?

Quoting - Feilong H. (Intel)

Quoting - thaidog
Feilong we have someone wanting to compile an IA64 kernel... you have done that before right?

Didyou meant to say Intel 64 or IA-64 (Itanium)?

I think he means Itanium.

Quoting - thaidog

I think he means Itanium.

I compiled 2.6.9 kernel for IA-64 with icc 9.1 a few years ago. Due to my resource limitation, I didn't work on IA-64 kernel since then. The most part of the patch file is replacing inline asm code with intrinsics because icc for IA-64 doesn't support inline asm. If you are interested in compiling an IA-64 kernel, i'd be happy to assist you.

Quoting - Feilong H. (Intel)

Quoting - thaidog

I think he means Itanium.

I compiled 2.6.9 kernel for IA-64 with icc 9.1 a few years ago. Due to my resource limitation, I didn't work on IA-64 kernel since then. The most part of the patch file is replacing inline asm code with intrinsics because icc for IA-64 doesn't support inline asm. If you are interested in compiling an IA-64 kernel, i'd be happy to assist you.

Well I do not have an Itanium cpu to test on but I will forward this to LuYi since he got the e-mail rom the person who wanted to try :)

Feilong I have been trying to get in touch with somebody at Intel about our project. We have a full LiveCD based in ICC that is ready to go but we do not have a Professional compiler license so we can not distrbute it. I was hoping that Intel would help us out with this due to the popilarity of the project.

Do you have somebody on the "inside" we could talk to about this project?

Quoting - thaidog

I am a developer with an idea to start a new kernel source for Gentoo that is specifically for the Intel ICC compiler. Evidentally there is a "wrapper" that is needed to be applied to the kernel source first before ICC can correctly complie the Linux kernel. Where can I get this wrapper? (I have looked all over the web but the only yhing I can find is old documentation)

i hope this post will help you,

http://www.gentoo-wiki.info/HOWTO_ICC_and_Portage

and

http://www.intel.com/cd/software/products/asmo-na/eng/compilers/284264.htm

Hope it help as your reference

We have a new story out on this project at Linux.com:

http://linux.com/news/software/linux-kernel/23770-compiler-project-aims-...

FYI we have a fast new patch out for 64bit 2.6.32 and .33 kernels:

wget http://www.linuxdna.com/dna-2.6.32.7-intel64-3.patch

wget http://www.linuxdna.com/dna-2.6.33-rc7-atom-intel64-2.patch

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.7.tar.bz2

wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.33-rc7.tar...

It has been tested to work with the latest version 11.1.064 and .059 compilers and kernel 2.6.32.7. earlier .32 kernels *do not* work, fyi!

This patch also fixes a nagging issue with icc compiled modules not working.

Benchmakrs are avaiable at linuxdna.com

Techsupport can be submitted at:
http://groups.google.com/group/linuxdna

We are looking for developers who are intertested in working on the project! Please e-mail me at tyler@linuxdna.com if you are interested in any way contributing.

The "-fno-builtin" is not working on icc 11.1.

It keeps changing struct initializations to "_intel_fast_memset". We don't call memset.

We tried making a gcc wrapper that included _intel_fast_memset, but its args are obviously not the same as w/ memset.

Found the solution:

-ffreestanding

Thaidog: is that what you meant when you said:

This patch also fixes a nagging issue with icc compiled modules not working.

... since I've moved on and my kernel modules still has some issues not present w/ gcc.

blackburried,

Yes,-ffreestanding is what you need. You found it before I post this reply. :)

Everything seems to be working properly, except, I'm n ot seeing the expected benefit in performance from the Intel compiler in the module I'm compiling.

I'm compiling the .c's into .o's w/ icc, but linking the .ko's w/ gcc.

I'm worried that whatever architecture-specifc code icc sets up to choose from at load time is not being properly done w/ my methodology.

IIRC, when not specifying a specific architecture, icc has to create optimized code for all architectures and make the choice of which code to select at load time.

When is this done, and/or how do I ensure this is being done?

Pages

Leave a Comment

Please sign in to add a comment. Not a member? Join today