Measurement-based cache representativeness on multipath programs

Suzana Milutinovic, Jaume Abella, Enrico Mezzetti, Francisco J. Cazorla

Abstract

In safety-critical real-time systems, such as autonomous vehicles and avionics, guaranteeing that software meets strict timing deadlines is paramount. This paper presents a novel methodology that addresses two primary challenges in timing analysis: software path complexity and hardware cache unpredictability. By integrating Path Upper-Bounding (PUB) with Time-aware Address Conflict (TAC) analysis, the authors provide a mathematically sound framework for deriving safe probabilistic Worst-Case Execution Time (pWCET) bounds. The approach ensures that even rare, worst-case cache behaviors and unobserved execution paths are accounted for in final safety estimates.

Introduction

Calculating the Worst-Case Execution Time (WCET) is a cornerstone of safety-critical system design. However, modern systems face a "complexity wall." Software often contains millions of possible execution paths, making exhaustive testing impossible. Simultaneously, hardware features like caches, while improving average performance, introduce significant timing variability. A program's execution time can vary wildly depending on memory mapping and cache hit/miss patterns.

Traditional Measurement-Based Probabilistic Timing Analysis (MBPTA) utilizes Extreme Value Theory to predict worst-case times from test data. However, MBPTA is limited by the representativeness of the test suite; if a slow path or a rare, high-conflict cache layout is never triggered during testing, the resulting WCET estimate will be dangerously optimistic.

Methodology: Integrating PUB and TAC

The researchers propose a unified workflow that integrates two distinct techniques to ensure comprehensive coverage of both software paths and hardware states.

Path Upper-Bounding (PUB)

PUB is a compiler-level transformation that modifies the original program into a "pubbed" version. It inserts dummy memory accesses into shorter execution branches so that every path in the modified program is guaranteed to take at least as long as any path in the original code. This effectively reduces the multi-path problem to a single-path analysis problem for timing purposes.

Time-aware Address Conflict (TAC)

TAC analysis focuses on the hardware side. It examines the sequence of memory addresses accessed by a program and calculates the specific number of test runs ($R$) required to ensure that rare, high-latency cache layouts are observed with a target high probability (e.g., $10^{-9}$).

The Combined Workflow

The core innovation lies in the proof that TAC can be applied directly to the "pubbed" version of a program. By executing the modified program for the number of iterations specified by TAC, engineers can derive a pWCET that safely upper-bounds all possible paths and cache behaviors of the original software.

The integrated PUB and TAC analysis workflow.

Key Insights and Hardware Considerations

A critical enabler for this methodology is the use of hardware with randomized caches (employing random placement and replacement policies). Unlike deterministic caches (e.g., LRU), randomized caches allow for the statistical guarantees necessary for probabilistic analysis.

The researchers also noted a "No Relationship Paradox": a "pubbed" program does not always require more test runs than the original. In some cases, adding memory accesses increases the likelihood of cache conflicts, which actually reduces the number of runs needed to statistically capture the worst-case behavior. This analysis helps identify "timing cliffs"—abrupt jumps in execution time caused by rare cache conflicts—that standard testing might otherwise miss.

Example of code transformation via PUB and the resulting pWCET curve.

Experimental Results

The methodology was evaluated using the Mälardalen benchmark suite on a pipelined in-order processor. Key findings include:

  • Comprehensive Coverage: The method successfully provided safe upper bounds for all paths across a variety of benchmark programs, including complex multi-path code like crc.
  • Discovery of Hidden Paths: In the crc benchmark, the tool identified unobserved paths that were 4.4 times slower than those triggered by standard functional testing.
  • Pessimism vs. Safety: The "price of safety" for using PUB ranged from a 4% to 59% overhead in the WCET estimate compared to known worst-case paths. This overhead represents the trade-off for not needing to manually identify every possible worst-case scenario.
  • Practicality: The entire analysis process took approximately 15 minutes per benchmark, demonstrating its feasibility for integration into industrial engineering workflows.

Limitations and Future Directions

While promising, the approach currently requires specific hardware support for randomized caches, which is not yet ubiquitous in commercial off-the-shelf (COTS) processors. Additionally, the evaluation focused on relatively simple in-order architectures. Future research is needed to extend these techniques to more complex out-of-order processors and to account for the timing interference inherent in multi-core systems.

Summary updated

BibTeX
@inproceedings{milutinovic2018measurement,
  author = {Suzana Milutinovic and Jaume Abella and Enrico Mezzetti and Francisco J. Cazorla},
  title = {{Measurement-based cache representativeness on multipath programs}},
  booktitle = {DAC},
  year = {2018},
  doi = {10.1145/3195970.3196075},
}
Figure