GPU Control Flow Divergence Analysis and Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvecomputing efficiencyVSAvoidcomputing time
Core Design Contradiction:
ProductivityVSLoss of time

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.

Inventive Principle:
Principle #10Preliminary action

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.

Inventive Principle:
Principle #1Segmentation

2Productivity

If conventional scheduling method is used to group threads before execution, then control flow divergence is reduced, but loop computing time increases

Engineering Contradiction:
Improvecomputation performanceVSAvoidloop computing time
Core Design Contradiction:
ProductivityVSDuration of action of moving object

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.

Inventive Principle:
Principle #15Dynamics

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.

Inventive Principle:
Principle #35Parameter changes

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

Engineering Contradiction:
Improveinstruction synchronizationVSAvoidcomputing flow amount
Core Design Contradiction:
Stability of the object's compositionVSProductivity

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.

Inventive Principle:
Principle #10Preliminary action

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.

Inventive Principle:
Principle #20Continuity of useful action

Data Source

PatentUS9870599B2Analysis system and method for reducing the control flow divergence in the Graphics Processing Units (GPUs)
Publication Date: 2018.01.16 MEDIATEK INC
  • US9870599B2 patent drawing
  • US9870599B2 patent drawing
  • US9870599B2 patent drawing

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.