Loading…
Monday, March 27 • 10:00 - 10:40
AVX-512 Mask Registers Code Generation Challenges in LLVM

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

In the past years LLVM has been extended to support Intel AVX512 [1] [2] instructions. One of the features introduced by the AVX-512 architecture is the concept of masked operations. In the Euro LLVM 2015 developer meeting Intel presented the new masked vector intrinsics, which assist LLVM IR optimizations (e.g. Loop Vectorizer) in selecting vector masked operations [3].

In this talk, we are going to cover some of the key problems encountered when extending the LLVM code generator to support the AVX-512 mask registers.

The current implementation of mask lowering, favors assigning LLVM IR conditions (i1 data type) to mask registers over General Purpose Registers (GPR). The decision leads to sub-optimal code generation when compiling for AVX-512 targets. This exposes a fundamental limitation of the existing instruction selection framework when a type can be lowered to different register classes. In addition, we will show that achieving optimal mask register selection requires a global analysis [5]. We will overview the various issues caused by the current approach, followed by a solution that achieves better results by favoring GPRs over mask registers [4]. In addition, we will overview a suggested optimization that mitigates artifacts created by the instruction selection phase.

Additionally, AVX-512 mask registers create a dilemma with the memory representation of LLVM IR vectors of i1 - Is a mask a bit or a byte in memory? AVX2 and older vector instruction sets can efficiently support masks in bytes. AVX-512 favors representation by bits, thus achieving a smaller memory footprint. However, this creates a possible cross-generation interoperability conflict which needs to be addressed. We will overview the issue and explore the alternatives.

[1] https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
[2] http://llvm.org/devmtg/2013-11/slides/Demikhovsky-Poster.pdf
[3] http://llvm.org/devmtg/2015-04/slides/MaskedIntrinsics.pdf
[4] https://groups.google.com/forum/#!topic/llvm-dev/-OmfyIY3SaU
[5] http://llvm.org/devmtg/2016-11/Slides/Colombet-GlobalISel.pdf

Speakers

Monday March 27, 2017 10:00 - 10:40 CEST
E2 2 (Günter Hotz Hall)