Skip to content

Conversation

@AndrewZhaoLuo
Copy link
Contributor

@AndrewZhaoLuo AndrewZhaoLuo commented Jan 6, 2022

Add some unregistered ops to the default AMP lists.

By default the pass places unregistered ops to the follow list so this does not change behavior. It does suppress some errors though.

nn.depth_to_space -- this is just a fancy reshape op so should be in follow list

argmax, argmin -- this one is pretty much the same computation as in min and max which are in the follow lists

fast_* -- these fast operations use approximations involving polynomials in a clipped domain of the normal functions. They seem safe, though fast_tanh has coefficients outside of representable range of fp16 (which I think is fine)

clip -- usually used to implement relu6, might have problems if clip range are outside of fp16 range but this should be rare

image.resize2d -- The amount of accumulation is pretty minimal

Excepting the fast_* functions which have no analog I know of, this matches closely with TFs mixed precision list (github.com/tensorflow/tensorflow/blob/v2.5.0/tensorflow/core/grappler/optimizers/auto_mixed_precision_lists.h) so feel confident about this change.

@AndrewZhaoLuo
Copy link
Contributor Author

cc @anwang2009

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@masahi masahi merged commit 2493aeb into apache:main Jan 7, 2022
ylc pushed a commit to ylc/tvm that referenced this pull request Feb 16, 2022
* add new mixed precision ops

* remove space

* Update python/tvm/relay/transform/mixed_precision.py

Co-authored-by: Cody Yu <[email protected]>

Co-authored-by: Cody Yu <[email protected]>
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