Computation Graph Kernel Fusion for GPU Execution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing machine learning frameworks face inefficiencies in executing computation graphs due to eager execution of operations, which prevents optimizations across operations and requires significant reimplementation to port applications to different architectures like GPUs and CPUs, limiting the use of GPUs in machine learning applications.

Innovation Solution

A methodology that combines operations across stages of a computation graph to generate specialized code for execution on GPUs and CPUs, allowing for efficient execution and optimization without significant changes to existing frameworks, by representing nodes as data structures and traversing them to form kernels of operations that can be executed on various architectures.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If operations in computation graphs are executed eagerly (one by one), then the execution is simple to implement, but the execution efficiency is low and optimizations across operations cannot be performed

Engineering Contradiction:
Improveease of implementationVSAvoidexecution efficiency
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

The system performs preliminary analysis of the computation graph to identify fusion opportunities before execution. By pre-processing the graph to detect compatible operations and prepare fusion plans, the system enables efficient parallel execution without sacrificing implementation simplicity. This preliminary preparation allows the runtime system to execute fused operations optimally.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The invention introduces an intermediary layer (the fusion analysis system) between the computation graph definition and execution. This intermediary automatically analyzes operation compatibility, generates fusion plans, and transforms the graph without requiring changes to the original eager execution model or user code, thus maintaining ease of implementation while achieving optimization.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Productivity

If operations are fused across different stages of the computation graph, then execution efficiency is improved, but the code complexity increases

Engineering Contradiction:
Improveexecution efficiencyVSAvoidcode complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The fusion analysis is segmented into distinct phases: graph traversal to identify operation sequences, compatibility analysis to determine fusion feasibility, and code generation to produce optimized kernels. This segmentation manages complexity by breaking down the fusion process into manageable, independent steps that can be implemented and maintained separately.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs self-service by automatically analyzing the computation graph and generating fusion code without requiring manual intervention or complex configuration from developers. The fusion analysis system autonomously identifies optimization opportunities and produces the necessary code transformations, keeping the implementation complexity contained within the optimization layer rather than propagating to user code.

Inventive Principle:
Principle #25Self-service

3Productivity

If machine learning applications are ported to GPUs, then performance is significantly improved, but significant reimplementation effort is required

Engineering Contradiction:
ImproveperformanceVSAvoidreimplementation effort
Core Design Contradiction:
ProductivityVSEase of manufacture

Solution Approach 1:

The fusion analysis system provides a universal interface that works across different computing architectures (CPU, GPU, and other accelerators). By analyzing the computation graph in a architecture-agnostic manner and generating code that can be targeted to multiple backends, the system enables porting to GPUs without requiring significant reimplementation. The same fusion analysis infrastructure serves multiple architecture types.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The system creates a copy of the computation graph for analysis purposes, allowing the fusion analysis to operate on this analytical copy while the original graph remains unchanged. This copying approach enables the generation of optimized GPU code from the same source computation graph without modifying the original application code, thus achieving porting with minimal reimplementation effort.

Inventive Principle:
Principle #26Copying

4Productivity

If computation graphs are optimized for specific architectures, then execution performance on that architecture is improved, but the system loses adaptability to other architectures

Engineering Contradiction:
Improveexecution performanceVSAvoidarchitecture adaptability
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The fusion analysis system is designed to be dynamic and configurable, allowing it to adapt its analysis and code generation strategies based on the target architecture. The system can adjust fusion criteria, kernel generation approaches, and optimization techniques depending on whether the target is CPU, GPU, or other accelerators, thus maintaining both specialized performance optimization and broad architecture adaptability.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS20230259340A1Execution of computation graphs
Publication Date: 2023.08.17 NVIDIA CORP
  • US20230259340A1 patent drawing
  • US20230259340A1 patent drawing
  • US20230259340A1 patent drawing

AI summary

A computation graph is accessed. In the computation graph, operations to be performed are represented as interior nodes, inputs to the operations are represented as leaf nodes, and a result of the operations is represented as a root. Selected sets of the operations are combined to form respective kernels of operations. Code is generated execute the kernels of operations. The code is executed to determine the result.