Table of Contents
Fetching ...

An Intermediate Program Representation for Optimizing Stream-Based Languages

Jan Baumeister, Arthur Correnson, Bernd Finkbeiner, Frederik Scheerer

TL;DR

The paper addresses the performance gap in runtime stream-based monitoring by introducing StreamIR, a general intermediate representation tailored for stream specifications like RTLola. It provides translation from RTLola to StreamIR, along with a set of rewrite rules and a memory model to enable static optimizations before code generation. The authors implement an interpreter and compilers to Rust and Solidity, leveraging JIT for StreamIR and demonstrating substantial runtime and gas savings over native RTLola interpretation and straightforward compilation. The approach shows that StreamIR optimizations yield significant performance gains, especially for parameterized streams, and the framework is designed to be extensible to other stream-based languages beyond RTLola.

Abstract

Stream-based runtime monitors are safety assurance tools that check at runtime whether the system's behavior satisfies a formal specification. Specifications consist of stream equations, which relate input streams, containing sensor readings and other incoming information, to output streams, representing filtered and aggregated data. This paper presents a framework for the stream-based specification language RTLola. We introduce a new intermediate representation for stream-based languages, the StreamIR, which, like the specification language, operates on streams of unbounded length; while the stream equations are replaced by imperative programs. We developed a set of optimizations based on static analysis of the specification and have implemented an interpreter and a compiler for several target languages. In our evaluation, we measure the performance of several real-world case studies. The results show that using the StreamIR framework reduces the runtime significantly compared to the existing StreamIR interpreter. We evaluate the effect of the optimizations and show that significant performance gains are possible beyond the optimizations of the target language's compiler. While our current implementation is limited to RTLola, the StreamIR is designed to accommodate other stream-based languages, enabling their interpretation and compilation into all available target languages.

An Intermediate Program Representation for Optimizing Stream-Based Languages

TL;DR

The paper addresses the performance gap in runtime stream-based monitoring by introducing StreamIR, a general intermediate representation tailored for stream specifications like RTLola. It provides translation from RTLola to StreamIR, along with a set of rewrite rules and a memory model to enable static optimizations before code generation. The authors implement an interpreter and compilers to Rust and Solidity, leveraging JIT for StreamIR and demonstrating substantial runtime and gas savings over native RTLola interpretation and straightforward compilation. The approach shows that StreamIR optimizations yield significant performance gains, especially for parameterized streams, and the framework is designed to be extensible to other stream-based languages beyond RTLola.

Abstract

Stream-based runtime monitors are safety assurance tools that check at runtime whether the system's behavior satisfies a formal specification. Specifications consist of stream equations, which relate input streams, containing sensor readings and other incoming information, to output streams, representing filtered and aggregated data. This paper presents a framework for the stream-based specification language RTLola. We introduce a new intermediate representation for stream-based languages, the StreamIR, which, like the specification language, operates on streams of unbounded length; while the stream equations are replaced by imperative programs. We developed a set of optimizations based on static analysis of the specification and have implemented an interpreter and a compiler for several target languages. In our evaluation, we measure the performance of several real-world case studies. The results show that using the StreamIR framework reduces the runtime significantly compared to the existing StreamIR interpreter. We evaluate the effect of the optimizations and show that significant performance gains are possible beyond the optimizations of the target language's compiler. While our current implementation is limited to RTLola, the StreamIR is designed to accommodate other stream-based languages, enabling their interpretation and compilation into all available target languages.
Paper Structure (4 sections, 2 figures)

This paper contains 4 sections, 2 figures.

Figures (2)

  • Figure 1: RTLola specification checking whether a drone reaches new waypoints within 10 seconds.
  • Figure 2: An evaluation of the RTLola specification from \ref{['fig:example:spec']}.