Litcius/Paper detail

Supersonic: Learning to Generate Source Code Optimizations in C/C++

Zimin Chen, Sen Fang, Martin Monperrus

2024IEEE Transactions on Software Engineering11 citationsDOIOpen Access PDF

Abstract

Software optimization refines programs for resource efficiency while preserving functionality. Traditionally, it is a process done by developers and compilers. This paper introduces a third option, automated optimization at the source code level. We present SUPERSONIC, a neural approach targeting minor source code modifications for optimization. Using a seq2seq model, SUPERSONIC is trained on C/C++ program pairs ( <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">x<sub>t</sub>, x<sub>t+1</sub></i> ), where <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">x<sub>t+1</sub></i> is an optimized version of <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">x<sub>t</sub></i> , and outputs a diff. SUPERSONIC’s performance is benchmarked against OpenAI’s GPT-3.5-Turbo and GPT-4 on competitive programming tasks. The experiments show that SUPERSONIC not only outperforms both models on the code optimization task but also minimizes the extent of the change with a model more than 600x smaller than GPT-3.5-Turbo and 3700x smaller than GPT-4.

Topics & Concepts

Computer scienceProgramming languageSource codeCode (set theory)Parallel computingSet (abstract data type)Parallel Computing and Optimization TechniquesEmbedded Systems Design TechniquesDistributed and Parallel Computing Systems