-
Notifications
You must be signed in to change notification settings - Fork 92
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
#5424: Clean up Sfpu Sign kernel api #16809
base: main
Are you sure you want to change the base?
Conversation
@@ -18,8 +18,10 @@ inline void llk_math_eltwise_unary_sfpu_sign_init() { | |||
} | |||
|
|||
template <bool APPROXIMATE> |
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.
Can you add a comment here explaining the exponent_size_8
flag and why its defaulted to 1?
@@ -18,8 +18,10 @@ inline void llk_math_eltwise_unary_sfpu_sign_init() { | |||
} | |||
|
|||
template <bool APPROXIMATE> |
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.
Same thing here, a small comment about exponent_size_8
@@ -18,8 +18,10 @@ inline void llk_math_eltwise_unary_sfpu_sign_init() { | |||
} | |||
|
|||
template <bool APPROXIMATE> |
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.
Same thing here
@@ -61,6 +62,8 @@ bfloat16 sfpu_function(const string& op_name, const bfloat16& input) { | |||
return bfloat16(logf(input.to_float())); | |||
} else if (op_name == "tanh") { | |||
return bfloat16(std::tanh(input.to_float())); | |||
} else if (op_name == "sign") { | |||
return bfloat16((0.0f < input.to_float()) ? 1.0f : ((input.to_float() < 0.0f) ? -1.0f : 0.0f)); |
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.
Have you checked what it does when you give it -0.0f ?
Ticket
Link to Github Issue
Problem description
Ckernel sfpu functions are implemented both in third party llk layer and metal llk api layer. The goal is to remove any duplicates and have llk api layer to call the implementation in third party. This PR is concerned with the clean up (i.e. removal of duplicates) of the calculate_sign API located at:
What's changed
Removed duplicate implementation for all architectures (i.e. bh, wh and gs). This API now calls the corresponding third party function calculate_sign that implements the functionality. Added test case in the sfpu_compute test suite for llks.
Checklist