Seamless Compiler Integration of Variable Precision Floating Point Arithmetic
Floating Point (FP) units in processors are generally limited to supporting a subset of formats defined by the IEEE 754 standard. As a result, high efficiency languages and optimizing compilers for high performance computing only support IEEE standard types and applications needing higher precision involve cumbersome memory management and calls to external libraries, resulting in code bloat and making the intent of the program unclear. We present an extension of the C type system that can represent generic FP operations and formats, supporting both static precision and dynamically variable precision. We design and implement a compilation flow bridging the abstraction gap between this type system and low level FP instructions or software libraries. The effectiveness of our solution is demonstrated through an LLVM based implementation, leveraging aggressive optimizations in LLVM including the Polly loop nest optimizer, which targets two backend code generators: one for the ISA of a variable precision FP arithmetic coprocessor, and one for the MPFR multi precision floating point library. Our optimizing compilation flow targeting MPFR outperforms the Boost programming interface for the MPFR library by a factor of 1.80 x and 1.67 x in sequential execution of the Poly Bench and RAJAPerf suites, respectively, and by a factor of 7.62 x on an 8 core (and 16 thread) machine for RAJAPerf in OpenMP.
2021 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)