llvm / llvm/circt

[HW] Pass to flatten !hw.struct types

Open
#3,144 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

As discussed in the ODM on 5/18/22. The idea is to transform
```mlir
hw.module @foo(%in: !hw.struct) -> (out: !hw.struct) {
%0 = hw.struct_extract %in["a"] : !hw.struct
%1 = hw.struct_extract %in["b"] : !hw.struct
%2 = hw.struct_create (%1, %0) : !hw.struct
hw.output %2 : !hw.struct
}
```
to
```mlir
hw.module @foo_flat(%in_a: i8, %in_b: i16) -> (out_c: i16, out_d: i8) {
hw.output %in_b, %in_a : i16, i8
}
```

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

Use the two MLIR examples in the issue as the starting specification for the flattening pass. Trace how hw.struct types, hw.struct_extract, and hw.struct_create are represented and handled, then verify that the pass produces flattened module inputs and outputs with the shown ordering and equivalent values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.