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: RFC: Automatically test IFUNC implementations


On 09/24/2012 05:55 PM, H.J. Lu wrote:
On Sun, Sep 23, 2012 at 6:02 PM, Andreas Jaeger <aj@suse.com> wrote:
On 09/23/2012 06:05 PM, H.J. Lu wrote:

Hi,


http://sourceware.org/bugzilla/show_bug.cgi?id=14602

shows that we need to test all IFUNC implementations as much as we can.
I created hjl/ifunc/test branch to automatically test IFUNC
implementations.  Its goals are

1. Provide an infrastructure to tests all implementations supported
on build machine automatically.


Yes, this is something we really need.


2. No changes to IFUNC selectors.
3. Test the new IFUNC implementation by adding it to the list of
IFUNC functions.

Change IFUNC selector is not the goal of this branch. Any comments?


I haven't looked at the branch in detail - and don't understand what you
mean with 3.


Takes x86-64 memcpy as example, libc-func.c has


extern __typeof (memcpy) __memcpy_sse2;
extern __typeof (memcpy) __memcpy_ssse3;
extern __typeof (memcpy) __memcpy_ssse3_back;

static const struct libc_func_test memcpy_list[] =
{
   LIBC_FUNC_INIT (__memcpy_ssse3_back),
   LIBC_FUNC_INIT (__memcpy_ssse3),
   LIBC_FUNC_INIT (__memcpy_sse2),
   { NULL, NULL },
};

static const struct libc_func_test *
find_memcpy (void)
{
   return memcpy_list + (HAS_SSSE3 ? 0 : 2);
}

const struct libc_func_test *
__libc_func (const char *name)
{
  ...
   if (strcmp (name, "memcpy") == 0)
     return find_memcpy ();

__libc_func ("memcpy") returns a list of memcpy functions
supported in build machine.  When we add an AVX optimized
memcpy,  all what we have to do is

extern __typeof (memcpy) __memcpy_sse2;
extern __typeof (memcpy) __memcpy_ssse3;
extern __typeof (memcpy) __memcpy_ssse3_back;
extern __typeof (memcpy) __memcpy_avx;

static const struct libc_func_test memcpy_list[] =
{
   LIBC_FUNC_INIT (__memcpy_avx),
   LIBC_FUNC_INIT (__memcpy_ssse3_back),
   LIBC_FUNC_INIT (__memcpy_ssse3),
   LIBC_FUNC_INIT (__memcpy_sse2),
   { NULL, NULL },
};

static const struct libc_func_test *
find_memcpy (void)
{
   return memcpy_list + (HAS_AVX ? 0 : (HAS_SSSE3 ? 1: 3));
}

So, you return the first element that is supported on that architecture with the assumption that all the following are supported as well. I hope that assumption stays valid, please document it somewhere at least.


Now AVX memcpy will be tested automatically on AVX
build machine.  This commit:

http://sourceware.org/git/?p=glibc.git;a=patch;h=9728fd2ccffac52c3ab3212158646b2e170c76a1

is an example to test new IFUNC implementations.

Yes, this should work, Andreas -- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126


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