This thesis details an emerging class of programming language designs, called user-schedulable languages, that provide a safe and productive performance engineering environment for modern, heterogeneous hardware. The defining trait of user-schedulable languages is the division of program specification into two key parts: the algorithm, which defines functionally what is to be computed, and the schedule, which defines how the computation should be carried out. Importantly, algorithms have semantics independent of any schedule, and schedules are semantics-preserving with respect to the algorithm. Thus, programmers are freed from a large class of bugs. Because algorithm languages tend to be functional and domain-specific, the scheduling language can be very expressive. Existing scheduling languages include many program transformations, from accelerator offloading to tricky tiling and interleaving strategies. Multiple schedules can be written for different sets of hardware targets and can be maintained independently from one another.
Here, we formally analyze the design of an existing and widely deployed user-schedulable language, Halide, and find and correct several serious bugs and design flaws through this analysis. We also detail both the design and implementation of a new user-schedulable language, Exo, whose design is informed by the lessons learned analyzing Halide. Unlike Halide, which models scheduling as a parameter to a monolithic lowering process, Exo uses a rewrite-based scheduling system. This system doubles as an instruction selection process for custom accelerator hardware; importantly, these instructions can be specified in user programs, rather than inside the compiler itself. We then discuss a novel, high-performance, reference-counting memory management strategy suitable for recursive programs with highly non-local control flow over a (co-)inductive data domain. Finally, practical considerations for language design are discussed; these are lessons learned from maintaining and deploying these systems in practice.