Vectorizing Scalar Loops with Loop-Carried Dependences

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional compiler techniques fail to effectively vectorize scalar computer program loops with loop-carried dependences, as they cannot handle cycles formed by these dependences, which prevents parallel execution and reduces efficiency.

Innovation Solution

The system analyzes and processes dependence graphs to identify and remove cycles, using techniques such as edge elimination and predicate manipulation to convert scalar loops into vectorizable forms, allowing for parallel execution of loop iterations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If conventional compiler techniques are used to vectorize scalar loops, then loops without loop-carried dependences can be successfully vectorized, but loops with loop-carried dependences cannot be vectorized due to cycle formation

Engineering Contradiction:
Improvevectorization capabilityVSAvoidhandling of loop-carried dependences
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The dependence graph is segmented into multiple components, and cycles are identified and eliminated by analyzing specific paths within the graph. This allows the compiler to handle loops with loop-carried dependences by breaking down the complex dependence relationships into manageable segments that can be processed independently.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The invention changes the approach from treating the entire loop as a single unit to analyzing individual dependence edges and their directions. By examining the direction of data flow in the dependence graph, the compiler can determine which loops can be vectorized and which require special handling, thereby expanding vectorization capability to include loops with certain types of loop-carried dependences.

Inventive Principle:
Principle #35Parameter changes

2Speed

If scalar loops with loop-carried dependences are executed sequentially, then loop integrity is maintained, but execution speed is reduced due to inability to parallelize

Engineering Contradiction:
Improveexecution speedVSAvoidloop integrity
Core Design Contradiction:
SpeedVSReliability

Solution Approach 1:

The compiler performs preliminary analysis of the dependence graph before code generation, identifying cycles and determining vectorization strategies in advance. This preliminary action allows the compiler to prepare appropriate vectorized code that maintains loop integrity while enabling parallel execution, thus achieving both speed improvement and reliability preservation.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The invention introduces intermediate representations and analysis structures (such as the dependence graph and cycle detection mechanisms) that act as intermediaries between the original scalar loop and the final vectorized code. These intermediaries enable the compiler to transform loops with loop-carried dependences into vectorized forms that maintain correctness while improving execution speed.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS10402177B2Methods and systems to vectorize scalar computer program loops having loop-carried dependences
Publication Date: 2019.09.03 INTEL CORP
  • US10402177B2 patent drawing
  • US10402177B2 patent drawing
  • US10402177B2 patent drawing

AI summary

Methods and systems to convert a scalar computer program loop having loop-carried dependences into a vector computer program loop are disclosed. One such method includes, at runtime, identifying, by executing an instruction with one or more processors, a first loop iteration that cannot be executed in parallel with a second loop iteration due to a set of conflicting scalar loop operations. The first loop iteration is executed after the second loop iteration. The method also includes sectioning, by executing an instruction with one or more processors, a vector loop into vector partitions including a first vector partition. The first vector partition executes consecutive loop iterations in parallel and the consecutive loop iterations start at the second loop iteration and end before the first loop iteration.