RFlow

,

TUD – RFlow: MLIR-based Compiler Framework for the Reactor Model

ID: R20 Licence:
To be defined
Owner:
TUD
Contacts:
jiahong.bi@tu-dresden.de
Short DescriptionA modern compiler framework for the Reactor model, built on the MLIR dialects rflow and qsrir, with a Rust-based frontend and a microcontroller backend.
Key features– A compiler built on the Reactor model, independent from the Lingua Franca toolchain.
– MLIR dialects for application representation and static scheduling.
– Rust-based frontend and a C backend.
Require– MLIR (Multi-Level Intermediate Representation).
– Rust with the pest parser.
– Lingua Franca µC runtime.
ProvideAn MLIR-based implementation of the reactor dataflow model.
InputLingua Franca program.
OutputReady-to-compile files linked with the reactor-µC runtime.
UserDevelopers.
Benefits for the userModern and fast compilation compared to the Lingua Franca toolchain.
Position in the MYRTUS DPEStandalone project, in the same MLIR ecosystem as the DPE.
TRL@M01-2
TRL@M364-5

General description


This is a modern compiler framework for the Reactor model. It builds on the model directly rather than on Lingua Franca, and is independent of the Lingua Franca compiler and its development environment. Lingua Franca is supported as an input language for compatibility with existing code, but nothing in the framework is tied to it. The framework rests on two new MLIR dialects. rflow makes the dependencies and interconnections of a reactor application explicit, which opens it to dataflow analysis and to efficient scheduling of the independent components. qsrir takes the scheduling decisions out of the runtime, where a dynamic reactor pays for maintaining an event queue and resolving dependencies while the program runs, and resolves them at compile time instead. A Rust-based frontend reads reactor applications written in Lingua Franca, and the backend emits C files with macros [1] for microcontrollers using reactor-µc [2].

Role in the MYRTUS DPE


This is a standalone project, not part of the DPE compilation flow, and was not required by the MYRTUS use cases. It was developed independently, but as an MLIR-based framework it fits into the same ecosystem: the Reactor model brings explicit time semantics, which the dialects in the DPE do not provide, so rflow and qsrir are a natural extension of the DPE for time-sensitive applications at the edge.

MYRTUS Extension/Contribution


A programming abstraction that supports adaptability and models reactive behaviour, based on the Reactor model which underlies Lingua Franca. Early in the project we decided to make this independent of the syntax, since at the time it was unclear what the preferred language would be for the critical parts of the use cases. The dialects are therefore not tied to any particular surface syntax, and Lingua Franca is supported first simply because it is the language in which reactor applications exist today. The contribution during MYRTUS was to define the intermediate dialects themselves: rflow for the application graph and the semantics of the model of computation, qsrir for its static schedule. Defining them in MLIR is what allows interoperability with other higher-level programming abstractions stemming from DSLs and with downstream compilation flows, and keeps the abstraction open to distributed and federated execution.

Technology Benefits and Innovations


The Reactor model gives a program explicit time semantics and deterministic concurrency, but the cost of that guarantee is normally paid at run time, where a dynamic runtime maintains an event queue and resolves the dependencies between reactions as the program executes. On a microcontroller this overhead is hard to justify. The framework moves the work to compile time instead. Because rflow makes the dependencies and interconnections explicit in the IR, the schedule can be derived statically and expressed in the qsrir dialect, and what reaches the device is C code with the scheduling decisions already made. Building this on MLIR rather than inside a language toolchain is what keeps the result reusable: the dialects are not tied to any surface syntax, so other frontends and downstream flows can plug into the same representation.

Users


The expected users are developers of reactive and time-sensitive applications, in particular those targeting microcontrollers, who want the determinism of the Reactor model without the runtime cost it usually brings.

Application Domains


The Reactor model targets reactive applications with timing requirements. Nothing in the framework restricts it to a particular domain, since any application expressible as reactors can be compiled through it. It was not applied in the MYRTUS use cases, and the framework was developed during MYRTUS rather than taken over from an earlier project.

References


  • [1] T. Tanneberger, E. R. Jellum, J. Castrillon, E. A. Lee, “Macros as Abstractions: Simplifying Code Generation for Lingua Franca”, in Proc. Time-Centric Reactive Software Workshop (TCRS’26), IEEE, 2026.
  • [2] reactor-µc: github.com/lf-lang/reactor-uc
Competenze

Postato il

10 Novembre 2026