-
Notifications
You must be signed in to change notification settings - Fork 330
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
Remove element type restriction in softmax lowering #3051
Remove element type restriction in softmax lowering #3051
Conversation
Signed-off-by: Sam <[email protected]>
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.
LGTM
Let me know if you want me to merge it @srcarroll |
thanks. yes please |
Jenkins Linux ppc64le Build #15190 [push] Remove element type rest... started at 12:32 |
Jenkins Linux amd64 Build #16161 [push] Remove element type rest... started at 11:13 |
Jenkins Linux s390x Build #16163 [push] Remove element type rest... started at 12:13 |
Jenkins Linux amd64 Build #16161 [push] Remove element type rest... passed after 1 hr 17 min |
Jenkins Linux s390x Build #16163 [push] Remove element type rest... passed after 1 hr 39 min |
Jenkins Linux ppc64le Build #15190 [push] Remove element type rest... passed after 2 hr 25 min |
Signed-off-by: Sam <[email protected]>
This patch removes the assertion that input element type is
f32
in the softmax to stablehlo lowering. There appears to be no good reason for this restriction as stablehlo supports more types.The original
Softmax.mlir
test has been renamed toSoftmax-Decompose.mlir
and replaced by a new one the leaves out thedecompose-onnx
pass. The primary reason for this is to be able to testbf16
lowering which is still not supported by the decomposition. An error is thrown while computing the identity for max reduction (see https://github.com/onnx/onnx-mlir/blob/main/src/Dialect/Mlir/DialectBuilder.cpp#L698). Since downstream users don't necessarily need the decomposition it suffices to test without it for now. However, plans to support lower precision types elsewhere is a todo.Note: The decomposition does stabilize softmax to prevent overflow, which is especially important for lower precision. Nevertheless, the straight conversion should allow it if people to choose to opt out of the decomp.