With the Clear Linux* project you can develop software that works in multiple platforms. At the end of the day, your software could run anywhere: on a server or a home computer. The Intel® architecture provides many powerful instruction set extensions but it can be challenging to develop code that takes advantage of these capabilities.

In Clear Linux, we implemented the Function Multi-Versioning (FMV) compiler feature. FMV optimizes the same code for multiple architectures. It automatically selects the correct architecture-specific version of the code at runtime. We are the only Linux distribution supporting FMV for C code. With FMV, you can easily develop applications that take advantage of the enhanced instructions of the Intel® architecture.

FMV at work

Consider the AVX2 instruction set extension introduced in the 4th Generation Intel® Core™ processor family. Normally, a compiler using AVX2 instructions would limit your binary to this and newer processor families. With FMV, the compiler generates AVX2-optimized versions of the code and, at runtime, will automatically use only the appropriate version.

In other words, when the binary is run on newer processors, it will use the appropriate optimizations. When that same binary runs on previous generations, it falls back and uses the supported standard instructions.

In Clear Linux, we applied this technology on packages where AVX2 instructions could possibly improve performance. Our research showed some packages are already optimized internally for multiple instruction sets, making FMV unnecessary in those cases. However, other compiler optimization techniques can take advantage of the profile data to perform additional optimizations based on code behavior, for example AutoFDO.

We use these optimizations and FMV to improve the performance as much as possible. We invite you to use this new feature and release the power of your code within multiple architectures with little effort.

Write once and deploy everywhere!