[PATCH 7/14] [x86_64] Vector math functions (log and tests)
Andrew Senkevich
andrew.n.senkevich@gmail.com
Wed Jun 10 15:09:00 GMT 2015
2015-06-05 19:40 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Fri, 5 Jun 2015, Andrew Senkevich wrote:
>
>> 2015-06-04 20:44 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
>> > On Thu, 4 Jun 2015, Andrew Senkevich wrote:
>> >
>> >> This patch adds vector implementations of log for x86_64 and tests.
>> >
>> > I see this patch adds e.g. both _ZGVbN2v_log and _ZGVbN2v___log_finite, as
>> > aliases.
>> >
>> > That's the sort of thing that needs specifically explaining in the patch
>> > write-up. In general, it's a bad idea to add extra interfaces to any of
>> > glibc's shared libraries unless they actually have some sort of semantic
>> > difference (or unless the interfaces are required to be usable without
>> > including any headers) - and since all these vector functions are only for
>> > -ffast-math, I don't think there is any semantic difference in the _finite
>> > case.
>> >
>> > My guess is that this is something to do with interaction of the pragmas
>> > that cause these functions to be used and the asm redirection of e.g. log
>> > to __log_finite (for -ffinite-math-only, which is implied by -ffast-math).
>> > Now, I suppose you do want that redirection to be in effect for calls that
>> > don't get vectorized. So I think you should try to work something out in
>> > the compiler context as a way to say "vector calls should have their names
>> > based on log not __log_finite, notwithstanding the redirection for scalar
>> > calls", so we can avoid adding redundant ABIs to libmvec that are never
>> > going to do anything different from the non-__*_finite ABIs.
>>
>> Such aliases were added because GCC generates vector name based on
>> scalar one already containing _finite redirection.
>> May be stay only _ZGV*N*v___log_finite symbols?
>
> How about having only the non-_finite symbols (which seems cleaner), with
> top-level __asm__ ("_ZGVbN2v___log_finite = _ZGVbN2v_log") etc. in the
> headers as a workaround until a conclusion is reached in the compiler
> context on a cleaner way to base the vector names on something other than
> the scalar asm name?
Attached patch contains such asm redirections in
sysdeps/x86/fpu/bits/math-vector.h.
Description and changelog:
Vector log for x86_64 and tests.
Here is implementation of vectorized log containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.
* bits/libm-simd-decl-stubs.h: Added stubs for log.
* math/bits/mathcalls.h: Added log declaration with __MATHCALL_VEC.
* sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New versions added.
* sysdeps/x86/fpu/bits/math-vector.h: SIMD declaration and asm
redirections for log.
* sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
* sysdeps/x86_64/fpu/Versions: New versions added.
* sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
* sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
build of SSE, AVX2 and AVX512 IFUNC versions.
* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core.S: New file.
* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core_sse4.S: New file.
* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core.S: New file.
* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core_avx2.S: New file.
* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.S: New file.
* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S: New file.
* sysdeps/x86_64/fpu/svml_d_log2_core.S: New file.
* sysdeps/x86_64/fpu/svml_d_log4_core.S: New file.
* sysdeps/x86_64/fpu/svml_d_log4_core_avx.S: New file.
* sysdeps/x86_64/fpu/svml_d_log8_core.S: New file.
* sysdeps/x86_64/fpu/svml_d_log_data.S: New file.
* sysdeps/x86_64/fpu/svml_d_log_data.h: New file.
* sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Added
vector log test.
* sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
* NEWS: Mention addition of x86_64 vector log.
Is it ok?
--
WBR,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-x86-64-vector-log-and-tests.patch
Type: application/octet-stream
Size: 94101 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150610/05897273/attachment.obj>
More information about the Libc-alpha
mailing list