[COMPILER REQUEST]: CIRCT
See original GitHub issueCompiler name
CIRCT
Compiler version
?
Compiler language
MLIR
Compiler homepage
Motivation
I am a contributor to the CIRCT project, and in a recent open design meeting, raised the idea of CIRCT support in Compiler Explorer. I was excited to see Compiler Explorer gain support for MLIR, and wanted to start a discussion about potentially supporting CIRCT. This idea isn’t fully baked, so if there is a better venue to have a preliminary discussion, please let me know.
For some background, CIRCT is an MLIR-based compiler for electronic design automation (EDA), hosted in the LLVM organization as an incubator project. It is not (yet) part of the LLVM monorepo, but is compiled with a dependency on LLVM/MLIR, or as an LLVM external project. It defines various MLIR dialects, and can ultimately transform them to System Verilog. It provides a circt-opt
tool analogous to mlir-opt
, as well as other, more tailored tools.
Having CIRCT support in Compiler Explorer would be really useful. For those of us working on CIRCT-related compilers and flows, being able to use Compiler Explorer would be awesome.
I’m also hoping it could be used to tie to other compilers supported in Compiler Explorer, though I’m less sure exactly how that might work. Is it possible to run multiple compilers in Compiler Explorer?
If so, there are three specific flows that I would be interested in:
Chisel flow
Chisel is an embedded DSL within Scala, so I was wondering if we could use Compiler Explorer’s support for Scala to run Chisel. My understanding is that would also depend on installing Chisel as a library in Compiler Explorer.
Chisel produces an IR called FIRRTL, which CIRCT consumes, and compiles to System Verilog. So if we could support Chisel and CIRCT in Compiler Explorer, we could potentially have an end-to-end Chisel to System Verilog flow.
This would be super useful to the Chisel community. To date, the Chisel folks have been able to use Scastie’s Chisel support to share Chisel snippets and the resulting Verilog output. But Chisel is in the process of moving from a pure-Scala implementation of the FIRRTL compiler to the CIRCT-based FIRRTL compiler. We’ve had some discussion about how to preserve the Scastie UX after this move, which would require installing CIRCT in Scastie. The flow I’m proposing here would be another alternative, and would satisfy the Chisel needs while also making CIRCT generally available in Compiler Explorer, which I think is useful on its own.
HLS flow
Besides Chisel, CIRCT also supports using various MLIR dialects as inputs to a high-level synthesis (HLS) flow. For example, the affine or cf dialects can be consumed by CIRCT and compiled down to System Verilog designs.
Since Compiler Explorer supports MLIR, I can imagine a flow where the MLIR support is used to consume inputs, potentially transform them, and hand the IR to CIRCT’s HLS support. This would be a really neat way to show off this integration, share examples online, and generally help people explore CIRCT’s HLS support.
PyCDE flow
CIRCT also has a Python-based project for circuit design entry (PyCDE), that is similar in spirit to Chisel. PyCDE could be installed as a Python library, which produces CIRCT IRs that can be further transformed down to System Verilog. So I think this would be similar to the Chisel flow, but Python based.
Even if these multi-compiler flows aren’t possible today, I think CIRCT support in Compiler Explorer would be excellent and very useful on its own. I’m happy to personally donate some time to help set this up, if someone more familiar here can help guide me and review PRs.
Let me know what you think!
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
The initial support for circt-opt is in and live online. I’m going to close this issue and use smaller issues to discuss any further enhancements.
Ah that could be it. I can set it up with a newer compiler