Skip to content

[Graph] Cast optimizations#135

Merged
yaoyaoding merged 3 commits intohidet-org:mainfrom
xinli-git:cast_optimizations
Mar 21, 2023
Merged

[Graph] Cast optimizations#135
yaoyaoding merged 3 commits intohidet-org:mainfrom
xinli-git:cast_optimizations

Conversation

@xinli-git
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

Thanks, @xinli-git!

@yaoyaoding yaoyaoding merged commit 0cea056 into hidet-org:main Mar 21, 2023
@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.

3 participants