-
Notifications
You must be signed in to change notification settings - Fork 72
Cast-cast elimination #2368
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
Cast-cast elimination #2368
Conversation
❌ 24 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Signed-off-by: Ganesan Ramalingam <[email protected]>
return check_result.fail(f"Ignored type {to_ignored.as_int()} is not allowed") | ||
type2 = to_ignored.as_int() | ||
type3 = to.as_int() | ||
if (type2, type3) not in self._allowed_type2_type3: |
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.
Maybe when type2==type3 or when both .is_floating_point()
and type2.itemsize > type3.itemsize?
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.
The first one is already covered by redundant cast elimination. The second one is what I think too (at least for float types; something similar for int types too may hold), but am keeping it simple here. (Do these methods is_floating_point / itemsize exist in ir.DataType?)
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.
Yes the methods exist. I think it’s pretty simple to implement
return check_result.fail(f"Output type {to.as_int()} is not allowed") | ||
if to_ignored.as_int() not in self._allowed_tensor_types: | ||
return check_result.fail(f"Ignored type {to_ignored.as_int()} is not allowed") | ||
type2 = to_ignored.as_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.
type2 = to_ignored.as_int() | |
type2 = it.DataType(to_ignored.as_int()) |
if to_ignored.as_int() not in self._allowed_tensor_types: | ||
return check_result.fail(f"Ignored type {to_ignored.as_int()} is not allowed") | ||
type2 = to_ignored.as_int() | ||
type3 = to.as_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.
type3 = to.as_int() | |
type3 = ir.DataType(to.as_int()) |
Enable the cast-cast simplification to a single cast in a couple of cases where it is valid. This shows up in examples like SmolLM (FP16) and is needed for fusion-pattern to work.
Also: add display of replaced and replacing nodes in fusion in verbose mode.