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

[FreezePaths] Add an optional argument, to get the operation name #7549

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

prithayan
Copy link
Contributor

@prithayan prithayan commented Aug 23, 2024

FreezePaths pass may sometimes need to be invoked before ExportVerilog.
This change removes the dependency of the pass on the hw.verilogName attribute, and adds an optional get operation name function, that can be invoked if the verilog name is absent.
This enables any tool to invoke it earlier by providing an appropriate name-getter function.
But as is expected, the names used to freeze the paths, may not match the verilog names. This should be used with caution, only when the path will not be used and its okay to be incorrect.

@prithayan prithayan requested a review from mikeurbach August 23, 2024 21:43
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.

This extension point makes sense to me for tools that want to run this pass but might not export verilog. Thanks!

lib/Dialect/OM/Transforms/FreezePaths.cpp Outdated Show resolved Hide resolved
@uenoku
Copy link
Member

uenoku commented Aug 24, 2024

I think FreezePaths relied on hw.verilogName because it needed correct verilog names. How does your callback ensure names are same to verilog names?

@prithayan
Copy link
Contributor Author

I think FreezePaths relied on hw.verilogName because it needed correct verilog names. How does your callback ensure names are same to verilog names?

You are right, the verilog name might not match, but this is required for certain flows when we are certain that the path and the names do not matter/would not be used. But other (non-path)parts of the OMIR are needed and the freeze-path pass is required to implement the OFFRITL ABI.
So, in our case, the MLIR is generated by a tool that does not run the ExportVerilog but expects the FreezePaths to run, so we wanted remove this dependency by providing a fallback operation name getter, without which FreezePaths would fail.

@prithayan prithayan force-pushed the dev/pbarua/freeze-paths-verilogname branch from 4c315d1 to 8f5d104 Compare August 26, 2024 13:09
@prithayan prithayan merged commit 33c35ff into main Aug 26, 2024
4 checks passed
@prithayan prithayan deleted the dev/pbarua/freeze-paths-verilogname branch August 26, 2024 16:28
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.

3 participants