[PATCH v2 3/3] powerpc64le: Add glibc-hwcaps support

Florian Weimer fweimer@redhat.com
Wed Nov 4 19:56:05 GMT 2020


* Segher Boessenkool:

>> > -mcpu=power10 enables MMA.  If you do not want all Power10 features, you
>> > should not use -mcpu=power10.  It is that simple.
>> 
>> Then we need a different name, or require MMA for the "power10"
>> glibc-hwcaps subdirectory.
>
> Or do nothing.  Glibc doesn't use any MMA code, does it?  This is never
> generated automatically, you need to really ask for it in your source
> code.

glibc's internal use does not matter in this context.  Programmers must
be able to drop their own libraries built with -mcpu=power10 into the
power10 subdirectory.  If GCC turns on MMA by default for this switch
and glibc selects the power10 subdirectory without checking for MMA
support, then this isn't guaranteed to work.

We have been through this with x86-64 already.  I don't want to produce
the same bug.

>> > Since powerpc64le-linux requires Power8 or later, you always have VMX
>> > and VSX enabled there.  In exactly that same way.
>> >
>> > GCC never generates anything MMA that the user did not explicitly ask
>> > for in the source code (with builtins, say), so this is not an issue.
>> > Compare this with hardware DFP.
>> 
>> GCC defines __MMA__ for -mcpu=power10, and source code will evenually be
>> sensitive to that macro.
>
> That macro simply says that source code can use MMA builtins and the
> like.  Is it important for glibc whether user code uses MMA?

Yes, we can only load code that is built to use MMA unconditionally
(potentially) if the system supports MMA.

And in the future, GCC might recognize common code patterns with
-ftree-loop-vectorize and replace them with MMA intrinsics.

>> I think it is important that -mcpu=power10 and the "power10"
>> subdirectory mean the same thing.
>
> -mcpu=power10 means "generate code optimised for power10" (and: "it will
> probably not run on cpus not compatible to power10").
>
> Is that what that subdir holds as well?

Yes, that's the idea.  The programmer can also drop a -mcpu=power9
library into the power9 subdirectory.  The difference to the existing
AT_PLATFORM subdirectory is that on POWER10, both subdirectories (power9
and power10) are searched.  With AT_PLATFORM on POWER10, only power10
would be searched.  (And we're also fixing a silent on-disk format
change in the way AT_PLATFORM libraries are represented in ld.so.cache.)

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-alpha mailing list