-
Notifications
You must be signed in to change notification settings - Fork 110
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
[RFC] Add result accuracy to unary ops #2592
base: main
Are you sure you want to change the base?
Conversation
Proposal to add result_accuracy to the following transcendental unary ops: `exp`, `expm1`, `log`, `logp1`, `logistic` and `tanh`.
[RFC] Add result accuracy to transcendental unary ops
add description of the modes.
rfcs/20241015-result-accuracy.md
Outdated
## Overview | ||
|
||
This RFC proposes adding a new attribute `result_accuracy` to the following | ||
transcendental unary ops: `exp`, `expm1`, `log`, `logp1`, `logistic` and `tanh`. |
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.
Is there a reason sqrt and rsqrt is not in the list?
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.
Yeah, it should be should be supported for sqrt, rsqrt, cos, sin and recp too. Will update the doc.
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.
What is recp
? I don't think we have an op for that
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.
FYI atan2
and tan
are the two remaining transcendental ops not in this list (atan2
seems to be the only binary op)
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.
recp is divide. So the complete list will be sin, cos, tan, divide, sqrt, rqrt, cbrt, exp, expm1, log, logp1, logistic and erf. Is erf supported?
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.
This would make divide the only binary op on this list.. which feels strange. Is this right that this proposal should be extended in scope to binary ops?
The inequality will be checked against the errors of each implementation and the | ||
one that can satisfy the constraint will be returned. If multiple | ||
implementations satisfy the inequality, the faster implementation will be used. | ||
If none of the implementations can meet the requested tolerance, the compiler |
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.
Naive question - Does this mean it's a runtime check that's inserted by the compiler?
Or there's some upfront guarantee / check that's promised by underlying implementations? My interpretation of this sentence makes it sound like the compiler has to first run the operation, then check that the result accuracy was correct and return if error.
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.
No runtime checks, the compiler will look check the request against its implementation errors at compile time.
This is a proposal to add
result_accuracy
attribute to the following transcendental unary ops to StableHLO:exp
,expm1
,log
,logp1
,logistic
,recp
,sqrt
,rsqrt
,cbrt
,sin
,cos
andtanh
. Any feedback would be appreciated, thanks!