Loop Unrolling Apparatus Adjusting Stage by Remainder
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current loop unrolling techniques do not efficiently optimize processing after loop unrolling, as the unroll stage number often results in overhead similar to the original loop processing, leading to suboptimal performance.
Innovation Solution
A loop unrolling processing apparatus and method that specifies and generates arithmetic expressions to execute loop processing with a sum of the remainder and the designated unroll stage number when the number of looping times has a remainder, allowing for more efficient processing by adjusting the unroll stage number based on the remainder.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the unroll stage number is increased, then the performance of loop processing is improved, but the register capacity becomes insufficient and data transfer from register to memory increases
Solution Approach 1:
The patent divides the loop processing into multiple segments based on the remainder when dividing the total number of iterations by the unroll stage number. This segmentation allows the processor to handle different portions of the loop with appropriate unroll stages, preventing register overflow while maintaining high performance for the majority of iterations.
Solution Approach 2:
The patent dynamically adjusts the unroll stage number based on the remainder calculation. When the remainder is zero, a higher unroll stage is used to maximize performance. When the remainder is non-zero, the unroll stage is adjusted to accommodate the remaining iterations, thereby optimizing the balance between performance and register usage.
2Productivity
If the unroll stage number is increased too much, then the performance deteriorates due to insufficient register capacity, but increasing it too little fails to reduce overhead effectively
Solution Approach 1:
The patent implements a dynamic unroll stage selection mechanism that adjusts the unroll stage number based on runtime conditions, specifically the remainder of the iteration count. This dynamic adjustment allows the system to optimize performance for each specific execution context, avoiding the pitfalls of both excessive and insufficient unrolling.
Solution Approach 2:
The patent changes the unroll stage parameter based on the remainder calculation. By selecting different unroll stage values (e.g., using a higher stage when remainder is zero and adjusting when remainder is non-zero), the system optimizes the balance between reducing determination overhead and maintaining register capacity adequacy.
3Productivity
If loop unrolling is performed with a fixed unroll stage number, then the implementation is simple, but the processing efficiency is suboptimal when the number of iterations has a remainder
Solution Approach 1:
The patent performs a preliminary calculation of the remainder before executing the loop. This preliminary action allows the system to determine the appropriate unroll stage in advance, ensuring optimal processing efficiency from the start of loop execution without requiring complex runtime adjustments during the loop itself.
Solution Approach 2:
The patent introduces an intermediary calculation (the remainder operation) that bridges the gap between the fixed unroll stage number and the actual number of iterations. This intermediary value serves as a basis for selecting the optimal unroll stage, simplifying the overall implementation while improving processing efficiency.
Data Source
AI summary
The specification unit 3 specifies a description part of an arithmetic expression that represents loop processing from an input source program. The generation unit 4 generates arithmetic expressions that represent executing, when a remainder when dividing the number of looping times of the loop processing by a designated unroll stage number is other than 0, processing of one loop with a sum of the remainder and the designated unroll stage number as a unroll stage number, and executing loop processing with the designated unroll stage number after the processing of one loop. The replacement unit 5 replaces the arithmetic expression of the description part specified by the specification unit 3 with the arithmetic expressions generated by the generation unit 4.


