[GSoC] Proposal: Interactive MLIR query tool to make exploring the IR easier

Greetings everyone,

I am Devajith and I am currently working on a proposal for the Google Summer of Code (GSoC) program. My proposal revolves around creating an Interactive MLIR query tool that will make exploring the IR much easier. At the moment, I have a draft of my proposal and I would greatly appreciate it if anyone could take a quick look at it and give me feedback.

Apologies for closing access to the doc. I’m happy to share full proposal privately if you want to review, I’ll update this post with a rough overview of the project. It has been suggested that proposals be only shared with the mentors.


What is the project about?

The project aims to develop an interactive query language for MLIR that enables developers to query the MLIR IR dynamically. The tool will provide a REPL (or command-line) interface to enable users to query various properties of MLIR code, such as “isConstant” and “resultOf”. The proposed tool is intended to be similar to clang-query, which allows developers to match AST expressions in C++ code using a TUI with autocomplete and other features.

What are some of the basic queries that the tool will support?

The tool will support basic queries such as operation, hasName, hasType, hasAttribute, isConstant, resultOf{operation}, resultsOf{operation}, and arg (for block args).

What are the benefits of developing the MLIR query tool?

The MLIR query tool will improve the productivity of MLIR development and make it easier to explore and understand the MLIR IR structure. The tool will also help in identifying missing matchers that need to be added to MLIR. The amount of time spent looking for optimization opportunities in large MLIR dumps could be reduced with this tool.