[HW] Unkown location attributes on HWModule ports missing in serialized IR
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Follow-up on #6388/#6416
The merged PR hotfixes the crash during compilation, but there remain inconsistencies in the serialized output format.
Pushing the example of #6388 through `circt-opt --mlir-print-debuginfo --mlir-print-local-scope` prints:
```
module {
hw.module @test(in %I : i1, out O : i1) {
hw.output %I : i1 loc("":3:9)
} loc("":2:5)
} loc("":1:1)
```
The explicitly unknown locations are missing. Parsing and printing this output again produces:
```
module {
hw.module @test(in %I : i1 loc("":2:22), out O : i1 loc("":2:35)) {
hw.output %I : i1 loc("":3:9)
} loc("":2:5)
} loc("":1:1)
```
While this could likely be fixed in `module_like_impl::printModuleSignatureNew`, this indicates that there is a semantic difference between having no location vs. having an unknown location. So, removing unknown location attributes from ports and reconstructing them on demand could be problematic in general. There are also concerns regarding performance (see #6257).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the #6388 example and reproduce its output using circt-opt --mlir-print-debuginfo --mlir-print-local-scope. Inspect module_like_impl::printModuleSignatureNew and the handling of unknown locations on HWModule ports, then compare parse/print round trips. Done means explicitly unknown port locations are preserved consistently without losing the distinction between missing and unknown locations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100