[PATCH 15/15] x86_64: Add asinpif with FMA
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Feb 12 11:00:34 GMT 2025
On 11/02/25 17:13, Adhemerval Zanella Netto wrote:
>
>
> On 11/02/25 11:12, Adhemerval Zanella Netto wrote:
>>
>>
>> On 10/02/25 22:31, DJ Delorie wrote:
>>>
>>> LGTM
>>>
>>> Reviewed-by: DJ Delorie <dj@redhat.com>
>>>
>>> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>>>> The CORE-MATH asinpif implementation showed slight worse performance
>>>> when using x86_64 baseline ABI due its usage of fma on fast path.
>>>> This patch adds a ifunc variant with similar performance for x86_64-v3.
>>>
>>> Do you have the performance numbers to report?
>>
>> It turns out that Paul has suggested to just remove the fma operation [1]
>> on the fast-path; which makes the code faster on x86_64 and x86_64-v2
>> and the iFUNC variant not required anymore. I will update the asinpif
>> with the new performance numbers.
>>
>> [1] https://gitlab.inria.fr/core-math/core-math/-/commit/ccdd955b6fa614c8d88bd1d6fd323abaf43cfb3f
>
> So testing a glibc built for x86_64 with CORE-MATH extensive testing,
> along with the fma removal change [1] I am seeing a failure:
>
> gmake: Leaving directory '/tmp/core-math.M5zb5H/toto/asinpi'
> Running exhaustive check in --rndn mode...
> FAIL x=0x1.bc1fdep-4 ref=0x1.1b4bap-5 y=0x1.1b4b9ep-5
>
> I don't see this on aarch64, nor with x86_64-v3 because gcc optimize
> the polynomial evaluation with fma instructions.
>
> Paul, I think we are not seeing this issue because CORE-MATH extensive
> check.sh script always use -march=native; where with recent gcc on
> current chips will always use fma instructions. I think you will need
> to revert the CORE-MATH ccdd955b6fa614c8d88bd1d6fd323abaf43cfb3f patch.
>
> So I will use this patch as-is (since it passes both glibc testsuite
> and CORE-MATH extensive tests for x86_64, x86_64-v3, and aarch64)
> along with the asinpif FMA ifunc for x86_64.
>
> [1] https://gitlab.inria.fr/core-math/core-math/-/commit/ccdd955b6fa614c8d88bd1d6fd323abaf43cfb3f
The adjusted polynomial coefficients fixes the issues on x86_64 [1].
I will adjust the patch with this version.
[1] https://gitlab.inria.fr/core-math/core-math/-/commit/6ee58266fe4543511a3444ac4dff38318291cfac
More information about the Libc-alpha
mailing list