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

[OM] Separates OM object fields verifier to a dedicated pass #7026

Merged
merged 5 commits into from
May 14, 2024

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented May 13, 2024

Verification for OM object fields performs global analysis on a symbol table op. This cannot be done efficiently today within symbol table verification without nested symbol tables. So this PR separates the verifier into a dedicated pass and run the verification at several times in the pipeline.

Verification for OM object fields performs globaly analysis on a symbol
table op. This cannot be done efficiently today within symbol table verfiication
without nested symbol tables. So this PR separatse the verifier into a dedicated
pass and run the verfication at several times in the pipeline.
@uenoku uenoku requested a review from mikeurbach May 13, 2024 14:17
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.

Thanks, this looks great to me.

Copy link
Contributor

@dtzSiFive dtzSiFive left a comment

Choose a reason for hiding this comment

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

LGTM, should embrace these as really not being Symbols and symbol users in the MLIR sense and rework into whatever they are for us.

Thanks for chasing this down and working up a solution here!

lib/Dialect/OM/Transforms/VerifyObjectFields.cpp Outdated Show resolved Hide resolved
lib/Dialect/OM/Transforms/VerifyObjectFields.cpp Outdated Show resolved Hide resolved
lib/Dialect/OM/Transforms/VerifyObjectFields.cpp Outdated Show resolved Hide resolved

// The nested ClassOp must exist, since a field with ClassType
// must be an ObjectInstOp, which already verifies the class
// exists.
Copy link
Contributor

Choose a reason for hiding this comment

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

"me be an ObjectInstOp" -> that is, if this is valid and not an error, right?

If so, might be good to handle this either not finding a class or that the symbol resolves to a non-classlike. I think lookupNearestSymbolFrom<ClassLike>(..) might help with that.

Copy link
Contributor

Choose a reason for hiding this comment

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

This might not be needed, just checking 👍 .

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I think it could crash when object is not created by ObjectInstOp. I added a check and test. Thanks!

include/circt/Dialect/OM/OMPasses.td Show resolved Hide resolved
<< getResult().getType() << ", but accessed field has type "
<< finalField.getType();

// This is verified by VerifyObjectFields pass.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there utility in implementing this / SymbolUserOpInterface if it is only ever success (and our symbol users probably don't work right anyway -- they aren't underneath the SymbolTable defining the symbols referenced AFAICT).

Anyway maybe fine for now, pending a rework esp now we're managing our own verification too.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think when we finally fix this for real, this will probably be where we re-land the verifier, since om.object.field will still reference the om.class symbol. The difference is we will re-work the IR to not have to then scan the om.class body to perform the verification. So I guess this is fine to rip out now, and we can add it back then, or we can leave the placeholder.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking that since these aren't not compatible with MLIR symbols the rework wouldn't use this since these aren't symbol users in the normal sense?

But okay, something to chat about later...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I think we can drop the interface. ObjectFieldOp would not be a MLIR symbol user.

@uenoku uenoku merged commit 6fb270b into main May 14, 2024
4 checks passed
@uenoku uenoku deleted the dev/hidetou/verifier branch May 14, 2024 02:24
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.

None yet

3 participants