Machine Learning Compiler With Proxy-Input Traces for Variable-Shape Tensors
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing machine learning compilers are inefficient and lack the ability to handle tensor inputs and operations with varying sizes, shapes, and types, leading to increased runtime overhead and complexity in machine learning applications.
Innovation Solution
A compiler that generates execution traces using proxy inputs to handle tensor operations, replaces primitive operations with executor fusions, and optimizes traces statically, allowing for faster and more efficient execution on hardware accelerators.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If existing machine learning compilers are used to handle tensor operations with varying sizes, shapes, and types, then the compiler must process and adapt to these variations dynamically, but this leads to increased runtime overhead and reduced execution efficiency
Solution Approach 1:
The compiler performs preliminary analysis and code generation during the compilation phase, creating specialized code for specific tensor configurations before runtime. This includes analyzing tensor operations, generating intermediate representations, and optimizing code paths in advance, so that during execution the pre-optimized code can be directly utilized without dynamic adaptation overhead
Solution Approach 2:
The compilation process is segmented into distinct phases: initial code generation, trace collection, and optimization passes. Each phase handles specific aspects of tensor operation optimization independently, allowing the system to manage complex tensor variations through systematic breakdown rather than monolithic dynamic processing
2Productivity
If the compiler generates optimized execution traces for hardware accelerators, then execution speed improves, but the complexity of the compilation process increases
Solution Approach 1:
The compiler introduces intermediate representations (IRs) as intermediary forms between the source code and optimized execution traces. These IRs serve as intermediate stages that capture program semantics while enabling systematic optimization transformations. The multi-stage compilation process uses these intermediates to bridge the gap between high-level code and hardware-specific optimizations without requiring the entire compilation process to be simultaneously complex
Solution Approach 2:
The compiler performs preliminary code generation to create initial execution traces that capture the essential computational workflow. These preliminary traces are then subject to subsequent optimization passes that refine them for hardware accelerator execution. This staged approach allows complexity to be managed incrementally rather than all at once
3Ease of manufacture
If the compiler uses proxy inputs to generate execution traces, then the traces can be generated without actual data values, but the precision and accuracy of trace generation may be compromised
Solution Approach 1:
The compiler creates proxy inputs that are structural copies of actual inputs, preserving the shape, type, and operational characteristics without containing actual data values. These proxy copies enable the trace generation process to proceed with synthetic data that mimics the behavior of real data, allowing the compiler to generate accurate execution traces based on operational patterns rather than specific data contents
Solution Approach 2:
Proxy inputs serve as intermediary entities between the trace generation process and actual data inputs. They enable the compiler to analyze and generate traces based on operational semantics without being constrained by specific data values, thereby maintaining accuracy in trace generation while facilitating ease of compilation
Data Source
AI summary
In variants, a program optimization method can include: receiving a program; determining a set of proxy inputs for the program; generating a set of intermediate traces for the program; and generating a set of execution traces for the program, wherein the set of execution traces can include executor fusions associated with device kernels for hardware accelerators. During runtime, program results can be computed by executing an execution trace instead of executing the program.


