NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Data Dependence Profiling for Speculative Optimizations

Tong Chen, Jin Lin, Xiaoru Dai, Wei‐Chung Hsu, Pen-Chung YewLecture Notes in Computer Science 2004 · OpenAlex

Abstract

Data dependence analysis is a fundamental component of compiler optimization, yet it remains challenging for languages like C and C++ due to pointer aliasing and dynamic memory. This paper introduces a software-based data dependence profiling tool that provides probabilistic information to guide speculative compiler optimizations. By utilizing shadow memory and sophisticated segment-based sampling, the authors demonstrate that compilers can safely perform aggressive code reordering, achieving performance gains of up to 32% on SPEC benchmarks with manageable profiling overhead.

Introduction

In compiler theory, data dependence analysis is essential for optimization. If a compiler can determine that two instructions do not access the same memory location, it can reorder them or execute them in parallel. While straightforward for simple arrays, this is notoriously difficult for C and C++ due to the heavy use of pointers, shared libraries, and dynamic memory.

Modern hardware, such as Intel’s Itanium (IA64), supports speculative execution, allowing the compiler to "guess" that a dependence doesn't exist and move a load instruction ahead of a potentially conflicting store. However, mis-speculation carries a high recovery cost (around 50 cycles). Static analysis is often too conservative to be useful here. The authors address this by creating a profiler that measures the actual probability of conflicts at runtime, giving the compiler the confidence to speculate when the risk is low.

Methodology

The authors implemented their tool within the Open Research Compiler (ORC). Key technical components include:

  • Shadow Memory: To avoid the $O(n^2)$ complexity of comparing every memory reference, the tool uses a "shadow" data structure. Each memory address maps to a shadow entry storing the ID of the latest load and store to that location, enabling fast $O(1)$ lookups.
  • Context Awareness: The profiler tracks calling contexts and loop distance vectors to distinguish between dependencies within the same iteration versus across different iterations.
  • Efficiency Techniques: Granularity tuning allows multiple bytes to share one shadow entry, while segment-based sampling switches between instrumented and non-instrumented versions of entire procedures or loops to maintain precision without excessive overhead.
Shadow memory mapping mechanism for tracking memory references.

Key Insights and Ideas

Data dependence profiling is presented as superior to standard alias profiling. While alias profiling indicates if two pointers could point to the same block, dependence profiling proves whether they actually overlap during execution. This finer granularity is crucial for array-heavy code.

The researchers found that ignoring dependencies with a probability of less than 2% is a "sweet spot" for Itanium 2, balancing aggressive scheduling gains against the 50-cycle penalty of occasional mis-speculations. Furthermore, the insight that sampling must be done on "program segments" (entire loops or functions) rather than random instructions makes software-based profiling practical for large applications.

Key Results

The approach was evaluated using the SPEC CPU2000 benchmark suite. Profiling was conducted using train input sets, while evaluation used ref sets to ensure generalizability.

Using the profile to guide code scheduling resulted in an average speedup of 8.22%, with the art benchmark seeing a massive 32.34% improvement. The failure rate of speculations guided by the train set remained very low (typically <1%) when running the ref set, proving that data dependence patterns are relatively stable across different inputs.

Performance improvements and speculation failure rates across SPEC benchmarks.

Conclusion

While the authors optimized shadow memory, it still requires a significant memory footprint, suggesting that selecting only "important" loops for profiling is necessary for very large-scale applications. Although software profiling is more flexible than hardware-limited tables, it still incurs a runtime cost. Future work may explore co-processor support or address input sensitivity in programs where dependencies change drastically based on data.

Summary updated

BibTeX
@inproceedings{chen2004data,
  author = {Tong Chen and Jin Lin and Xiaoru Dai and Wei‐Chung Hsu and Pen-Chung Yew},
  title = {{Data Dependence Profiling for Speculative Optimizations}},
  booktitle = {Lecture Notes in Computer Science},
  year = {2004},
  doi = {10.1007/978-3-540-24723-4\_5},
}
Figure