Strange Loop

Leveraging DSLs (Almost) for Free

Advances in domain-specific languages (DSLs) have enabled developers build efficient applications across many different disciplines (e.g., Spark for data analytics, CUDA for GPUs, etc). To leverage such DSLs, however, programmers need to learn new abstractions and rewrite their existing applications to leverage the optimizations offered by such languages. For developers, this is a tedious, error-prone job; for DSL designers, this hinders uptake of their language.

I will discuss how to build compilers that translate general-purpose languages to DSLs (almost) for free, using a technique called verified lifting. Unlike traditional compilers that rely on detecting patterns in the input code and translating them to the target language, verified lifting automatically discovers, or "lifts," a clean functional spec from the input code. The discovered spec, written in a high-level functional language, is proven to be equivalent to the input code, and can be easily translated to the target. With verified lifting, DSL designers only need to describe their DSL constructs using our spec language, and our framework will handle the rest. We have applied verified lifting in various domains: lifting Java to SQL (orders of magnitude speedup), Fortran to CUDA (20x speedup), Java to Spark (30x speedup), all done without writing a single rule to detect code patterns. Our compilers are released and I will describe the Metalift framework for DSL designers to build compilers using verified lifting.

Alvin Cheung

Alvin Cheung

University of Washington

I am an assistant Professor of Computer Science at the University of Washington, affiliated with the database and programming languages and software engineering research groups. My research focuses on designing new and applying programming systems techniques to solve system and end-user programming problems. My group has applied such techniques to database applications, compiler construction, and programmable network hardware. Our work has been published in various academic conferences with code released to the open source.