llvm / llvm/circt

[FIRRTL] Add missing dialect dependencies

Open
#6,074 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

LowerXMR and LowerToHW, at least, may lower/introduce operations from HW, SV, and Seq dialects.

Fix the dependentDialects to ensure this works properly (such as when invoking via `circt-opt`).

Current failing example to demonstrate:

```mlir
firrtl.circuit "ClockProbe" {
firrtl.module @ClockProbe(in %in: !firrtl.clock, out %out: !firrtl.clock) attributes {convention = #firrtl} {
%0 = firrtl.ref.send %in : !firrtl.clock
%1 = firrtl.ref.resolve %0 : !firrtl.probe
firrtl.strictconnect %out, %1 : !firrtl.clock
}
}
```

Which presently errors out when running `circt-opt --firrtl-lower-xmr`:
```
LLVM ERROR: can't create type 'circt::seq::ClockType' because storage uniquer isn't initialized: the dialect was likely not loaded, or the type wasn't added with addTypes<...>() in the Dialect::initialize() method.
PLEASE submit a bug report to https://github.com/llvm/circt and include the crash backtrace.
Stack dump:
0. Program arguments: ./build/bin/circt-opt --firrtl-lower-xmr ./clock-probe.mlir
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the dependentDialects handling in LowerXMR and LowerToHW, then reproduce the failure with circt-opt --firrtl-lower-xmr and the provided ClockProbe MLIR. Done means the example no longer reports an uninitialized Seq dialect type and the lowering completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.