Language Support for Adaptation: Intent-Driven Programming in FAST

Yao-Hsiang Yang, Adam Duracz, Ferenc A. Bartha, Ryuichi Sai, Ahsan Pervaiz, Saeid Barati, Dung Nguyen, Robert Cartwright, Henry Hoffmann, Krishna V. PalemarXiv 2019 · OpenReview

TL;DR

This paper introduces FAST, an "intent-driven programming" model that allows programs to dynamically adapt their behavior based on user-defined goals (intents) and changing environmental conditions. By extending the Swift programming language, FAST enables developers to specify not just what a program should do, but how it should adapt to optimize for various metrics like performance, energy, or accuracy, making adaptive software development more accessible and robust.

What Problem Does This Paper Address?

Traditionally, programming language semantics define a program's meaning solely by its input-output behavior, making applications oblivious to the underlying hardware or software platform's limitations and performance characteristics. While self-adaptive applications have emerged, they often lack a general, language-level mechanism for specifying adaptive behavior. Existing systems are rigid, focusing on specific adaptation goals (like energy constraints) and offering limited ways to define desired behavior. This paper addresses the need for a flexible, general-purpose programming model that treats adaptation goals as first-class citizens, allowing dynamic adjustments to both the program's behavior and the adaptation strategy itself.

Methods

The core innovation is the intent-driven programming model. This model extends traditional programming languages with:

  • Knobs: These are program variables or configuration parameters that the runtime can dynamically modify to influence the program's behavior. They can be platform-specific (e.g., CPU frequency) or application-specific (e.g., algorithm choice, precision).
  • Measures: These are observable aspects of the application or system state (e.g., latency, output quality, energy consumption) that provide feedback to the runtime.
  • Intents: These are specifications of desired program behavior, expressed as constrained optimization problems. An intent defines an objective function (what to optimize, e.g., minimize energy) and a constraint (a target for a specific measure, e.g., performance must be at least X).

The FAST architecture implements this model as an extension of Swift. It includes:

  • A Library API for developers to instrument their code by defining knobs and measures.
  • An Intent Specification Compiler that translates user-defined intents into an efficient runtime representation.
  • A Profiler that collects statistics on measures.
  • A Controller that uses the intent, profiler data, and a model of the system's behavior to compute and apply knob settings, thereby adapting the program's execution.

A key feature is the dynamic nature of intents and knob configurations, allowing adaptation without recompilation.

Datasets

Not discussed in the paper. The paper focuses on a programming model and architecture, evaluated using example applications.

Key Insights and Ideas

  • Adaptation as a First-Class Concept: Treating "intents" (goals and constraints) as explicit language constructs, rather than implicit system behaviors, fundamentally changes how adaptive software is designed and reasoned about.
  • Dynamic Reconfiguration is Crucial: The ability to change both the adaptation goal (intent) and the available adaptation parameters (knobs) during runtime without recompilation is a significant advantage over static autotuning.
  • Bridging Procedural and Feedback Control: FAST allows for a hybrid approach where developers can use traditional procedural control (e.g., if statements) alongside automated feedback-driven adaptation, offering fine-grained control.
  • Cost Semantics for Adaptive Programs: The paper introduces "asymptotic cost semantics" to formally reason about the long-term behavior and average cost of adaptive programs, which is essential for understanding and verifying their performance.
  • Static Analysis for Robustness: Identifying "unused," "uncaptured," and "unaffected" knobs through static analysis helps catch common programming errors early in the development cycle, improving the reliability of adaptive applications.

Key Results

The paper demonstrates FAST's effectiveness through experiments on three example applications (x264 video encoder, SAR signal processing, and Jacobi iterative method).

  • Outperforms Oracles: FAST consistently achieved better quality than Oracle A (a baseline non-adaptive system) and performed on par with or better than Oracle B (an ideal adaptive behavior model) in terms of quality, while meeting performance constraints.
  • Dynamic Adaptation: Experiments showed FAST successfully adapting to changes in intent (e.g., demanding higher quality for specific periods) and environmental conditions, often outperforming static configurations.
  • Minimal Code Changes: Incorporating complex adaptive capabilities, like restricting knob ranges for specific input periods, required only a few API calls, highlighting usability.
  • Scalability: The model and architecture are shown to be applicable to applications of varying sizes, from a few hundred to over 100,000 lines of code.

Limitations and Future Work

  • Formal Verification: While the paper introduces cost semantics, a full treatment of testing and verification for intent-driven programs is still an open area.
  • Composable Intents: Future work includes extending the language with richer, composable syntax for multi-objective and multi-constraint intents.
  • Generalizing Knobs/Measures: Supporting additional knob kinds (e.g., dense ordinals) and generalizing concepts to include input features is planned.
  • Runtime Extensions: Active profiling and more sophisticated controller models are areas for future development.
  • Statistical Assurance: Leveraging statistical information in the runtime to monitor and predict violations of more general assurance criteria is a key future direction.

Summary updated

Abstract

Historically, programming language semantics has focused on assigning a precise mathematical meaning to programs. That meaning is a function from the program's input domain to its output domain determined solely by its syntactic structure. Such a semantics, fosters the development of portable applications which are oblivious to the performance characteristics and limitations (such as a maximum memory footprint) of particular hardware and software platforms. This paper introduces the idea of intent-driven programming where the meaning of a program additionally depends on an accompanying intent specification expressing how the ordinary program meaning is dynamically modified during execution to satisfy additional properties expressed by the intent. These include both intensional properties---e.g., resource usage---and extensional properties---e.g., accuracy of the computed answer. To demonstrate the intent-driven programming model's value, this paper presents a general-purpose intent-driven programming language---called FAST---implemented as an extension of Swift. FAST consists of an intent compiler, a profiler, a general controller interface and a runtime module which supports interoperation with legacy C/C++ codes. Compared to existing frameworks for adaptive computing, \FAST{} supports dynamic adaptation to changes both in the operating environment and in the intent itself, and enables the mixing of procedural control and control based on feedback and optimization.
BibTeX
@misc{yang2019language,
  author = {Yao-Hsiang Yang and Adam Duracz and Ferenc A. Bartha and Ryuichi Sai and Ahsan Pervaiz and Saeid Barati and Dung Nguyen and Robert Cartwright and Henry Hoffmann and Krishna V. Palem},
  title = {{Language Support for Adaptation: Intent-Driven Programming in FAST}},
  year = {2019},
  eprint = {1907.08695},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1907.08695},
}

Loading related content...

Figure