-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
ae318fd
to
7f02e6a
Compare
mlir-enumerate/mlir-enumerate.cpp
Outdated
.cast<TypeConstraintAttrInterface>() | ||
.getTypeConstraint(info.irdlContext, namedConstraintVars); | ||
|
||
if (constraint.get() |
There was a problem hiding this comment.
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.
Hi Mathieu,
Thanks for your reviewing!
I’ll update my code like you suggested 0w0.
All the best,
Yuyou
…On Thu, Oct 20, 2022 at 13:23 Fehr Mathieu ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In mlir-enumerate/mlir-enumerate.cpp
<#2 (comment)>:
> + if (constraintOp) {
+ for (auto namedConstraintAttr : constraintOp->getParams()) {
+ auto namedConstraint =
+ namedConstraintAttr.cast<NamedTypeConstraintAttr>();
+ auto constraint =
+ namedConstraint.getConstraint()
+ .cast<TypeConstraintAttrInterface>()
+ .getTypeConstraint(info.irdlContext, namedConstraintVars);
+ // TODO(fehr) Currently a hack, will be fixed later once I update
+ // the IRDL API.
+ auto constraint2 =
+ namedConstraint.getConstraint()
+ .cast<TypeConstraintAttrInterface>()
+ .getTypeConstraint(info.irdlContext, namedConstraintVars);
+
+ if (constraint.get()
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.
—
Reply to this email directly, view it on GitHub
<#2 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2SKR6Z3OUSU2ZKA4UIWF3WEGL2NANCNFSM6AAAAAARIS3TCE>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Hi Mathieu, I updated the branch with what you said! |
Perfect, thanks a lot! |
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.