Compiler Optimization via Variable Allocation and Loop Unrolling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional compilers lack the flexibility to provide precise control over optimization strategies, particularly in media processing applications where critical execution performance and code size are required, leading to increased development man-hours and inefficiencies.
Innovation Solution
A highly flexible compiler that allows users to designate detailed optimization directives, such as variable allocation to global regions, software pipelining, loop unrolling, and alignment, enabling precise control over code generation through options and pragmas, thereby optimizing for both performance and code size.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of time
If conventional compilers use rough optimization directives, then development time is reduced, but optimization precision and control are insufficient
Solution Approach 1:
The patent introduces multiple optimization parameters including pragma directives for variable allocation control, software pipelining options, loop unrolling factors, and alignment specifications. These parameters enable fine-grained control over compiler optimization behavior, transforming the rough directive approach into a precise parameter-based control system that maintains both speed and optimization quality.
2Speed
If software pipelining is executed to improve execution speed, then processing performance increases, but code size increases and debugging becomes difficult
Solution Approach 1:
The patent implements dynamic control of software pipelining through compile-time options and runtime pragmas. Users can enable or disable software pipelining for specific loops or functions, and adjust the degree of pipelining applied. This dynamic approach allows optimization to be applied selectively rather than universally, maintaining execution speed improvements while avoiding excessive code complexity in debugging-critical sections.
3Speed
If loop unrolling is executed to improve execution speed, then processing performance increases, but code size increases
Solution Approach 1:
The patent introduces loop unrolling factors as configurable parameters that control the degree of unrolling applied to loops. By adjusting the unrolling factor, users can balance between execution speed improvement and code size increase. The compiler applies unrolling based on these parameters, enabling selective optimization where performance-critical loops receive aggressive unrolling while other loops maintain reasonable code size.
4Speed
If variables are allocated to global region to improve access speed, then execution efficiency increases, but control over allocation becomes insufficient
Solution Approach 1:
The patent introduces pragma directives as intermediary mechanisms between the programmer and the compiler's variable allocation system. These pragmas provide fine-grained control over which variables are allocated to the global region, allowing programmers to specify allocation preferences for individual variables or groups of variables. This intermediary control layer enables both fast global access and precise programmer control over allocation strategy.
Data Source
AI summary
A compiler comprises an analysis unit that detects directives (options and pragmas) from a user to the compiler, an optimization unit that is made up of a processing unit (a global region allocation unit, a software pipelining unit, a loop unrolling unit, a “if” conversion unit, and a pair instruction generation unit) that performs individual optimization processing designated by options and pragmas from a user, following the directives and the like from the analysis unit, etc. The global region allocation unit performs optimization processing, following designation of the maximum data size of variables to be allocated to a global region, designation of variables to be allocated to the global region, and options and pragmas regarding designation of variables not to be allocated in the global region.


