halo icon indicating copy to clipboard operation
halo copied to clipboard

Hot-cold Splitting

Open kavon opened this issue 5 years ago • 0 comments

A current deficiency of the profile-guided hot-cold splitting (HCS) in LLVM is that it will not move the cold functions away from the hot code to actually benefit from spatial locality due to issues with linkers. This is most likely why it does not yield performance improvements, only code size reductions.

For Halo, it might make sense to perform HCS (preceded by inlining and followed up by function merging). One way to do it in a way to benefit from locality is to extract those cold functions into another module, compile separately, and send two object files to clients. Thus, the dynamic linker will allocate the the hot and cold functions away from each other as two dylibs. There may be cyclic dependencies between these two modules, so some care will be needed when linking.

kavon avatar Oct 23 '19 00:10 kavon