GPU Control Flow Divergence Analysis and Optimization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current GPU technologies face performance slowdowns due to control flow divergence, where idle threads reduce computation efficiency, especially when runtime of divergent branches is longer than the primary execution path.
Innovation Solution
An analysis system comprising a computing unit, hardware performance profiling support, compiling unit, profiler unit, and optimization unit that counts branch and cycle numbers, calculates direction ratios, and transforms sub-flow control structures based on branch ratios and specific branch instructions to minimize divergence.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If threads are grouped and executed together to reduce divergence, then control flow divergence is reduced, but computing time increases when Block B runtime is much larger than Block A runtime
Solution Approach 1:
The patent applies preliminary action by analyzing and grouping threads before execution based on their branch prediction outcomes. The system performs static analysis to identify likely-executed branches and groups threads accordingly in advance, so that when divergence occurs, threads in the same group have similar execution paths. This pre-grouping prevents the need to wait for all threads to complete divergent paths, thereby reducing computing time while maintaining reduced divergence.
Solution Approach 2:
The patent segments the thread execution into multiple groups based on branch prediction results. Instead of executing all threads together as a single group, the system divides threads into segments (groups) where each group contains threads with similar control flow characteristics. This segmentation allows independent execution of groups, preventing idle waiting and reducing overall computing time while maintaining low divergence within each segment.
2Productivity
If conventional scheduling method is used to group threads before execution, then control flow divergence is reduced, but loop computing time increases
Solution Approach 1:
The patent applies dynamics by making the thread grouping strategy adaptive rather than static. The system uses branch prediction technology to dynamically determine grouping strategies based on the specific characteristics of each loop iteration and branch probability. This dynamic approach allows the system to optimize grouping for each computational context, reducing loop computing time while maintaining low divergence, unlike conventional static scheduling methods.
Solution Approach 2:
The patent changes the parameter of thread grouping criteria from fixed conventional methods to variable parameters based on branch prediction probabilities. The system adjusts grouping parameters (which threads are grouped together) based on predicted branch outcomes and execution probabilities. This parameter change enables flexible optimization of loop computing time while maintaining computation performance, overcoming the limitations of rigid conventional scheduling.
3Stability of the object's composition
If idle threads are waited for in divergent branches, then all threads can execute the same instruction, but computing flow amount is reduced
Solution Approach 1:
The patent applies preliminary action by predicting branch outcomes before execution and grouping threads accordingly. This pre-analysis allows the system to prepare thread groups that will execute the same instruction without divergence, eliminating the need to wait for idle threads during actual execution. The preliminary grouping based on branch prediction maintains instruction synchronization while preventing computing flow reduction.
Solution Approach 2:
The patent ensures continuity of useful action by organizing threads into groups that execute continuously without idle waiting. Through branch prediction and pre-grouping, the system ensures that threads within each group have matching control flow requirements, allowing continuous execution of useful instructions without interruption for synchronization waiting. This maintains both instruction synchronization and high computing flow amount.
Data Source
AI summary
The invention discloses an analysis system and method for reducing control flow divergence in the Graphics Processing Units (GPUs). A computing unit is used to count the number of branch, number of cycle, and to calculate at least one direction ratio. A profiler is used to determine whether the code having the optimized control flow structure and the specialized branch or not. The optimization decision unit can determine which transform pattern can be used to transform the sub-control flow structure.


