[HW] hw-flatten-modules doesn't work with parameters
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
```mlir
hw.module private @parameters(out out: i42) {
%result = hw.param.value i42 = #hw.param.decl.ref<"p1">
hw.output %result: i42
}
hw.module @UseParameterized(out x: i42, out y: i42, out z: i42) {
%r0 = hw.instance "inst1" @parameters() -> (out: i42)
%r1 = hw.instance "inst2" @parameters() -> (out: i42)
%r2 = hw.instance "inst3" @parameters() -> (out: i42)
hw.output %r0, %r1, %r2: i42, i42, i42
}
$ circt-opt -hw-flatten-modules bar.mlir -mlir-print-ir-after-all
// -----// IR Dump After FlattenModules Failed (hw-flatten-modules) //----- //
#loc = loc("bar.mlir":6:33)
#loc1 = loc("bar.mlir":6:45)
#loc2 = loc("bar.mlir":6:57)
"builtin.module"() ({
"hw.module"() <{module_type = !hw.modty, parameters = [], result_locs = [#loc, #loc1, #loc2], sym_name = "UseParameterized"}> ({
%0 = "hw.param.value"() <{value = #hw.param.decl.ref<"p1"> : i42}> : () -> i42
%1 = "hw.param.value"() <{value = #hw.param.decl.ref<"p1"> : i42}> : () -> i42
%2 = "hw.param.value"() <{value = #hw.param.decl.ref<"p1"> : i42}> : () -> i42
"hw.output"(%0, %1, %2) : (i42, i42, i42) -> ()
}) : () -> ()
}) : () -> ()
```
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 provided bar.mlir reproducer and run circt-opt with hw-flatten-modules and -mlir-print-ir-after-all. Trace how the pass handles hw.instance parameters and hw.param.value operations; done means flattening UseParameterized preserves the three instance parameter values instead of leaving unresolved p1 references.
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
- 38/100