This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] How to add vector math functions to Glibc
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Tue, 21 Oct 2014 15:29:39 +0000
- Subject: Re: [RFC] How to add vector math functions to Glibc
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3tjquzniXP1weqxSVFJyhXqsf2PHuyrrrmqp7K0ZzORqA at mail dot gmail dot com> <CAMe9rOpacze055qyBFzz3M-b-GNtXCqZzMmkScBL9a94zVj28g at mail dot gmail dot com> <54247FAB dot 6050002 at redhat dot com> <CAMXFM3v8narOLMHC5U=fvyTFWV6s4ZACN-UrAC4fAcUs9SOFfA at mail dot gmail dot com> <54257507 dot 9070508 at redhat dot com> <CAMXFM3vOLspQtHxgJfD_Emht480w2RMbiwnEH6A_LhoS-JZFag at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1409301620020 dot 15186 at digraph dot polyomino dot org dot uk> <542AF92E dot 8090708 at lip6 dot fr> <Pine dot LNX dot 4 dot 64 dot 1409302003410 dot 12188 at digraph dot polyomino dot org dot uk> <CAMXFM3tuM_p6Acp4hzoQ2xzR=4BZqtw8NbezqY6h8V4Xx=5hUA at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410021411420 dot 24886 at digraph dot polyomino dot org dot uk> <CAMXFM3uPiuJvSpgmt+8d0B1qh3QSA=TVx0ZExfojDVHzrscL8A at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410091724031 dot 23641 at digraph dot polyomino dot org dot uk> <CAMXFM3uGOKqEAvGYew+9K7bmhObVmnP2u4kUOSh8_Cpwyk8s5g at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410162141290 dot 32736 at digraph dot polyomino dot org dot uk> <CAMXFM3tf3EE-WenvnVohkFCkHR9Dy4QfaSiSHcw6Q-1o9QGW_Q at mail dot gmail dot com>
On Tue, 21 Oct 2014, Andrew Senkevich wrote:
> > There shouldn't be such conditionals. It should be arranged that if
> > there isn't a relevant vector version of a particular function, running
> > vector tests for that function does nothing - so there are no conditionals
> > on which *_test functions to run, and none inside those functions, just
> > conditionals affecting what the test macros do (by means of conditionals
> > inside them such as if (HAVE_VECTOR_cos_double_vlen4), for example,
> > resulting from appropriate concatenations).
>
> With HAVE_VECTOR_cos_double_vlen4 we need to have such macros with
> zero for all set of not vector functions which is huge.
But I'd hope such macros could be generated by gen-libm-test.pl (or some
such script, anyway) rather than needing lots of repetitive definitions to
be maintained by hand and checked in.
Essentially:
* The architecture-specific headers (installed headers, or possibly
non-installed ones used only by the testsuite in some cases) contain the
information about what vector versions of what functions are available.
Things are designed so that they only need to contain definitions where
vector functions are available, not where they aren't (to avoid needing to
repeat slightly different huge lists for each architecture).
* Where a default definition to 0 is needed in any cases, the relevant
definitions are generated automatically. (Indeed, this might make sense
for a header included by bits/mathcalls.h, so that __MATHCALL can expand
to include the right __DECL_SIMD_*, which might end up empty, rather than
needing lots of #if conditionals before every function declaration there.)
(Incidentally, there have been so many different patch fragments posted in
this discussion that it's hard to follow what you're proposing, if e.g. in
the discussion of testing it's relevant to look at what you're proposing
for installed headers. I think it would help if you had a git branch with
the current set of proposed changes, that you frequently rebase so it
always shows what you currently propose.)
> May be more suitable way is to have determined name of vector function
> wrapper and selection based on function name?
> I mean to have something like this in test driver test-double-vlen4.c:
>
> #define HAVE_VECTOR 1
> #define VEC_PREFIX_STR "VECTOR_LEN_"
> #define cos VECTOR_LEN_4_cos
> #include "libm-test.c"
>
> in test-double-vlen4-wrapper.c:
>
> VECTOR_WRAPPER(VECTOR_LEN_4_cos,_ZGVdN4v_cos)
If you did something like that, I think it would still be desirable to
have some form of automatic generation of a list of defines, one per
function and conditional as needed on whether the relevant vector version
of that function exists.
--
Joseph S. Myers
joseph@codesourcery.com