diff --git a/sycl/doc/extensions/experimental/sycl_ext_oneapi_bfloat16_math_functions.asciidoc b/sycl/doc/extensions/experimental/sycl_ext_oneapi_bfloat16_math_functions.asciidoc index 11dade8c226f0..d324ed06b32ac 100644 --- a/sycl/doc/extensions/experimental/sycl_ext_oneapi_bfloat16_math_functions.asciidoc +++ b/sycl/doc/extensions/experimental/sycl_ext_oneapi_bfloat16_math_functions.asciidoc @@ -57,14 +57,14 @@ specification. This extension adds `bfloat16` support to the `fma`, `fmin`, `fmax`, `fabs`, `isnan`, `ceil`, `floor`, `cos`, `sin`, `exp`, `exp2`, `exp10`, `log`, `log2`, -`log10`, `rint`, `sqrt`, `rsqrt` and `trunc` SYCL floating point math functions. -These functions can be used as element wise operations on matrices, supplementing -the `bfloat16` support in the sycl_ext_oneapi_matrix extension. +`log10`, `rint`, `sqrt`, `rsqrt`, `trunc` and `tanh` SYCL floating point math +functions. These functions can be used as element wise operations on matrices, +supplementing the `bfloat16` support in the sycl_ext_oneapi_matrix extension. The descriptions of the `fma`, `fmin`, `fmax`, `fabs`, `isnan`, `ceil`, `floor`, `cos`, `sin`, `exp`, `exp2`, `exp10`, `log`, `log2`, `log10`, `rint`, `sqrt`, -`rsqrt` and `trunc` SYCL floating point math functions can be found in the SYCL -specification: +`rsqrt`, `trunc` and `tanh` SYCL floating point math functions can be found in +the SYCL specification: https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_math_functions. [NOTE] diff --git a/sycl/include/sycl/ext/oneapi/experimental/bfloat16_math.hpp b/sycl/include/sycl/ext/oneapi/experimental/bfloat16_math.hpp index 72f64ac61060e..3fbc29fd8c4e0 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/bfloat16_math.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/bfloat16_math.hpp @@ -476,6 +476,10 @@ BFLOAT16_MATH_FP32_WRAPPERS(trunc) BFLOAT16_MATH_FP32_WRAPPERS_MARRAY(trunc) BFLOAT16_MATH_FP32_WRAPPERS_VEC(trunc) +BFLOAT16_MATH_FP32_WRAPPERS(tanh) +BFLOAT16_MATH_FP32_WRAPPERS_MARRAY(tanh) +BFLOAT16_MATH_FP32_WRAPPERS_VEC(tanh) + #undef BFLOAT16_MATH_FP32_WRAPPERS #undef BFLOAT16_MATH_FP32_WRAPPERS_MARRAY #undef BFLOAT16_MATH_FP32_WRAPPERS_VEC diff --git a/sycl/test-e2e/BFloat16/bfloat16_builtins.hpp b/sycl/test-e2e/BFloat16/bfloat16_builtins.hpp index fa7a45fe2402c..cc9b776480b56 100644 --- a/sycl/test-e2e/BFloat16/bfloat16_builtins.hpp +++ b/sycl/test-e2e/BFloat16/bfloat16_builtins.hpp @@ -187,6 +187,7 @@ void test() { TEST(exp10, 1); TEST(exp2, 1); TEST(rint, 1); + TEST(tanh, 1); // log, log2, log10, sqrt, rsqrt testing, the input // must be positive.