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

Optimized Ion Dialect to minimize redundant code in IonOp #1471

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

mehrdad2m
Copy link
Contributor

Context:
The current design of the IonOp redefines all the level attributes of a transition from scratch, which is quite inefficient when lowering to llvm IR. This can be optimized by labeling the pre-defined levels (upstate, downstate, estate) and just referencing them in the transition attribute.

Description of the Change:

  • Added a string attribute label to Level.

  • Changed the levels of a transition from LevelAttr to string

Benefits:
Can reference the label of a level instead redefining the level attribute with all its parameters which results in reduced code size.

Possible Drawbacks:

Related GitHub Issues:

@paul0403 paul0403 added author:build-wheels Run the wheel building workflows on this Pull Request OQD OQD-related work and removed author:build-wheels Run the wheel building workflows on this Pull Request labels Jan 20, 2025
@mehrdad2m mehrdad2m requested a review from paul0403 January 21, 2025 14:59
Copy link
Contributor

@paul0403 paul0403 left a comment

Choose a reason for hiding this comment

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

Nice!

Repeating all the numbers for a level in transitions has always bothered me, but I didn't have time to change it. Thanks for this optimization!

mlir/include/Ion/IR/IonOps.td Show resolved Hide resolved
@mehrdad2m mehrdad2m merged commit 682f7b6 into main Jan 21, 2025
43 checks passed
@mehrdad2m mehrdad2m deleted the optimize-ion-dialect branch January 21, 2025 16:36
@paul0403
Copy link
Contributor

I was reading the openapl grammar and noticed that they actually keep a (required) string label for a level in their IR as well! So I'd say this change accomplishes more than we originally thought, and actually helps with the openapl generation! 🚀

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

Successfully merging this pull request may close these issues.

2 participants