top | item 35072780

(no title)

dxf | 3 years ago

>When using an AOT language, how does one take full advantage of all cpu features at runtime? This seems like a place JIT would really outpace AOT.

One model is to not try and take advantage of the features at runtime, but to compile per-platform versions of your binary (with whatever flags and optimization levels you want, support for sanitizers, etc.) and deploy those appropriately. E.g. build one binary that supports "generic" x86 variants, one optimized for haswell, etc. This model works well if you have control over how your binaries get deployed (though not so well if you don't), and especially well if you can build the libc the same way at compile time also and statically link it into your binary. (This last point is one reason Google is investing in LLVM's libc.)

discuss

order

p_l|3 years ago

GCC and ICC both support generation of function variants compiled with different flags - you can have a function compiled for generic, lowest common denominator target, plus variants that depend on various optional features, and it will be dynamically selected at runtime which one is appropriate (iirc it will be done during dynamic linking)