What is Universal?
Universal is a header-only C++ library providing thousands of custom number systems as plug-in replacements of the built-in integer and floating-point types.
With Universal, developing mixed-precision algorithms to maximize performance, improve latency or minimize energy consumption becomes as easy as changing a single line of code.
Quick introduction
The basic use pattern is as simple as:
In summary, parameterize your computational kernel by arithmetic type(s), and dispatch with the type(s) of your choice.
The benefits of mixed-precision algorithm design used to be limited to float/double/long double trade-offs for high-performance computing (HPC) applications, or short/int/long/fixed-point for digital signal processing (DSP) and instrumentation applications. With the Universal library, mixed-precision optimization can now tailor the precision, dynamic range, and even sampling profile of the arithmetic to the requirements of the application.
We frequently observe a 2-4x improvement by simply reducing the memory bandwidth by using smaller operands, i.e. the generalization of the double to float trick. In the examples that follow we will demonstrate that greater gains are feasible. By selecting a custom number system tailored to the application, orders of magnitude improvements in performance and/or energy efficiency are possible.
Let's get started!
Last updated