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: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Mon, 27 Oct 2014 18:00:13 +0400
- 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> <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> <Pine dot LNX dot 4 dot 64 dot 1410211517340 dot 31277 at digraph dot polyomino dot org dot uk> <CAMXFM3t8xjQ7A6TF1SpY0GwzKpTQ9hZej4vKvSYHnnsxGkaONA at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410232117130 dot 19073 at digraph dot polyomino dot org dot uk>
2014-10-24 1:37 GMT+04:00 Joseph S. Myers <joseph@codesourcery.com>:
> On Thu, 23 Oct 2014, Andrew Senkevich wrote:
>
>> Let me know if such changes ok in general.
>
> I'm not clear we yet reached consensus on whether glibc is the right place
> for this; I think that discussion tailed off without a clear conclusion,
> and someone needs to reread it, post a careful analysis of the discussion
> so far and try to help the community reach consensus.
It was already decided and written in Consensus paragraph on wiki in
https://sourceware.org/ml/libc-alpha/2014-09/msg00596.html.
Link to wiki - https://sourceware.org/glibc/wiki/libm#Consensus
>> +# define __DECL_SIMD_cos __DECL_SIMD_AVX2
>> +# define __DECL_SIMD_cosf __DECL_SIMD_SSE4
>> +# elif defined _CILKPLUS && _CILKPLUS >= 0
>> +/* CilkPlus case. TODO _CILKPLUS currently nowhere defined */
>> +# define __DECL_SIMD_AVX2 __attribute__((__vector__(nomask)))
>> +# define __DECL_SIMD_SSE4 __attribute__((__vector__(processor(core_i7_sse4_2),\
>> + nomask)))
>
> And as previously noted, this needs to be fixed to be namespace-clean -
> using __nomask__, __processor__, __core_i7_sse4_2__.
It seems there are no such reserved-namespace word versions now...
>> +#if defined TEST_MATHVEC
>
> No, you can't have such conditionals on a macro in the user's namespace in
> an installed header.
Then we have to build vector tests with -D__FAST_MATH__
-DTEST_FAST_MATH -D_OPENMP=201307 to be sure we have needed
definitions from math.h?
>> diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
>> index c9f9a51..91c4cdf 100644
>> --- a/sysdeps/x86_64/configure.ac
>> +++ b/sysdeps/x86_64/configure.ac
>> @@ -5,6 +5,24 @@ AC_CHECK_HEADER([cpuid.h], ,
>> [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])],
>> [/* No default includes. */])
>>
>> +dnl Check if compiler target is x86_64.
>
> Not needed. preconfigure fragments in sysdeps directories need to check
> the architecture, but configure ones don't (they'll only be run for the
> relevant architecture, unless one fragment explicitly sources another).
Clear, then it can be done in root configure like so:
+if test x"$build_mathvec" = xnotset; then
+ if test x"$machine" = xx86_64/64; then
+ build_mathvec=yes
+ else
+ build_mathvec=no
+ fi
+fi
+LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
--
WBR,
Andrew