Scalar Code Reduction via Shortest Path Routing in Loops

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Vectorizing compilers face difficulties in reducing the number of scalar instructions required in loops, particularly due to the computational complexity of identifying common subexpressions, which is not well addressed by typical compilers.

Innovation Solution

A compiler system that uses strength reduction and invariant hoisting, combined with a mechanism for finding shortest path routes through expressions with common relationships, and pruning routines to reduce the number of expressions, enabling efficient reduction of scalar operations by computing cost matrices and replacing expressions with less computationally expensive chains.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional compiler methods (hoisting invariants and identifying common subexpressions) are used to reduce scalar instructions, then the number of scalar computations is reduced, but the computational complexity and processing time increase significantly

Engineering Contradiction:
Improvereduction of scalar instruction countVSAvoidcompiler processing time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent segments the problem of identifying common subexpressions by focusing only on expressions containing loop induction variables. This segmentation reduces the search space from all possible expressions to a specific subset, making the analysis computationally tractable while still achieving significant scalar instruction reduction through shortest path routing among the segmented expressions.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary classification of expressions to identify those containing loop induction variables before applying the expensive shortest path analysis. This preliminary action filters out irrelevant expressions in advance, reducing the computational burden of the subsequent optimization phase and overall compiler processing time.

Inventive Principle:
Principle #10Preliminary action

2Productivity

If comprehensive common subexpression identification is performed, then more redundant calculations are eliminated, but the algorithm becomes computationally intractable

Engineering Contradiction:
Improveelimination of redundant calculationsVSAvoidalgorithm complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent applies local quality by treating expressions containing loop induction variables differently from other expressions. Instead of applying uniform complex analysis to all expressions, the patent focuses computational resources only on the local subset of expressions that contain loop induction variables, where the potential for common subexpressions is highest and most beneficial.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent performs partial action by identifying common subexpressions only within the subset of expressions containing loop induction variables, rather than performing exhaustive analysis on all expressions. This partial approach achieves sufficient redundancy elimination for significant performance improvement while keeping the algorithm tractable.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS8413126B2Scalar code reduction using shortest path routing
Publication Date: 2013.04.02 CRAY INC
  • US8413126B2 patent drawing
  • US8413126B2 patent drawing
  • US8413126B2 patent drawing

AI summary

This document discusses, among other things, a system and method computing the shortest path expression in a loop having a plurality of expressions. Candidate expressions in the loop are identified and partitioned into sets. A cost matrix is computed as a function of the sets. Paths are found through the cost matrix and, if there are cycles in the paths, the cycles are broken. One or more shortest path expressions are generated as a function of the paths and one or more of the expressions in the loop are replaced with the shortest path expressions.