Skip to content
New issue

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

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

Already on GitHub? # to your account

[firtool] Add an option to emit HW MLIR into file #8169

Merged
merged 2 commits into from
Feb 10, 2025
Merged

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Feb 1, 2025

This PR adds -output-hw-mlir option to firtool which emits HW IR into file in a similar way to -output-final-mlir.

This PR adds DumpIR pass to simplify the emission. It's currently not exposed to other tool as it's very specific to firtool pipeline (actually the pass indirectly uses cl options defined in firtool.cpp)

@@ -456,6 +494,11 @@ static LogicalResult processBuffer(
if (failed(firtool::populateHWToBTOR2(pm, firtoolOptions,
(*outputFile)->os())))
return failure();

// If requseted, emit the HW IR to hwOutFile.
Copy link
Contributor

Choose a reason for hiding this comment

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

*requested

Copy link
Contributor

@mikeurbach mikeurbach left a comment

Choose a reason for hiding this comment

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

Generally, excited for this, just one general question.

Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

Really excited for this! For any tool or analysis that wants to start from an HW design, this is going to be very valuable!

@sequencer
Copy link
Contributor

Is possible for adding a c-api for this?

@uenoku
Copy link
Member Author

uenoku commented Feb 10, 2025

Is possible for adding a c-api for this?

It's a bit tricky to do that because the option is not pipeline option strictly speaking (The option is not added to FirtoolOption intentionally). In CAPI you can manually dump IR after HW lowering if you necessary, and I think it's more flexible. So let me first merge the PR and add CAPI if it turned it's really necessary.

@uenoku uenoku merged commit 316ee41 into main Feb 10, 2025
5 checks passed
@uenoku uenoku deleted the dev/hidetou/emit-hw branch February 10, 2025 18:19
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants