Abstract
Developing efficient and maintainable software systems is both hard and time consuming. In particular, non-functional performance requirements involve many design and implementation decisions that can be difficult to take early during system development. Choices—such as selection of data structures or where and how to parallelize code—typically require extensive manual tuning that is both time consuming and error-prone. Although various auto-tuning approaches exist, they are either specialized for certain domains or require extensive code rewriting to work for different contexts in the code. In this paper, we introduce a new methodology for writing programs with holes, that is, decision variables explicitly stated in the program code that enable developers to postpone decisions during development. We introduce and evaluate two novel ideas: (i) context-sensitive holes that are expanded by the compiler into sets of decision variables for automatic tuning, and (ii) dependency-aware tuning, where static analysis reduces the search space by finding the set of decision variables that can be tuned independently of each other. We evaluate the two new concepts in a system called Miking, where we show how the general methodology can be used for automatic algorithm selection, data structure decisions, and parallelization choices.
Introduction
Software performance often hinges on a multitude of "micro-decisions": Should a developer use a linked list or an array? Should a specific loop be parallelized? Traditionally, developers are forced to commit to these choices early in the development cycle. Optimization then requires manual profiling and tweaking—a process that is tedious, error-prone, and fails to scale as system complexity grows. While auto-tuners offer a potential solution, they frequently struggle with context-insensitivity (assigning global values regardless of call site) and the "curse of dimensionality," where the search space grows exponentially with the number of choices.
Methodology
Context-Sensitive Holes
The core of the proposed methodology is the "hole," a placeholder for a decision variable. Unlike static values, these holes are context-sensitive, meaning their optimal value can change depending on the call string (the history of function calls). To implement this efficiently without the overhead of full stack traces, the authors utilize a graph coloring technique. This allows the compiler to expand a single hole into multiple decision variables tailored to specific execution contexts.
Dependency-Aware Tuning
To combat the search space explosion, the authors introduce static dependency analysis using a modified 0-CFA (Control Flow Analysis). By determining which holes affect specific "measuring points" in the program, the tuner can identify independent sub-problems. If Hole A and Hole B do not interact, they can be tuned separately rather than in combination, drastically reducing the total number of configurations to test.
Evaluation and Results
The methodology was evaluated within the Miking framework across three case studies: a $k$-Nearest Neighbor ($k$-NN) classifier, a probabilistic programming framework, and the Miking compiler itself.
Key findings include:
- Search Space Reduction: In the $k$-NN study, dependency analysis reduced the configurations to test by 83% (from 216 to 36). In the large-scale Miking compiler, the theoretical search space was slashed from $2^{2309}$ to $2^{816}$.
- Performance Speedups: The tuned $k$-NN program achieved speedups between 3x and 1500x compared to worst-case manual configurations. In the probabilistic programming example, the tuner discovered an optimal "Rope" data structure configuration that yielded a 1.96x speedup over the baseline.
Conclusion
By allowing developers to postpone implementation decisions through context-sensitive holes, this methodology shifts the burden of optimization from the human to the compiler. The combination of graph-based context tracking and dependency-aware pruning makes auto-tuning practical even for complex, large-scale software systems, ensuring high performance without sacrificing developer productivity.
Summary updated