about
Learning Branch Probabilities in Compiler from Datacenter Workloads (arxiv.org)
1 point by jeffbee on Feb 21, 2022 | hide | past | pdf | discuss on HN

In plain words: Compilers guess how often an if-statement goes one way when no profile data exists; this system learns those odds from real datacenter program runs instead of hand-written guesses. Its estimates were much more accurate, making programs up to 8.1% faster.

Abstract

Estimating the probability with which a conditional branch instruction is taken is an important analysis that enables many optimizations in modern compilers. When using Profile Guided Optimizations (PGO), compilers are able to make a good estimation of the branch probabilities. In the absence of profile information, compilers resort to using heuristics for this purpose. In this work, we propose learning branch probabilities from a large corpus of data obtained from datacenter workloads. Using metrics including Root Mean Squared Error, Mean Absolute Error and cross-entropy, we show that the machine learning model improves branch probability estimation by 18-50% in comparison to compiler heuristics. This translates to performance improvement of up to 8.1% on 24 out of a suite of 40 benchmarks with a 1% geomean improvement on the suite. This also results in greater than 1.2% performance improvement in an important search application.

Easwaran Raman, Xinliang David Li
arXiv:2202.06728 · cs.LG, cs.PF · submitted Feb 10, 2022
abstract · pdf · html · arXiv admin note: text overlap with arXiv:2101.04808 by other authors

add comment on HN