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

[Graph] Cast optimizations #135

Merged
merged 3 commits into from Mar 21, 2023
Merged

Conversation

xinli-git
Copy link
Collaborator

Add 3 graph patterns to eliminate redundant casts

  • y1 = cast(x), y2 = cast(x) => y1 = y2 = z = cast(x)
  • same as above but for 3 outputs
  • cast(cast(x)) where the outer casts has the same dtype as x => x

 * operator x with 2 or 3 outputs that both has a cast -> combine the cast
 * two redundant casts (a->b->a) -> noop

Since the casts are likely to occur after automatic mixed precision, the
pass is run twice
@yaoyaoding
Copy link
Member

Thanks, @xinli-git!

@yaoyaoding yaoyaoding merged commit 0cea056 into hidet-org:main Mar 21, 2023
2 checks passed
@xinli-git xinli-git deleted the cast_optimizations branch April 21, 2023 17:56
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

3 participants