Runtime systems cannot do everything, and developing multiple tiers of a single application can be challenging. Metamorph is a developer-facing code generation tool, that bridges the gap between existing ML tools like PyTorch and TensorFlow, and intermittent computing. Further, Metamorph simplifies the development of multitier inference-focused applications for intermittently powered devices
Metamorph wraps existing workflows to provide an automated
way of generating intermittence-safe application code. Utilizing
Metamorph, a developer can iteratively explore different design
points of the application without dealing with underlying code
generation frameworks or worrying about power failures. With
Metamorph, the programmer only specifies different design points,
i.e., the type of code to be generated as well as the number of
layers (for CNNs) and tasks for the application. Based on these inputs, Metamorph automatically generates relevant code by invoking
the right commands with correct compiler flag invocations. Then,
Metamorph parses generated code to extract all functions from the
code and classifies them into two categories.
The first category of functions is specific to each task and has to be tailored according to the inputs and outputs of the task. In contrast, functions belonging to the second category must be performed only once during the application execution. These functions are called either at the start or end of the application. Metamorph first wraps all such functions with appropriate language constructs of Chameleon’s runtime so that they are intermittence safe and identifies data across each task that needs to be saved across reboots. Variables are assigned to a special language construct exposed by Chameleon’s runtime that allocates them in the non-volatile memory (FRAM) while ensuring a copy of these variables is also placed in the SRAM for faster access. These steps are necessary to ensure that the code generated by Metamorph allows safe resumption of code even after power failure and the least number of computations are lost.