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

load all dialects preemptively #1584

Merged
merged 4 commits into from
Apr 7, 2025

Conversation

erick-xanadu
Copy link
Contributor

@erick-xanadu erick-xanadu commented Mar 24, 2025

Context: The transform dialect appears not to load dependent dialects of transformations.

Description of the Change: Load all dialects preemptively.

Benefits: Third party developers (and even first party developers) can generate operations in unloaded dialects from within the apply-sequence-pass.

Possible Drawbacks: This is a workaround. We should investigate some time to see where exactly the error comes from.

[sc-88453]

@paul0403
Copy link
Member

Wait, was this not solved? 😅 I remember this either went away on its own or there was a hack? @sengthai

@erick-xanadu
Copy link
Contributor Author

@paul0403 I am not sure if it was solved / how it was solved. But I know that an external collaborator encountered the same issue when loading an external dialect. So, @sengthai , if you remember how this was mitigated, please let us know. :)

@sengthai
Copy link
Contributor

At that time, that error disappeared, then it came back and forth. However, It was entirely solved by adding dependentDialects in ApplyTransformSequencePass. 🤔

def ApplyTransformSequencePass : Pass<"apply-transform-sequence"> {
let summary = "Apply the passes scheduled with the transform dialect.";
let dependentDialects = [
"qec::QECDialect"
];
let constructor = "catalyst::createApplyTransformSequencePass()";
}

@erick-xanadu
Copy link
Contributor Author

At that time, that error disappeared, then it came back and forth. However, It was entirely solved by adding dependentDialects in ApplyTransformSequencePass. 🤔

Thanks! Yes, this is not a viable solution in the long term. I think we may need to update the source upstream.

@erick-xanadu erick-xanadu force-pushed the eochoa/2025-03-24/fix-load-dialect-transform branch from a854b46 to d7d31ce Compare April 2, 2025 18:02
@erick-xanadu erick-xanadu marked this pull request as ready for review April 2, 2025 18:02
@erick-xanadu erick-xanadu requested a review from sengthai April 2, 2025 18:25
Copy link
Contributor

@sengthai sengthai left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, Erick. I tested ppm's passes, and they work great! I also went ahead and removed the empty dependentDialects in the latest commit.

Copy link

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.60%. Comparing base (a2b886b) to head (4584b7b).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1584      +/-   ##
==========================================
+ Coverage   96.47%   96.60%   +0.13%     
==========================================
  Files          80       80              
  Lines        8556     8606      +50     
  Branches      819      832      +13     
==========================================
+ Hits         8254     8314      +60     
+ Misses        246      238       -8     
+ Partials       56       54       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@erick-xanadu
Copy link
Contributor Author

This one is hard to test for plugins because the standalone plugin in MLIR does not have a pass that depends on the standalone dialect. So I would need to create a pass to test it. I propose we merge this. We see that it already solves the issue with the QEC dialects.

@erick-xanadu
Copy link
Contributor Author

Patrick Hopf successfully tested this out. I'll be merging after standup.

@erick-xanadu erick-xanadu merged commit 5d78087 into main Apr 7, 2025
44 checks passed
@erick-xanadu erick-xanadu deleted the eochoa/2025-03-24/fix-load-dialect-transform branch April 7, 2025 15:06
mehrdad2m pushed a commit that referenced this pull request Apr 7, 2025
**Context:** The transform dialect appears not to load dependent
dialects of transformations.

**Description of the Change:** Load all dialects preemptively.

**Benefits:** Third party developers (and even first party developers)
can generate operations in unloaded dialects from within the
apply-sequence-pass.

**Possible Drawbacks:** This is a workaround. We should investigate some
time to see where exactly the error comes from.

[sc-88453]

---------

Co-authored-by: Sengthai Heng <[email protected]>
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.

4 participants