-
Notifications
You must be signed in to change notification settings - Fork 25
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
[TKW] Fix sympy expr lowering and add some more igemm test shapes #184
Conversation
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
This reverts commit 3efa309. Signed-off-by: Ivan Butygin <[email protected]>
1df2d88
to
b64a9ee
Compare
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
@harsh-nod @erman-gurses I found a way to separate perf/non-perf tests using custom markers, don't need any external files, see the updated files and |
Signed-off-by: Ivan Butygin <[email protected]>
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.
I really like the refactor of gen_sympy_index for Rationals. Thank you! Just some minor comments but otherwise looks g2g!
if isinstance(arg, arith_d.ConstantOp): | ||
value = arg.attributes["value"] | ||
if isinstance(value, IntegerAttr): | ||
return int(value) |
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.
Throw error if it is not an int?
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.
We can actually encounter vector constants now, so this code is intended to fall through to the return None
|
||
stack.append(operation) | ||
def muli_fold(lhs, rhs): |
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.
When does this come up? Is it when you are handling with cases like a * (1 / b)
where you first do a * 1
and then divide by b? But wouldn't sympy convert that to a/b
?
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.
But wouldn't sympy convert that to a/b ?
I'm still seeing a bunch of muli %a, 1
without this, so apparently not. They are benign as they will be cleaned up later by canonicalizations, but it also means we will have to update all our codegen lit tests. With this early folding lit codegen IR is identical.
return value | ||
|
||
def _group_rationals(stack, count): | ||
rationals = [] |
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.
Could you add a comment explaining why we need non rationals first and then rationals? I am assuming that is the purpose of this function?
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.
added comment
return arith_d.muli(lhs, rhs) | ||
|
||
# `x + (a/b)` transformed into `(x*b + a) / b` | ||
def _add(lhs, rhs): |
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.
I really like the idea of the Rational and late materialization. It was a much better approach than our previous lambda based approach. Thanks!
Signed-off-by: Ivan Butygin <[email protected]>
Signed-off-by: Ivan Butygin <[email protected]>
* Rework how we are lowering `rational` sympy expressions, instead of delayed materialization via lambdas introduce `_Rational` type and propagate `numerator/denominator` values independently. Division will only be materialized on explicit `sympy.floor/ceiling` op. * Rework how igemm test cases are generated and introduce few real shapes. * Use custom pytest markers to separate perf/non-perf tests --------- Signed-off-by: Ivan Butygin <[email protected]>
rational
sympy expressions, instead of delayed materialization via lambdas introduce_Rational
type and propagatenumerator/denominator
values independently. Division will only be materialized on explicitsympy.floor/ceiling
op.