Abstract:With the continuous advancement of compilation technology, modern compilers support richer programming models and more complex compilation optimizations, which makes manually adjusting compilation options for optimal performance extremely challenging. Although various automated compilation tuning methods have been proposed, traditional heuristic search algorithms often struggle to avoid being trapped in local optima when confronted with vast search spaces. Moreover, most existing tuning methods target single-core or multi-core architectures, limiting their use in large-scale parallel computing systems. To address these issues, this study designs and implements a distributed compilation tuning framework, SWTuner, based on machine learning methodologies. By introducing AUC-Bandit-based distributed meta-search strategies, machine learning model-guided performance prediction, and SHAP-based compilation option analysis and filtering, the resource utilization and search efficiency during the compilation tuning process are significantly improved. Experimental results show that SWTuner performs excellently in tuning typical test cases on the new-generation Sunway supercomputer, not only reducing search time but also achieving notable reductions in actual execution power consumption during the search process compared to other tuning methods. During the tuning process, the random forest model employed by SWTuner demonstrates good generalization capability and prediction accuracy, effectively reducing search space dimensionality while maintaining tuning effectiveness, providing an efficient and reliable solution for automatic compilation tuning in high-performance computing.