Domain-Aware Phase Ordering for Code Generation Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Technical computing environments (TCEs) face inefficiencies in code generation due to the random application of optimization techniques, leading to suboptimal code for models across different domains, which can increase resource requirements and costs for physical systems represented by these models.

Innovation Solution

The implementation of a system that automatically determines a domain-aware phase order for optimization techniques, such as loop unrolling and constant inlining, based on the specific domain of the model, ensuring that optimization methods are applied in an order that maximizes performance and efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If optimization techniques are applied in random order, then code generation is simple and fast, but code performance and efficiency are suboptimal

Engineering Contradiction:
Improvecode generation speedVSAvoidcode performance
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system performs preliminary analysis of the model to determine the application domain before code generation. This preliminary action enables the selection of an optimized phase ordering strategy specific to the domain, ensuring that optimization techniques are applied in the most effective sequence without sacrificing generation speed.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The phase ordering is made dynamic and adaptive based on the model's application domain. Rather than using a fixed random order, the system dynamically selects the optimal sequencing of optimization techniques (such as loop unrolling, constant inlining, array bounds checking) according to the specific domain requirements, thereby improving code performance while maintaining efficient generation.

Inventive Principle:
Principle #15Dynamics

2Reliability

If domain-specific optimization ordering is implemented, then code performance improves, but code generation complexity increases

Engineering Contradiction:
Improvecode performanceVSAvoidcode generation complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The code generation process is segmented into distinct phases, each with specific optimization techniques applied in a determined order. The system divides the optimization process into manageable segments (such as loop optimization phase, array optimization phase, constant propagation phase) and applies them sequentially according to the domain-specific strategy, making the complexity manageable and organized.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system introduces an intermediary component that acts as a mediator between the model analysis and code generation. This intermediary determines the appropriate phase ordering based on the application domain and coordinates the application of optimization techniques, thereby managing the complexity without requiring direct complex interactions between all optimization components.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Ease of manufacture

If generic optimization is used, then code generation is straightforward, but resource requirements for physical systems increase

Engineering Contradiction:
Improvecode generation easeVSAvoidresource requirements
Core Design Contradiction:
Ease of manufactureVSUse of energy by moving object

Solution Approach 1:

The system changes the parameters of the code generation process based on the application domain. By identifying the domain characteristics, the system adjusts which optimization techniques are applied and in what order, thereby generating code that is optimized for the specific resource constraints of the target physical system, reducing energy and resource requirements.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The optimization strategy is tailored to the local characteristics of each application domain. Rather than applying a uniform generic optimization approach, the system applies domain-specific optimization sequences that address the particular resource constraints and performance requirements of each domain, thereby reducing resource requirements more effectively.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS9268537B1Automatic generation of domain-aware phase ordering for effective optimization of code for a model
Publication Date: 2016.02.23 MATHWORKS INC
  • US9268537B1 patent drawing
  • US9268537B1 patent drawing
  • US9268537B1 patent drawing

AI summary

A device receives a model, in a technical computing environment, that includes blocks and lines, and determines an application domain associated with the model. The device determines code generation optimizations for the model, determines dependencies of the code generation optimizations, and determines performance characteristics for the device. The device determines capabilities of a target compiler for the code generated based on the model, and determines a profile for target hardware to be used to execute the code. The device identifies an order for the code generation optimizations based on the determined information, generates optimal code for the model based on the identified order for the code generation optimizations, and outputs and/or store the optimal code.