Workload-Oriented Constant Propagation in Compilers
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional constant propagation strategies struggle to effectively utilize workload information at compile time, leading to code explosion and inefficiencies in optimizing performance-critical kernel procedures, especially in deep convolutional neural networks, due to limitations in considering constants across deep call stacks and hardware resource optimization.
Innovation Solution
The implementation of workload-oriented constant propagation using a compiler directive to identify workload control variables, add workload flags to static single assignment graphs, and utilize an M-level lattice with depth-first search to trace constant footprints, allowing for more efficient optimization and specialization of kernel procedures across multiple hardware platforms.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If conventional constant propagation strategies are used to optimize kernel procedures, then compilation simplicity is maintained, but optimization effectiveness deteriorates due to inability to utilize workload information and deep call stack constants
Solution Approach 1:
The patent segments the constant propagation process into two distinct phases: (1) a worklist-based constant propagation for standard cases, and (2) a depth-first search-based constant propagation specifically for workload control variables. This segmentation allows the compiler to apply the more complex DFS approach only where needed (for workload variables) while maintaining the simpler worklist approach for other constants, thereby improving optimization effectiveness without uniformly increasing compiler complexity across all constant propagation scenarios.
Solution Approach 2:
The patent performs preliminary identification of workload control variables before the constant propagation process begins. By pre-marking these variables and preparing the depth-first search structure in advance, the compiler can efficiently propagate constants along workload variable footprints without requiring complex runtime analysis, thus improving optimization effectiveness while keeping the overall compiler complexity manageable through advance preparation.
2Loss of information
If procedure integration is applied to consider constants across deep call stacks, then constant propagation completeness is improved, but code explosion occurs
Solution Approach 1:
The patent extracts and propagates constant information along the footprints of workload control variables without performing full procedure integration. By taking out only the necessary constant information related to workload variables and propagating it through the call stack using depth-first search, the compiler achieves constant information completeness for critical parameters without integrating entire procedures, thereby avoiding code explosion while maintaining completeness for workload-related constants.
Solution Approach 2:
The patent applies partial constant propagation by focusing only on workload control variables and their associated constants rather than propagating all possible constants through the entire call stack. This partial action approach provides sufficient constant information for optimization purposes without the excessive code duplication that would result from complete procedure integration, thus balancing information completeness with code volume management.
3Productivity
If workload constants are passed directly for optimization, then performance is improved, but adaptability to changing workloads deteriorates
Solution Approach 1:
The patent implements a dynamic constant propagation system that operates at compile time to identify and propagate workload constants, but does so in a way that preserves the ability to adapt to changing workloads. By using depth-first search to trace constant footprints and propagate constants conditionally based on workload variable analysis, the compiler generates optimized code for specific workload scenarios while maintaining the flexibility to recompile with different workload parameters, thus achieving both performance improvement and workload adaptability through dynamic compilation strategies.
Data Source
AI summary
An embodiment of a semiconductor package apparatus may include technology to identify workload control variables, add workload flags to respective edges in a static single assignment graph, and propagate constants based on the identified workload control variables and the workload flags. Other embodiments are disclosed and claimed.


