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

interactive: when generating new MLContext, set allow_unregistered attribute to default (=false) #3666

Closed
wants to merge 2 commits into from

Conversation

dshaaban01
Copy link
Collaborator

@dshaaban01 dshaaban01 commented Dec 22, 2024

This PR sets the MLContext, allow_unregistered attribute to its default, which is false, instead of having it at true.

This was causing a weird parsing error that did not allow the mlir-opt pass to run --> it was parsing module {} as UnregisteredOp.

This fixes it.

@dshaaban01 dshaaban01 changed the title interactive: when generating new MLContext, set ML allow_unregistered attribute to default (=false) interactive: when generating new MLContext, set allow_unregistered attribute to default (=false) Dec 22, 2024
@dshaaban01 dshaaban01 self-assigned this Dec 22, 2024
@dshaaban01 dshaaban01 added the interactive xdsl-gui things label Dec 22, 2024
Copy link

codecov bot commented Dec 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.29%. Comparing base (955600d) to head (9bf242b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3666   +/-   ##
=======================================
  Coverage   91.29%   91.29%           
=======================================
  Files         466      466           
  Lines       58332    58332           
  Branches     5638     5638           
=======================================
  Hits        53253    53253           
  Misses       3629     3629           
  Partials     1450     1450           

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

Copy link
Collaborator

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

Why does this break mlir-opt pass? It feels like this isn't actually fixing whatever the real issue is and is at worst a regression.

@@ -26,7 +26,7 @@ def get_new_registered_context(
"""
Generates a new MLContext, registers it and returns it.
"""
ctx = MLContext(True)
ctx = MLContext()
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we want to go ahead with this change then could we at least have allow_unregistered_dialect passed in as a command line argument?

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

I don't think this is the right fix. The problem we discussed is that module {}, which is a valid spelling of builtin.module {} in MLIR, is parsed as an unregistered operation, even though it's always registered.

@superlopuh
Copy link
Member

In either case, this PR is missing a filecheck test for module {}

@alexarice
Copy link
Collaborator

Ah, is this an MLIR bug and not an xdsl bug?

@dshaaban01
Copy link
Collaborator Author

dshaaban01 commented Dec 22, 2024

I don't think this is the right fix. The problem we discussed is that module {}, which is a valid spelling of builtin.module {} in MLIR, is parsed as an unregistered operation, even though it's always registered.

But I never tried to parse a module{}... The module I tried to parse was as follows:

builtin.module {
    func.func @hello(%n : i32) -> i32 {
    %b = arith.addi %n, %n : i32
    %c = arith.muli %b, %b : i32
    func.return %b : i32
    }
}

That's why this error is confusing me.

@dshaaban01
Copy link
Collaborator Author

#3668

Made an issue.

@dshaaban01
Copy link
Collaborator Author

Closing this PR as @alexarice found the bug and opened a new PR to fix it.

@dshaaban01 dshaaban01 closed this Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interactive xdsl-gui things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants