我們能利用machine learning去幫助compiler的optimization演算法變強嗎?
ML通常是拿來幫忙做predict和decisions 透過大量training data (input: feature, output: predict a value or classification) 對於沒有看過的feature做predict和decisio ns 我對於ML經驗只有半年多 以下是我的一些看法 1. 如果是對特定benchmark的話 用ML能幫忙找出不錯的heuristic值 (ex. --param, --regalloc=[ basic|fast|greedy|pbqp] 等等) google也滿多的 Automatic Feature Generation for Machine Learning Based Optimizing Compilation 但直到看到"MILEPOST GCC" 覺得圖很眼熟... 就是interactive compiler! 2. 如果想把machine learning的training也做進compiler內 看來就只能做在JIT了 google了一下也有人做到VM Using machines to learn method-specific compilation strategies (IBM) Method-Specific Dynamic Compilation using Logistic Regression 也有人拿來做CPU/GPU decisions XD Machine-Learning-based Performance Heuristics for Runtime CPU/GPU Selection 如果做在AOT compiler, 感覺就像PGO, 看起來也不需ML 3. 如果要用machine learning去學出某隻benchmark/ function最好的instruction sequence 感覺可以用reinforcement learning去做 但是用interactive compiler去挑heuristic就可能做...