[Arith] Allow const folding on fp16 involving one and zero#13631
Merged
vinx13 merged 1 commit intoapache:mainfrom Dec 16, 2022
Merged
[Arith] Allow const folding on fp16 involving one and zero#13631vinx13 merged 1 commit intoapache:mainfrom
vinx13 merged 1 commit intoapache:mainfrom
Conversation
Collaborator
|
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.
Generated by tvm-bot |
leandron
approved these changes
Dec 16, 2022
vinx13
approved these changes
Dec 16, 2022
fzi-peccia
pushed a commit
to fzi-peccia/tvm
that referenced
this pull request
Mar 27, 2023
mikeseven
pushed a commit
to mikeseven/tvm
that referenced
this pull request
Sep 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #12515, const folding on fp16, when both lhs and rhs are constant, is disabled. This is the case even when one of the arguments are one or zero. This leads to a real problem described in #13532 (comment). So in practice, compiling winograd fp16 on GPU is currently broken.
This PR enables trivial algebraic simplification for fp16 const folding when (1) both arguments are constant and (2) one or both of the inputs are one or zero. Since we already do such simplification for any dtype when only one of the inputs are constant (for example
tvm/src/arith/const_fold.h
Lines 209 to 216 in 3a639a4
return NullOptfor fp16 cases and use the code path like above to simplify0h * 2.5hto0hetc.cc @vinx13 @wrongtest-intellif @Lunderberg