Compiler Tile Size Optimization via Build Cost Model

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing tiling methods in software optimization lack effective heuristics for dynamic memory allocation, particularly in managing large loop nests and multi-dimensional arrays, leading to inefficient data transfers and cache overflow issues.

Innovation Solution

A method is introduced that formulates tiling as an optimization problem using a build cost model to minimize dynamic memory allocation transfers, allowing for flexible tile shapes and accommodating both static and dynamic loop bounds and data shapes, with a focus on minimizing host-device and device-host data transfers within cache constraints.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If tiling is performed to improve data access locality, then data locality is improved, but device complexity increases due to manual DMA insertion requirements

Engineering Contradiction:
Improvedata access localityVSAvoidmanual DMA insertion
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The system performs self-service by automatically inserting DMA operations and computing tile sizes without manual intervention. The build cost model autonomously evaluates computation configurations and determines optimal tiling strategies, eliminating the need for manual DMA insertion while maintaining improved data locality.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system changes parameters by dynamically computing tile sizes based on the build cost model rather than using fixed or manually specified tile sizes. The model evaluates multiple computation configurations with varying tile dimensions and selects the optimal configuration that minimizes data transfer costs while improving data locality.

Inventive Principle:
Principle #35Parameter changes

2Loss of energy

If build cost model evaluation is performed to optimize data transfer cost, then data transfer cost is reduced, but computation time increases

Engineering Contradiction:
Improvedata transfer costVSAvoidcomputation time
Core Design Contradiction:
Loss of energyVSLoss of time

Solution Approach 1:

The system performs preliminary action by pre-computing and caching the build cost model results during the compilation phase. The tile size computation and build cost evaluation are performed ahead of runtime execution, allowing the optimized computation configuration to be applied without incurring the evaluation overhead during actual data processing.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system applies partial action by evaluating only the necessary computation configurations required for the specific computation graph rather than exhaustively searching all possible tile size combinations. The build cost model selectively evaluates configurations based on the specific data access patterns and computational requirements, reducing unnecessary computation time.

Inventive Principle:
Principle #16Partial or excessive action

3Productivity

If tile size is increased to reduce number of DMA instructions, then DMA instruction count is reduced, but cache overflow occurs

Engineering Contradiction:
Improvenumber of DMA instructionsVSAvoidcache capacity
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system implements feedback by using the build cost model to evaluate whether a proposed tile size configuration would exceed cache capacity. The model incorporates cache size constraints and provides feedback to adjust tile sizes accordingly, ensuring that larger tiles reduce DMA instructions without causing cache overflow by continuously monitoring and adapting to cache capacity limitations.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS11656854B2Methods and devices for computing a memory size for software optimization
Publication Date: 2023.05.23 HUAWEI TECH CO LTD
  • US11656854B2 patent drawing
  • US11656854B2 patent drawing
  • US11656854B2 patent drawing

AI summary

There is provided methods and devices for computing a tile size for software optimization. A method includes receiving, by a computing device, information indicative of one or more of a set of loop bounds and a set of data shapes; processing, by the computing device, the information to determine a computation configuration based on the obtained information, the computation configuration implementable by a compiler, said processing including evaluating at least the computation configuration based on a build cost model, the build cost model representative of a data transfer cost and a data efficiency of the computation configuration; and transmitting, by the computing device, instructions directing the compiler to implement the computation configuration.