llvm / llvm/circt

[Calyx] CIRCT Calyx dialect should have an importer to go with the exporter

Open
#2,955 1 comment 0 reactions 0 assignees View on GitHub
Calyx enhancement
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

In line with common MLIR practice, we have defined a Calyx exporter to produce the textual format used by the original, Rust-based Calyx compiler. This is the common way to interface with external tools from MLIR projects (e.g. the TensorFlow compiler can produce/consume HLO to interact with XLA). In order to consume IR from the original Calyx compiler, the CIRCT Calyx compiler should also be able to import the external textual format.

In lieu of this, the original Calyx compiler is currently able to produce the CIRCT Calyx compiler's textual format, using the `-b mlir` option to futil, for example. Now I realize why it kept coming up that the CIRCT textual parser had to be updated, and why requests were made to enhance the CIRCT textual form to better match the Rust implementation. (I just implemented a small change to align the CIRCT parser to the Rust printer https://github.com/llvm/circt/pull/2954).

As I keep harping, an MLIR dialect's textual format is for testing, and should not be load bearing. This issue is about fixing that. Rather than having two compilers, each exporting to the other's format, the MLIR side should import and export the other compiler's external format. This symmetry puts the burden on the MLIR side, but I think that is worth not requiring changes from the other side (cf. TensorFlow integration with XLA), and I think this is how the CIRCT Calyx compiler should do it. Then we can remove `-b mlir` from the Rust compiler. I'm sorry I wasn't understanding what was going on here earlier, but now I think it is clear.

cc @mortbopet @cgyurgyik @rachitnigam

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the CIRCT Calyx exporter and the external textual format produced by the original Rust-based Calyx compiler. Compare that format with the current CIRCT textual parser, including the change in pull request 2954, and inspect how futil's -b mlir output is used. Done means CIRCT can import and export the external format so the Rust compiler no longer needs that option.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.