Scalable Partial Vectorization via Latency-Based Expression Tree Selection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional partial vectorization approaches face scalability issues, particularly when dealing with basic blocks containing hundreds of instructions, as they either suffer from high compile times or produce non-optimal vectorized code, failing to maximize instruction vectorization and minimize packing and unpacking costs.

Innovation Solution

A method that computes latencies of expression trees, selects isomorphic and independent trees, and generates vectorization code based on these, reducing compile time and optimizing vectorization by grouping expressions with the same latency and reordering statements to simplify vectorization.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Manufacturing precision

If dynamic programming is used for partial vectorization, then the number of packing and unpacking instructions is minimized and the longest expressions are vectorized, but compile time becomes extremely high and it does not scale when there are hundreds of high level statements

Engineering Contradiction:
Improvevectorization optimization qualityVSAvoidcompile time
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The patent segments the basic block analysis into multiple passes: first identifying all isomorphic expressions, then selecting a subset for vectorization based on criteria such as expression length and independence. This segmentation allows the compiler to avoid the exhaustive comparison of all expressions required by dynamic programming, thereby reducing compile time while still achieving high-quality vectorization of the most important expressions.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Instead of vectorizing all isomorphic expressions as dynamic programming would do, the patent applies partial vectorization by selecting only a subset of expressions for vectorization. This partial action reduces the compile time and the number of generated vector instructions while still capturing the most beneficial vectorization opportunities, thus resolving the contradiction between optimization quality and compile time.

Inventive Principle:
Principle #16Partial or excessive action

2Productivity

If greedy algorithms are used for partial vectorization, then compile time is reasonable and it scales with hundreds of high level statements, but the solution is not optimal and does not maximize the number of instructions vectorized

Engineering Contradiction:
Improvecompile time efficiencyVSAvoidvectorization optimization quality
Core Design Contradiction:
ProductivityVSManufacturing precision

Solution Approach 1:

The patent incorporates feedback mechanisms by analyzing the characteristics of isomorphic expressions and using this information to guide the selection process. The compiler evaluates expression properties such as length, independence, and vectorization potential, then uses this feedback to prioritize which expressions to vectorize. This feedback-driven approach ensures that the most beneficial expressions are selected, improving vectorization quality while maintaining reasonable compile time.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The patent changes the selection criteria parameters from simple greedy heuristics to more sophisticated multi-criteria evaluation. By considering multiple parameters simultaneously (expression length, independence from other vectorized expressions, vectorization benefit), the patent achieves better optimization quality while maintaining the scalability and reasonable compile time of greedy algorithms.

Inventive Principle:
Principle #35Parameter changes

3Manufacturing precision

If all independent and isomorphic expressions are compared with each other to ensure optimal vectorization, then the longest expressions are vectorized, but the compile time is extremely high when compiling basic blocks containing hundreds of statements

Engineering Contradiction:
Improvevectorization optimalityVSAvoidanalysis complexity
Core Design Contradiction:
Manufacturing precisionVSDevice complexity

Solution Approach 1:

The patent segments the set of all isomorphic expressions into groups based on their vectorization potential and characteristics. By dividing the analysis into manageable segments and processing them in priority order, the patent avoids the need to compare all expressions exhaustively, thereby reducing analysis complexity while still achieving optimal vectorization of the most important expressions.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary analysis to identify and categorize all isomorphic expressions before the actual vectorization selection. This preliminary action includes computing expression properties, identifying independence relationships, and ranking expressions by vectorization potential. By performing this preliminary work upfront, the patent reduces the complexity of the subsequent selection process while ensuring optimality.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS9158511B2Scalable partial vectorization
Publication Date: 2015.10.13 ADVANCED MICRO DEVICES INC
  • US9158511B2 patent drawing
  • US9158511B2 patent drawing
  • US9158511B2 patent drawing

AI summary

A system, method and computer program product to compute latencies of a plurality of expression trees in a basic block and to select a first and a second expression tree from the plurality of expression trees based on the computed latencies. The first expression tree is isomorphic to the second expression tree and the first and second expression trees are selected in order of largest to smallest latency. This selection ensures that the largest isomorphic expression trees are vectorized first. By vectorizing the largest isomorphic expression trees first, a basic block containing hundreds of statements can be vectorized without significant compile time. Moreover, vectorization of the largest isomorphic expression trees results in a significant improvement in system performance on SIMD processors.