This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] BZ #14649: Add multiarch FMA support to x86-64 libm


On Tue, Oct 2, 2012 at 12:03 AM, Andreas Jaeger <aj@suse.com> wrote:
> On 10/01/2012 08:49 PM, H.J. Lu wrote:
>>
>> On Mon, Oct 1, 2012 at 10:56 AM, Andreas Jaeger <aj@suse.com> wrote:
>>>
>>> On 10/01/2012 05:14 PM, H.J. Lu wrote:
>>>>
>>>>
>>>> Hi,
>>>>
>>>> This patch adds multiarch FMA support to x86-64 libm.  Tested on
>>>> FMA machine.  OK for master?
>>>
>>>
>>>
>>> What kind of performance benefits does it bring us? Are you sure that all
>>
>>
>> I don't have any performance numbers.  My patch just
>> enables FMA optimization, similar to FMA4 optimization.
>
>
> Could you test at least one of these functions to see whether it makes a
> difference at all, please?

It works correctly on FMA machine.  I will send a separate patch
to update x86-64 ULPs due to FMA instructions.  FMA functions
are a little bit smaller than SSE/AVX version.

>
>>> the functions you enhance are really using fma and thus benefit from the
>>> change?
>>
>>
>> Not all FMA/FMA4 functions have FMA/FMA4 instructions.  We should
>> take a look and use AVX functions instead.
>
>
> So, let's only add those functions that really benefit from this.
>

Since functions in libm are implemented by calling each other,
all functions called from a libm function compiled for FMA must
also be compiled by FMA with _fma as the suffix in their symbol
names.  Otherwise, wrong functions may be called.   One way
to address t is to add multi-arch support to all libm internal functions
so that the right functions will always be used.  But it is a much
bigger change and will introduce run-time IFUNC relocations.
It may save some text space since AVX, FMA and FMA4 versions
can share AVX version if no FMA instructions are used.

Here is the updated patch with -mfma check.  OK to install?

Thanks.

-- 
H.J.

Attachment: 0002-Add-multiarch-FMA-support-to-x86-64-libm.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]