LLVM Discussion Forums

GSoC 2020 : LLVM IR declaratively defined and MLIR Binary serialization / bitcode format

Hi all,

I am Shraiysh Vaishay, 3rd year Bachelor of Technology student at IIT Hyderabad, India. I have good experience with C/C++ and have submitted a few patches in the past months for LLVM IR Dialect in MLIR (https://reviews.llvm.org/people/revisions/19492). I have taken courses on Compiler Engineering (which got me familiar with the LLVM project ) and Compiler Optimizations. Among the open projects, I find these two projects quite exciting and would like to know more about them:

  1. LLVM IR declaratively defined (mentor: Alex Zinenko @ftynse )
  2. MLIR Binary serialization / bitcode format (Mehdi Amini @joker-eph )

It would be great if someone could guide me to the current status and the deliverables associated with these project and help me draft a proposal for the same.

Thanks

Hi Shraiysh,

I noticed your recent contributions, thanks a lot!
These projects are both important, I’ll let Alex explain the LLVM IR one and I’ll give you some information on the binary serialization.
At the moment the only serialization we have is the textual assembly. LLVM also has a textual assembly, but it provides a bitcode binary format for serializing its IR. The bitcode is more compact than the textual IR and also offers a different set of guarantees.
We’re looking into something similar for MLIR here, but it’ll likely require some interfaces to manage all of this in a efficient way. We may also have to think a bit more about organizing the serialization so that it can be partially loaded (maybe using some sort of sections organization).
Lot of fuzzy aspects to figure out :slight_smile:

Hello sir,

Thanks for the reply. I have been going through the LLVM Bitcode documentation, and as far as I understand, we are looking for encoding for MLIR, using the same Bit Code Format, (please correct me, if we want a new Bit Code Format too) similar to the LLVM IR Encoding. I still have to go through the code used to generate and parse it for LLVM to get a better sense of this project, but I think I would want to do this project for the summer and I will start working on my proposal. Also, is this the right platform for asking further questions about this project, before submitting a proposal?

Thanks

Yes this is the right place to discuss project proposal and flesh them out before sending them.

Hi sir,

As far as I understand, the track of this project will involve these tasks:

  1. To write an MLIR pass (similar to Bitcode writer pass) to generate basic bitcode format output for a program and a parser for the same
  2. To Come up with a generic encoding for MLIR files (that saves memory)
  3. Then next will be to progressively implement encodings (both parser and pass) for different parts of the program

Is that correct?

Thanks
Shraiysh

Yes: the subtleties will be around versioning and providing hooks for dialect to handle this.