public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: enh <enh@google.com>
To: Zack Weinberg <zack@owlfolio.org>
Cc: Richard Henderson <richard.henderson@linaro.org>,
	libc-alpha@sourceware.org
Subject: Re: Maybe we should get rid of ifuncs
Date: Wed, 24 Apr 2024 08:09:24 -0700	[thread overview]
Message-ID: <CAJgzZorJpwnMmYFB1CK5Vys0JSx4mZ+nVkkVRzckh0OFBDCVyw@mail.gmail.com> (raw)
In-Reply-To: <D0SFLF8OIMBC.1EBZ7PS3F0ECV@owlfolio.org>

On Wed, Apr 24, 2024 at 7:43 AM Zack Weinberg <zack@owlfolio.org> wrote:
>
> On Tue Apr 23, 2024 at 9:41 PM EDT, Richard Henderson wrote:
> > On 4/23/24 11:14, Zack Weinberg wrote:
> > > (2) Are there existing ifuncs that perform CPU-capability-based
> > > function selection that*could not*  be replaced with an array of bit
> > > vectors like what I sketched in the previous paragraph?
> >
> > How much is in actual use, I have no idea.  However:
> > Even x86 cpuid generates a staggeringly large bit vector.
>
> Oof, yeah.  sizeof(struct cpu_features) == 488 on x86_64, and over
> half of that is cpuid dumps.  It probably _could_ be compacted,
> but as Florian pointed out any compaction we implement means glibc
> has to be updated for new CPU features (but then again we have to
> do that _anyway_...)
>
> Another thing that looking at cpu_features makes obvious is that
> several architectures include numbers that can't easily be reduced
> to one-hot representation.  It'd be reasonable to want to dispatch on
> cache line size, for instance.  I don't like the idea of embedding
> something even vaguely resembling a bytecode interpreter in ld.so,
> and yet...
>
> I'm very curious what the plan for function multiversioning in GCC
> and LLVM is, and how close to declarative it gets.

https://github.com/ARM-software/acle/blob/main/main/acle.md#function-multi-versioning
is the arm64 spec. the generated code is basically an ifunc resolver
that does "if ((hwcap & ... ) && (hwcap2 & ...))".

you can see the basic idea in https://reviews.llvm.org/D155026.

> zw

  reply	other threads:[~2024-04-24 15:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 18:14 Zack Weinberg
2024-04-23 18:39 ` enh
2024-04-23 19:46   ` Palmer Dabbelt
2024-04-24 13:56   ` Zack Weinberg
2024-04-24 14:25     ` enh
2024-04-23 18:52 ` Sam James
2024-04-23 18:54 ` Florian Weimer
2024-04-24 13:53   ` Zack Weinberg
2024-04-23 19:26 ` Andreas Schwab
2024-04-24 13:54   ` Zack Weinberg
2024-04-24  1:41 ` Richard Henderson
2024-04-24 14:43   ` Zack Weinberg
2024-04-24 15:09     ` enh [this message]
2024-04-28  0:24     ` Peter Bergner
2024-05-02  2:59       ` Michael Meissner
2024-04-30  8:42 ` Simon Josefsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJgzZorJpwnMmYFB1CK5Vys0JSx4mZ+nVkkVRzckh0OFBDCVyw@mail.gmail.com \
    --to=enh@google.com \
    --cc=libc-alpha@sourceware.org \
    --cc=richard.henderson@linaro.org \
    --cc=zack@owlfolio.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).