Developer and User-Transparent Compiler Optimization for Interactive Applications

Paschalis Mpeis, Pavlos Petoumenos§, Kim Hazelwood, Hugh Leather

University of Edinburgh, University of Manchester§, Facebook AI Research

2021, Programming Language Design and Implementation (PLDI'21)

1. Transparent online captures

Initially we detect Android-code regions that can be accurately replayed and worth optimizing. On subsequent invocations, we transparently capture real user inputs for them.

2. Offline replays

Then, we use offline replays as a means of evaluating different code transformations on the captured input. Our replay mechanism works in the presence of memory-shuffling security mechanisms. By executing this offline we can hide crashes or slow evaluations from the users, and perform dynamic profiling for futher optimization, through interpretation, that would have been too costly to do online.


Replay-based iterative compilation

By fusing the replay-based evaluation mechanism with iterative compilation, we are able to identify better optimization flags to compile an application for a particular input, without experimenting directly on the users. We evaluate each flag by replaying the real-user inputs we captured earlier. This ensures that our comparisons are sound and that our findings are representative of real user usage. With our novel LLVM Backend for the Android compiler we significantly increase the optimization space for Android applications. Once a mobile device becomes idle and charged, we search through this now-huge space using a genetic algorithm.

Results

UNNOTICEABLE ONLINE OPERATION
By reporposing kernel mechanisms, our infrequent captures remain unnoticeable by the users.

SMALL STORAGE FOOTPRINT
We can easily fit multiple captures of different applications even on low-end devices.

PERFORMANCE IMPROVEMENTS
For the above, almost imperceptible overheads, we achieve impressive results!