Refactor GELU and Sigmoid epilogue to use a common template (and add SiLu, Hardswish epilogue)#379
Conversation
|
ok I've pushed two activation using this common template. |
|
Thanks for helping clean this up! Can you add documentation with a short description and links to resources to the SiLu and HardSwish structs for future reference? |
|
@d-k-b Thanks for the feedback, the doc is updated. |
|
Overall, looks good to me. I think just change |
|
Oops thanks for spotting this, fixed. |
|
Not sure why Ci has failed |
|
These 4 activations look expensive to me. You can try to set If you setting them to |
My patch respects the current choice for the existing epilogues: false . cutlass/include/cutlass/epilogue/threadblock/epilogue_base.h Lines 73 to 76 in 80e8fe7 For the two new activations, my reasoning was |
|
SGTM.
|
|
Making sigmoid and silu |
Vectorized one has less instruction and less burden to I$. |
You can update your TVM PR now. :) |
…SiLu, Hardswish epilogue) (NVIDIA#379) * Support half precision sigmoid activation * introduce a vectorized variant using fast_tanh * refactored sigmoid using the new interface * refactored gelu * add silu activation * add hardswish * remove sigmoid for now * add description to silu and hardswish, and other doc update * Do not ignore Round * use constant N * Set isHeavy = true in sigmoid and silu epilogue
Since Sigmoid and GeLU epilogue functors are almost identical, I propose to refactor them. The motivation is to make it easy to add another functors.
Now Sigmoid and GeLU epilogue functors are defined as:
I'm going to add two new functors for
SiLUandHardSwishactivation, which can be implemented in the same manner.What do you think? @hwu36