www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [SAoC] Presentation - MLIR Support for LDC

reply Roberto Rosmaninho <Robertogrosmaninho gmail.com> writes:
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: 
https://github.com/Robertorosmaninho/D-Dialect-for-MLIR

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 
performance.


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.
Sep 15 2019
next sibling parent Roberto Rosmaninho <Robertogrosmaninho gmail.com> writes:
Edit:

On Monday, 16 September 2019 at 02:05:14 UTC, Roberto Rosmaninho 
wrote:
    2. Build the D dialect:
       -  Implement D operations as D Dialect operations.
       -  Implement D operations as D Dialect operations.
This second subtopic should be "Register D dialect as MLIR Dialect."
Sep 15 2019
prev sibling parent reply Gishan Abeysinghe <gishan.abeysinghe gmail.com> writes:
On Monday, 16 September 2019 at 02:05:14 UTC, Roberto Rosmaninho 
wrote:
 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:

 [...]
I am Gishan Chaminga Abeysinghe from Sri Lanka. I am planning for the same kind of project as at first, I thought to build my own compiler, now I think it's better to make MLIR works for existing front-end. If you are okay we can work together on your project. my email is gishan.abeysinghe gmail.com Thank you
Nov 05 2019
parent Roberto Rosmaninho <Robertogrosmaninho gmail.com> writes:
On Wednesday, 6 November 2019 at 05:53:18 UTC, Gishan Abeysinghe 
wrote:
 I am Gishan Chaminga Abeysinghe from Sri Lanka. I am planning 
 for the same kind of project as at first, I thought to build my 
 own compiler, now I think it's better to make MLIR works for 
 existing front-end. If you are okay we can work together on 
 your project. my email is gishan.abeysinghe gmail.com

 Thank you
Hi Gishan, sorry for not answering before! Definitely, using DMD as the front end to get MLIR code makes the problem much easier to solve. About working together, I'm totally comfortable working together with someone, the problem is that I don't think we can do it during project development at SAoC, but when the event is over, I would appreciate any help to maintain and improve the code so that the community can use the best and most reliable MLIR translation. Regards, Roberto Rosmaninho
Nov 20 2019