[SAoC] Presentation - MLIR Support for LDC

Roberto Rosmaninho Robertogrosmaninho at gmail.com
Mon Sep 16 02:05:14 UTC 2019

Hi everyone,

My name is Roberto I'm in my second year of Computer Science and 
I will work on the project "MLIR Support for D". Here is a brief 
of what my project is about:

The Multi-Level Intermediate Representation (MLIR) is a project 
that aims to define a flexible and extensible intermediate 
representation (IR) that will unify the infrastructure required 
to perform high-performance machine learning models in TensorFlow 
and similar ML frameworks. Each level of MLIT is represented by a 
dialect and each dialect is consisted by a set of defined 
operations which makes the levels of optimizations more flexible 
than the usual source code, machine code and IR LLVM, which has 
its dialect on MLIR levels. Those dialects have their own 
optimizations that may not be available on other representations 
of the source code. The goal of this project is to provide LDC a 
new level of abstraction to support the integration of the MLIR 
into the D ecosystem. This project will lead to the incorporation 
of new optimizations into the D programming language that will 
benefit all users. The addition of new optimizations will be 
possible due to the levels of intermediate representation 
provided by the MLIR infrastructure. To complete these tasks, 
this project aims to create a D Dialect of MLIR, which will be 
closer to the D source code.

The full proposal of the project and the code that I can work can 
be found in the following GitHub repository: 

The Milestones for this project are described below:

    1. Compilation of D through the LLVM dialect of MLIR:
       -  Build and set up as the newest version available: LLVM 
(10.0.0svn), MLIR, LDC (1.17.0) and DMD (v2.087.1).
       -  A systematic review about D, LDC and MLIR source code.
       -  Model all core IR structures in LLVM: Instructions, 
Globals, Modules, etc.
       -  Traverse the AST of D to issue MLIR code.
       -  Run tests, fix bugs, write documentation.

    2. Build the D dialect:
       -  Implement D operations as D Dialect operations.
       -  Implement D operations as D Dialect operations.
       -  Refine D Dialect to support D specific constraints.
       -  Run tests, fix bugs, write documentation.

    3. Implement D specific optmizations and Use / Test the 
translation to other dialects:
       -  Expose instructions and operations to D.
       -  Implement GC2Stack and simpler D optimizations.
       -  Translate D Dialect into Affine, Vector, GPU, etc.
       -  Run tests, fix bugs, write documentation.
       -  Run some benchmarks to compare the performance of D and 
D + MLIR optimizations.

    4. Use D (compiled into MLIR) on ML Frameworks and analyze 

I will work on each milestone for a month finishing ever 15th day 
of the month, for example, the first milestone has to be achieved 
on October 15th an so on ...

I'll do an effort to write weekly updates here so the community 
can follow the development of my project. Any doubt, suggestion 
or tip is very welcome, just write in this topic and I will 
answer as soon as possible!

That's all for now, hopefully, next week I'll have some advances 
to tell you about!

Thanks for your attention,
Roberto Rosmaninho.

More information about the Digitalmars-d mailing list