Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HWLegalizeModules] Lower types-like packed array handling (#5355) #6402

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

yupferris
Copy link
Contributor

This PR refactors HWLegalizeModules to something more like existing lower types passes in order to support more complex patterns such as array concatenations. Several new tests are also added.

Fix #5355.

@yupferris
Copy link
Contributor Author

CC @uenoku @seldridge . The impetus for this was #6324; this patch fixes the test case provided there.

Note that this is my first CIRCT PR, so I'm not surprised if there are nits/things I can/should do better. I'm open to guidance, so fire away :) .

@yupferris
Copy link
Contributor Author

yupferris commented Nov 9, 2023

Note also that while the form here should in theory support nested arrays, I only briefly tried it, and it needs some more TLC for that to work, which I don't really have time to continue to track down now, but at least it shouldn't crash. (I can spend more time addressing feedback on what's already here though, ofc).

Likewise, I'm sure there are several other missing use cases that this pass should eventually support, which are not done here, but this should be a (big) step in the right direction. I'm happy to follow up if pinged about specific issues relating to expanding this code. (I may also do some follow-up work on this anyways as it was quite fun!)

Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really great! I have one feedback regarding iterator update but otherwise LGTM

@oharboe
Copy link

oharboe commented Nov 9, 2023

@jackkoenig FYI

@jackkoenig
Copy link
Contributor

Nice, I wonder if we're going to need this for firtool used by the Chisel 5.x line.

@yupferris yupferris force-pushed the packed-array-fixes branch 2 times, most recently from 751393c to 29cf79d Compare November 10, 2023 07:18
@yupferris
Copy link
Contributor Author

@uenoku feedback addressed, cheers!

@yupferris yupferris requested a review from uenoku November 10, 2023 07:21
Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

lib/Dialect/SV/Transforms/HWLegalizeModules.cpp Outdated Show resolved Hide resolved
lib/Dialect/SV/Transforms/HWLegalizeModules.cpp Outdated Show resolved Hide resolved
This PR refactors HWLegalizeModules to something more like existing lower types passes in order to support more complex patterns such as array concatenations. Several new tests are also added.

Fix llvm#5355.
@yupferris yupferris requested a review from uenoku November 10, 2023 08:16
@uenoku
Copy link
Member

uenoku commented Nov 10, 2023

I'm going to merge the PR. Thank you for the contribution and making chisel workable with yosys again!

@uenoku uenoku merged commit 97c770c into llvm:main Nov 10, 2023
4 checks passed
@yupferris yupferris deleted the packed-array-fixes branch November 10, 2023 18:28
@yupferris
Copy link
Contributor Author

Cheers, and thanks for making contributing to CIRCT a great experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HWLegalizeModules] Legalize array concat op
4 participants