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

function isValidReturnType added #2

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

Hatsunespica
Copy link
Collaborator

Check if the given OperationOp can use specified type as a valid return type.
bool isValidReturnType(GeneratorInfo &info, irdl::OperationOp op, mlir::Type type)

For each constraint variable, we try to assign the constraint with the provided type. Otherwise use random one from all satisfied types.

@Hatsunespica Hatsunespica reopened this Oct 20, 2022
@math-fehr math-fehr self-requested a review October 20, 2022 19:14
.cast<TypeConstraintAttrInterface>()
.getTypeConstraint(info.irdlContext, namedConstraintVars);

if (constraint.get()
Copy link
Contributor

Choose a reason for hiding this comment

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

You do not actually need to assign any type on the constraints here.
This should be done automatically when you check that the result types are satisfying the constraints.
So when you check something like Vector<T> with the type Vector<i32> for instance, T will be set to i32 in the verifyType function.

So for here, you can actually just check the result constraints, without dealing manually with the constraint variables.
You still though have to fill namedConstraintVars, varConstraints, and vars. But you should just set each Type to Type() in vars if I recall correctly.

@Hatsunespica
Copy link
Collaborator Author

Hatsunespica commented Oct 20, 2022 via email

@Hatsunespica
Copy link
Collaborator Author

Hi Mathieu,

I updated the branch with what you said!
Does it look good?
0w0

@math-fehr
Copy link
Contributor

Perfect, thanks a lot!

@math-fehr math-fehr merged commit 15d8154 into opencompl:main Oct 25, 2022
@Hatsunespica Hatsunespica deleted the isValidReturnType branch October 28, 2022 22:05
@Hatsunespica Hatsunespica restored the isValidReturnType branch November 9, 2022 04:51
@Hatsunespica Hatsunespica deleted the isValidReturnType branch November 9, 2022 04:51
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

2 participants