Loop Unrolling Apparatus Adjusting Stage Number via Remainder
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing loop unrolling techniques do not efficiently optimize processing after loop unrolling, as the unroll stage number often results in similar processing overhead to the original loop processing, particularly when the number of looping times is not evenly divisible by the unroll stage number.
Innovation Solution
A loop unrolling processing apparatus and method that generates arithmetic expressions to adjust the unroll stage number based on the remainder of the division of looping times by the unroll stage number, allowing for efficient processing by executing loop processing with adjusted unroll stage numbers, thereby reducing processing time.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the unroll stage number is increased to reduce looping times and determination processing overhead, then the performance of loop processing is improved, but the register capacity becomes insufficient and data transfer from register to memory increases, causing performance deterioration
Solution Approach 1:
The patent divides the loop processing into multiple segments based on the remainder of division. When N % L ≠ 0, it separates the processing into (N - (N % L)) iterations with unroll stage L and (N % L) iterations with unroll stage 1. This segmentation allows the system to handle the majority of iterations efficiently with higher unroll stages while managing the remainder iterations separately, preventing register capacity overflow.
Solution Approach 2:
The patent dynamically adjusts the unroll stage number based on the iteration count and remainder conditions. Instead of using a fixed unroll stage number, the system changes the unroll stage dynamically: using stage L for most iterations and stage 1 for remainder iterations. This dynamic adjustment optimizes performance by adapting to the specific execution context while managing register usage.
2Loss of time
If loop unrolling is performed with a fixed unroll stage number, then the number of looping times is decreased, but the processing overhead remains similar when the number of looping times is not evenly divisible by the unroll stage number
Solution Approach 1:
The patent segments the loop processing into two distinct parts: the main body with (N - (N % L)) iterations processed with unroll stage L, and the remainder with (N % L) iterations processed with unroll stage 1. This segmentation ensures that the determination processing overhead is minimized for the majority of iterations while the remainder is handled efficiently with a smaller unroll stage, eliminating the waste of processing overhead.
Solution Approach 2:
The patent changes the unroll stage parameter dynamically based on the iteration context. For the main body of iterations where N % L = 0, it uses unroll stage L to minimize determination overhead. For the remainder iterations where N % L ≠ 0, it switches to unroll stage 1. This parameter change optimizes processing efficiency by matching the unroll stage to the specific execution context.
3Device complexity
If the unroll stage number is increased too much, then the number of determination processes is decreased, but the amount of processing per one loop becomes too large, causing register capacity to become insufficient
Solution Approach 1:
The patent segments the processing into multiple loops with different unroll stages. The first loop handles (N - (N % L)) iterations with unroll stage L, and the second loop handles (N % L) iterations with unroll stage 1. This segmentation prevents any single loop from requiring excessive register capacity while still reducing overall determination process complexity through the use of unroll stage L for the majority of iterations.
Data Source
AI summary
A generation unit generates arithmetic expressions. Here, N denotes the number of looping times of the loop processing. L denotes a designated lower limit of unroll stage number. M denotes a designated upper limit of the unroll stage number. Q denotes a quotient obtained by dividing N by L. R denotes a remainder obtained by dividing N by L. The arithmetic expressions include an arithmetic expression that represents executing loop processing whose number of looping times is a quotient obtained by dividing R by (M−L), with the unroll stage number M when R−Q*(M−L)>0 is not satisfied, and then executing, when a remainder obtained by dividing R by (M−L) is other than 0, processing of one loop with sum of the remainder and L as the unroll stage number, and then executing loop processing with the unroll stage number L.


