Compiler IR Transformations With Runtime Feedback for Speed and Energy
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing compiler optimization methods do not adequately address the need for significant improvements in both execution speed and energy consumption of computer programs, particularly in time-sensitive applications and energy-constrained environments.
Innovation Solution
A method involving the use of a database or neural network to optimize the intermediate representation of computer programs by applying transformation rules, with a feedback mechanism to generate and update rules based on performance metrics, ensuring processor-specific adaptations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If traditional compiler optimization methods are used, then code generation is straightforward, but execution speed and energy consumption improvement is insufficient
Solution Approach 1:
The intermediate representation is divided into multiple segments, allowing selective optimization of specific code regions. Each segment can be independently analyzed and transformed based on its characteristics, enabling more targeted and effective optimizations for both speed and energy consumption.
Solution Approach 2:
Transformation rules are pre-computed and stored in a database before compilation. During code generation, these pre-analyzed transformation rules are applied to segments, avoiding the need for complex real-time optimization decisions and enabling more thorough pre-optimization of the code.
Solution Approach 3:
The system uses performance metrics from executed code to feedback into the transformation rule database. This feedback mechanism allows the compiler to learn from actual runtime behavior and continuously improve transformation rules, leading to progressively better execution speed and energy efficiency.
2Productivity
If existing transformation methods are applied, then some optimization is achieved, but performance and energy savings are not fully satisfactory
Solution Approach 1:
The optimization system is dynamic and adaptive, using performance metrics from code execution to update transformation rules. This dynamic feedback loop allows the system to adapt to different workloads and hardware configurations, continuously improving execution efficiency and reducing energy waste.
Solution Approach 2:
The system transforms code segments by applying parameter changes that optimize both execution speed and energy consumption. Transformation rules modify parameters such as loop structures, instruction scheduling, and resource allocation to achieve better performance while reducing energy usage.
3Loss of time
If no optimization is applied, then compilation is simple and fast, but execution time is longer and more energy is consumed
Solution Approach 1:
Optimization transformations are applied during the compilation phase rather than at runtime. By performing code transformations in advance using pre-computed rules, the system reduces execution time and power consumption without adding overhead during program execution.
Solution Approach 2:
The system uses intermediate representation as a copy of the source code that can be transformed without affecting the original. This intermediate form allows multiple optimization passes and transformations to be applied efficiently, reducing both execution time and energy consumption of the final compiled code.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
We describe a method for optimising the performance of software programs on processors. We assume a compiler that lowers a program's source code into an intermediate representation (IR) and further into machine instructions. The compiler optimises the program in the IR via transformations. The transformations are queried from an online transformation engine, such as a database or a neural network trained to predict IR transformations. This patent extends the infrastructure with an automatic update of the online transformation engine based on runtime information of the executed machine instructions.