Neural Network Program Sampling via Graph Embeddings
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current program sampling methods, such as SimPoint, are inefficient as they fail to capture data dependency and block-level similarity, leading to inaccurate representation of execution phases and inability to generalize across applications due to reliance on Basic Block Vectors that ignore data values and block connectivity.
Innovation Solution
A neural-network-based program sampling method using Graph Neural Networks (GNNs) that constructs code graphs from assembly code, generates graph snapshots incorporating dynamic states, and clusters execution embeddings to select representative intervals for execution, capturing data flow, control flow, and memory access patterns.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of time
If program sampling divides execution into intervals and samples representative sections, then simulation time is reduced, but measurement precision of execution phase representation deteriorates
Solution Approach 1:
The patent replaces traditional mechanical program sampling methods (which divide code into basic blocks and use static analysis) with a neural network-based system. The neural network learns execution phase representations from dynamic execution traces and code graphs, substituting the mechanical division approach with a learning-based approach that captures data dependencies and block-level similarities more accurately, thereby maintaining precision while reducing simulation time.
Solution Approach 2:
The patent changes the parameters used for program sampling from static basic block vectors to dynamic neural network embeddings. By transforming the representation parameters from simple vector counts to complex neural network features that incorporate execution traces and data flow information, the system achieves better execution phase representation accuracy while still enabling efficient sampling and reduced simulation time.
2Device complexity
If Basic Block Vectors are used for program sampling, then device complexity is reduced, but loss of information about data dependency and block connectivity increases
Solution Approach 1:
The patent implements a nested structure where execution traces are embedded within code graphs, which are then processed by neural networks to generate embeddings. This nested approach allows the system to incorporate multiple levels of information (basic block execution traces, control flow graphs, data flow relationships) without significantly increasing external complexity, as the nested structures are efficiently processed by the neural network architecture.
Solution Approach 2:
The patent introduces neural network embeddings as an intermediary between the raw code and execution traces and the program sampling decision. This intermediary transforms complex information about data dependencies and block connectivity into compressed vector representations that retain essential information while being suitable for clustering and sampling operations, thus reducing information loss without proportionally increasing system complexity.
3Measurement precision
If entire benchmark programs are executed on simulators, then measurement precision of performance metrics is improved, but loss of time increases significantly
Solution Approach 1:
The patent performs preliminary actions by using neural networks to analyze execution traces and identify representative execution phases before actual simulation. By pre-processing the benchmark programs to extract and cluster execution phases using neural network embeddings, the system prepares a condensed set of representative sections that can be simulated with high precision but in significantly reduced time, thus resolving the contradiction between measurement precision and execution time.
Data Source
AI summary
This application describes methods, systems, and apparatus, for neural network-based program sampling (NPS). An example device may obtain an assembly code of a program and an execution trace of the program, and divide the assembly code into a plurality of execution intervals. The device may construct a plurality of code graphs respectively corresponding to the plurality of execution intervals, and for each of the plurality of code graphs: generate a plurality of graph snapshots based on the code graph and the execution trace of the program; embed, by using a Graph Neural Network, the plurality of graph snapshots into a plurality of vectors; and aggregate the plurality of vectors into an execution embedding. The device may cluster the plurality of execution embeddings into a plurality of clusters and select representative execution intervals of the program based on the plurality of clusters for execution.


