-
Notifications
You must be signed in to change notification settings - Fork 48
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
Make operand data type and rank validation table-driven #657
Make operand data type and rank validation table-driven #657
Conversation
31410f3
to
48b240b
Compare
Improve readability of input operand data type and rank by introducing a table within each method definition that outlines the restrictions for positional arguments and options. Steps are updated to reference the table columns.
c8b4ac2
to
7f2e78b
Compare
I'd prefer this style than the one in #646 |
A few questions to consider: dataType
rank
General
|
IMHO the "consistent" option is clear enough in this case. :) |
- gemm(): Fix ranks in table, align phrasing. - gru(): Align phrasing. - lstm(): Don't inline rank of 3, reference table. - matmul(): Align phrasing. - prelu(): Fix punctation. - triangular(): Add table, use for rank validation. - where(): Align phrasing.
4c13bf8
to
295cd0b
Compare
Other notes:
|
Looking at the preview, I think that makes sense.
Shape should include rank... I'd leave rank out and let impl optionally handle that as a quick check, if it makes sense somewhere. |
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.
Thanks @inexorabletash !
It seems some operators are not covered, such as argMin/Max. Do you plan to do them in a separate CL?
"input" -> "same as input" Co-authored-by: Ningxin Hu <ningxin.hu@intel.com>
My approach was to very mechanically migrate explicit rank/shape validation steps from the prose steps that contain the constraints to the table format where the prose steps reference the table. That has these implications:
In other words, only introduce the table where it will be normatively referenced. Obviously we can change this!
Yeah, I wasn't sure how much effort to put into explicitly linking things. Currently nothing actually links to the tables; it's implied that if a step mentions "allowed data types" or "allowed ranks" then the reader should find the nearby table and look up the appropriate value for the named input operand. It might be better to link those phrases in steps to the table cells. |
Makes sense to me! Thanks for the explanation!
logicalNot may need steps to validate input data type is "uint8"? (and logicalAnd, logicalOr, logicalXor in @fdwr 's wave3 proposal) And wave3 will introduce "int4"/"uint4" data types, I assume "any" data types may not apply for some ops, we may need "anyDataTypesAtLeast8Bits" ( Of course we can handle the wave3 ops / data types after its PR landed.
I think it's unnecessary to add no-op steps.
Yes, it's a lot. Can we group some tables? Like a table for float-pointing element-wise unary, including ceil, floor, cos, sin, erf, exp, log, reciprocal, tan etc.,. However it may require linking the "allowed data types" to a particular table which is another discussion.
Duplicating steps is not the intention. I just feel user should not expect validation failure if the supplied tensor is allowed according to "allowed ranks". We have "same as input" for "allowed data types". Could we have something like "maximum to input rank" for "allowed ranks"? |
f61292d adds tables for all ops (or op categories) |
For now, in f61292d I left it at one table per "op category" and introduced the phrase "specified as part of operation steps" in the table. |
Makes sense. Added in 4bf14f6 for the cases you called out - I didn't audit the ops for more, though. How does that look? |
As always, having the table contain "specified as part of operation steps" is an intentionally minimal change. There are a few more things we could do:
|
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.
LGTM!
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.
LGTM!
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.
Thanks Josh! Minor comments, else LGTM.
Fix copy/pasta of {{input}} for other params Co-authored-by: Dwayne Robinson <dwayner@microsoft.com>
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.
👍
SHA: c237cf1 Reason: push, by fdwr Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Improve readability of input operand data type and rank by introducing a table within each method definition that lines the restrictions for positional arguments and options. Steps are updated to reference the table columns.
Preview | Diff