Using Intel LLVM compiler with Julia

Since Intel C/C++ compiler has adopted LLVM, is there a way to tell Julia to use Intel compiler?

Sorry, stupid question: for what, building Julia?

I meant using Intel compiler as JIT compiler to compile Julia codes into native binary codes

I believe Julia is using LLVM directly and is not translating via C/C++.

1 Like

I doubt it. They adopted LLVM since it’s a better backend (i.e. optimizer) or to lessen their maintenance effort of their ICC compiler. Microsoft’s C++ compiler (MSVC, part of Visual Studio) had Intel compiler available, so if still possible LLVM (did they even adopt LLVM otherwise)?

I believe they all use LLVM unchanged, just as Julia does (EDIT: well Julia also changes LLVM, but at least for Julia’s work, everything eventually gets upstreamed), or let’s say help improve LLVM for all, since it’s open source, also for the benefit of Julia. Their proprietary compilers are for C/C++, i.e. the frontend (parser etc.) except for the same backend.

To compile Julia itself, it was possible (but not helpful, nor would it help now), still a while back something specific to ICC and MSVC was dropped because those compilers rarely used (while partially reverted for MSVC recently on master).

My ignorance :sweat_smile:

I would expect each vendor that is using LLVM as a backend to add their own proprietary optimization passes (which might or might not make it back to plain LLVM) and not only focus on the frontend. Having better performance of produced native code compared to other versions/vendors still makes you (e.g. Intel) look good. Unfortunately, I can’t find a recent comparison of the Intel LLVM-based C++ compilers versus CLang C++, but I suspect that that would show quite a bit of performance benefit from using the Intel kind.

From Intel Completes LLVM Adoption; Will End Updates to Classic C/C++ Compilers in Future (emphasis mine):

The default for the Intel C/C++ compilers going forward are versions (icx) that have adopted the LLVM open source infrastructure. We continue our strong history of contributing to the clang and LLVM projects, including optimizations for LLVM and clang. Not all our optimization techniques get upstreamed—sometimes because they are too new, sometimes because they are very specific for Intel architecture. This is to be expected and is consistent with other compilers that have adopted LLVM.

“Very specific for Intel architecture” sounds reasonable, but that’s no reason not contribute those back to LLVM. Even if those optimizations would only be used on Intel CPUs, that would still be a win for owners of those. But contributing some of those passes as open-source might give the competition (i.e. AMD) something to build upon to improve performance on AMD CPUs. Call me cynical, but that’s how I see it anyway. It’s simply not a world in which every CPU, GPU and/or compiler vendor is working together with the other players to get the best performance for everyone.