libxsmm icon indicating copy to clipboard operation
libxsmm copied to clipboard

What GELU algorithm is used for LIBXSMM_MELTW_TYPE_UNARY_GELU?

Open jgong5 opened this issue 2 years ago • 3 comments

Is it tanh approximation?

jgong5 avatar Nov 14 '23 07:11 jgong5

No it's a direct minmax approximation. https://github.com/libxsmm/libxsmm/blob/main/src/generator_common_x86.c#L204 https://github.com/libxsmm/libxsmm/blob/main/src/generator_common_x86.c#L714

alheinecke avatar Nov 14 '23 13:11 alheinecke

No it's a direct minmax approximation. https://github.com/libxsmm/libxsmm/blob/main/src/generator_common_x86.c#L204 https://github.com/libxsmm/libxsmm/blob/main/src/generator_common_x86.c#L714

Thanks. Will you support tanh approximation too?

jgong5 avatar Nov 15 '23 00:11 jgong5

we have no plans for this as workloads converge with the current implementation. However, I can help you with guiding/submitting a PR following the same scheme (setting up const, computing x^3 and then using the minimax for tanh).

alheinecke avatar Nov 15 '23 01:11 alheinecke