Abstract
Neural Program Sampling (NPS) is a novel framework that leverages Graph Neural Networks (GNNs) to identify representative execution slices for hardware simulation. By replacing traditional Basic Block Vector (BBV) methods with high-resolution execution embeddings, NPS captures program semantics and data flow more effectively. Evaluation on SPEC2006 benchmarks demonstrates that NPS reduces sampling errors by an average of 38% compared to the industry-standard SimPoint, while significantly reducing the need for manual parameter tuning.
Introduction
Microprocessor design relies heavily on cycle-level simulators to evaluate new hardware features. However, the extreme slowness of these simulators—where a single real-world application might take years to simulate fully—necessitates the use of program sampling. Engineers select small, representative intervals, known as simulation points, to approximate total program behavior.
For two decades, SimPoint has been the industry standard, utilizing Basic Block Vectors (BBVs) to cluster program intervals. However, BBVs are essentially frequency histograms that lack structural context, ignoring instruction semantics and data dependencies. This limitation often leads to instability in fine-grained simulations, requiring extensive manual tuning by engineers to achieve acceptable accuracy.
Methodology: Neural Program Sampling (NPS)
NPS addresses the limitations of frequency-based sampling by treating program execution as a dynamic graph problem. The framework transitions from simple block counting to generating rich "execution embeddings" that encapsulate the program's logic and state.
AssemblyNet Architecture
At the heart of NPS is AssemblyNet, a GNN designed to represent assembly code as a graph. In this model, nodes represent instructions, operations (e.g., arithmetic, memory loads), and variables (registers or memory locations), while edges encode control flow and data flow.
Self-Supervised Learning via Data Prefetching
To ensure the GNN understands program behavior, it is trained on a data prefetch task. The model must predict future memory addresses the program will access. To succeed, the network must internally learn to resolve branches and track data dependencies, effectively mimicking the logic of a physical microprocessor.
Sampling Pipeline
During execution, NPS captures dynamic "graph snapshots" of the program state, including the program counter (PC), register values, and memory contents. These snapshots are processed by AssemblyNet to produce high-dimensional embeddings. Finally, these embeddings are clustered using a standard K-means algorithm to identify the most representative simulation points.
Experimental Setup
The framework was evaluated using the SPEC2006 Integer benchmark suite. The GNN was trained on 200 million instructions and validated against hundreds of billions of instructions across 12 applications, including gcc, perlbench, and bzip2. Performance validation was conducted using the gem5 simulator, calibrated to Intel Haswell and Skylake CPU architectures.
Key Results
NPS consistently outperformed SimPoint across all tested benchmarks. The average Mean Absolute Percentage Error (MAPE) was reduced from 11% to 6.8%, representing a 38% improvement in accuracy.
In specific cases, such as 483.xalancbmk, the error reduction reached as high as 63%. Furthermore, NPS demonstrated superior robustness across different hardware architectures and sampling granularities. While SimPoint's accuracy often degrades at smaller simulation intervals (e.g., 1M instructions), NPS maintains high precision, providing a more stable foundation for hardware-software co-design.
Conclusion and Future Work
NPS represents a significant leap in program sampling by replacing heuristic-based block counting with deep learning-based execution embeddings. While generating these embeddings is more computationally intensive than traditional methods, the overhead is offset by the elimination of months of manual engineering effort. Future research will explore extending this graph-based representation to handle complex floating-point operations and SIMD extensions.
Summary updated