Just this year, at the International Conference on Programming Language Design and Implementation, a group of scientists from MIT’s Computer Science and Artificial Intelligence Laboratory (CSAIL) and UC Berkeley, published a paper titled, “Exocompilation for Productive Programming of Hardware Accelerators.” In it, they propose Exo, a new programming language.
Since its introduction, the new programming language has garnered a lot of buzz in the developer community.
In this article, we will talk about what we know so far about the Exo programming language, what that means for developers, and what we should look forward to.
Table of Contents
What Is Exo Programming Language?
Exo is an imperative domain-specific programming language embedded within Python. It is designed to assist performance engineers in converting simple programs that define what the developers want to calculate into complex programs capable of executing the same things but with less time and much more efficiently.
It performs as a programming language, an (Exo)compiler, and enables developers to create custom hardware instructions, specialise memories, and accelerator configuration states that are defined in user libraries, even high-performance kernel libraries.
So what sets the Exo programming language apart from the others?
This new programming language is built specifically around the concept of “Exocompilation.” That means, Exo can directly write high-performance code and programming for hardware accelerators. As a result, it is now more convenient for developers.
For most compilers, where the optimisations are automated, it takes longer for performance engineers. This is because you have to do all the steps again when it does the wrong thing—making it helpful and a hindrance, at the same time.
On the other hand, with Exocompilation, performance engineers have more control of the whole process. They are back in the driver’s seat and free to choose which, when, and in what order of optimisations to apply since it is externalised from the compiler.
Exo System Overview
Here are parts of the Exo System you need to take note of:
A lot of things go into the Exo, aside from its programming language. We listed below some parts of its systems to get a better understanding.
Backend Checks: Precision and Memory
Consistent precision is critical for Exo. So backend checks are accomplished before code generation. This is a crucial step to ensure the consistency of data-variable precision types and memory annotation.
This new programming language is designed to generate human-readable C-code that is a syntactic translation of its code. This makes it easier for Exo to integrate with your existing tools and workflows.
There are plenty of benefits to this feature that makes it more convenient for programmers:
- All data values are passed by the pointer
- Windows are compiled into structs that contain both the data pointer and stride values
- Improves downstream analyses and optimisations since all static assertions are translated into compiler-specific optimisation hints
Hardware Targets as Libraries
Instead of a compiler for the backend, programmers can write a library using the Exo programming language to add support for new hardware accelerators. This maximises Exo’s capabilities to target any accelerator or schedule to rewrite a simple program to target an accelerator.
There are two advantages to defining hardware in libraries: Programmers and hardware vendors do not need to go through the hassle of maintaining compiler forks. Two, it is the more cost-efficient way to add support to new hardware.
Normally, hardware accelerators require modelling buffers. These buffers are usually found in special accelerator memories that are pinned to particular address ranges.
In contrast, all Exo buffers reside in the system DRAM and can be managed using standard malloc and are free, by default.
With this new programming language, programmers can use custom memories to change the code generation for buffer alloc, free, and windowing via string interpolation. Plus, they can choose to allow standard reading and writing or disable it.
6 Features Of The Exo Programming Language
So, what do you get out of the Exo programming language and its system? Here are a couple of features that many programmers will like for sure.
There is a distinction between control and data values for this new programming language. Control values, such as int, bool, and size, are affixed and carefully analysed for precision. On the other hand, data values, like the types R, f32, and i8, are floating points or fixed-point numbers stored in scalars or arrays.
Mutable Global Control State
The configuration state is mutable and requires the use of @config to be introduced via structures of variables. This is still in line with Exo’s idea of static control programs, where the new programming language prohibits control values from depending on data values.
Dependently Typed Arrays
Programmers can specify size with the use of control value expression, but only the positive values. After that, Exo performs static bound checks to ensure the memory is safe and will not impact or incur costs during dynamic bounds checks. This feature is only possible with deliberate design to separate control values and data values.
For the Exo programming language, arrays are extended to support the process of windowing or slicing. This creates a window that does not copy data but reads and writes.
Explicit += Reduction Primitives
In addition, the new programming language can reduce primitives, such as primitive reading and writing, via the += syntax as a special commutative.
Lastly, static assertions for control values can now be made at the beginning of procedures, which turns them into pre-conditions and no longer just dynamic tests. In turn, the program analysis recognises this and proceeds as normal.
Final Thoughts On The Exo Programming Language
The introduction of the Exo programming language makes a world of difference for programmers and performance engineers. It makes work more convenient and saves a lot of time.
It is a great tool already and sets itself apart from other compilers. In addition, the researchers of the Exocompilation for Productive Programming of Hardware Accelerators have more updates down the line: multi-core semantics and automatic scheduling.
Want to stay updated? Check out our blogs for the latest news.