-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor complex asin/acos/asinh/acosh to use asin_acos_kernel. Impro…
…ve real acos accuracy. (#2496) As in the title. This PR introduces asin_acos_kernel operation that implements modified Hull et al algorithm for evaluating complex asin, acos, asinh, and acosh operations. This task corresponds to the refactor request in #2411 (comment) and it resolves pearu/functional_algorithms#15. In addition, the PR also improves the real acos accuracy as a fix to #2452 . As a result, the accuracy of single-precision real acos improved as follows (using 1 million samples): ``` main this PR ULP difference == 0 count is 971713 -> 999045 ULP difference == 1 count is 28158 -> 962 ULP difference == 2 count is 54 -> 0 ULP difference == 3 count is 20 -> 0 ULP difference >= 4 count is 62 -> 0 ``` The cause of the revert by PR #2449 (`acos(-1) -> 0` while expecting `pi`) is fixed in functional_algorithms which now also generates extra samples that correspond to limiting values of real acos. For instance, `acos(-1)->pi`, `acos(nextafter(-1, -inf))->nan`, and `acos(nextafter(-1, int)-> approx pi` are now included in the tests. The required functional_algorithms version is now 0.9 which includes a fix to `fa.utils.real_samples` to return samples that are distributed uniformly with respect to ULP differences of neighboring samples. This fix lead to updates of `stablehlo/tests/math/*.mlir`.
- Loading branch information
Showing
24 changed files
with
1,069 additions
and
1,356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,214 changes: 616 additions & 598 deletions
1,214
stablehlo/tests/chlo/chlo_legalize_to_stablehlo.mlir
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.