question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[COMPILER REQUEST]: CIRCT

See original GitHub issue

Compiler name

CIRCT

Compiler version

?

Compiler language

MLIR

Compiler homepage

https://circt.llvm.org/

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:closed
  • Created a year ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
mikeurbachcommented, Aug 4, 2022

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.

1reaction
partoufcommented, Jul 11, 2022

Ah that could be it. I can set it up with a newer compiler

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with the CIRCT Project - LLVM
“CIRCT” stands for “Circuit IR Compilers and Tools”. The CIRCT project is an (experimental!) effort looking to apply MLIR and the LLVM development...
Read more >
llvm/circt: Circuit IR Compilers and Tools - GitHub
CIRCT follows all of the LLVM Policies: you can create pull requests for the CIRCT repository, and gain commit access using the standard...
Read more >
Applying Circuit IR Compilers and Tools (CIRCT - MLSys
Applying Circuit IR Compilers and Tools (CIRCT) to ML Applications. MLSys Chips and Compilers Symposium. 4/5/2021 mike@alloystack.io ...
Read more >
CCS C Compiler Manual
REAL ICE™, ICSP™ and In-Circuit Serial Programming™ are trademarks of ... The compiler will generate a loop that will call the function once...
Read more >
Error: request for member " " in something not a structure or ...
Since ASTnode hasn't been declared yet at that point and the compiler wants to be able to continue trying to compile, it will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found