RFC: Proposal for implementing libmvec on aarch64
Steve Ellcey
sellcey@cavium.com
Tue Mar 6 21:33:00 GMT 2018
This is an RFC for an approach to implementing libmvec vector math routines
for aarch64.  There are three patches attached to this email, one is a GCC
patch that allows aarch64 to generate calls to vector functions that are
marked with __attribute__ ((simd)), the second is the infrastructure part
of glibc changes that mark sin and cos with this attribute in the header files,
and the third is an implementation of vector sin and cos by adding ifdefs to
the existing scalar sin/cos functions in sysdeps/ieee754/dbl-64/s_sin.c.
I have several questions that I would like to get some feedback on:
Does the approach of modifying the existing scalar math routines to also
work on vector types, as opposed to having completely seperate vector
routines sound like a good approach?  I like it because it reduced the
amount of duplicated code between scalar and vector functions and should
keep the accuracy of scalar and vector routines in sync.  And since it is
written in C it can also be shared among multiple platforms.  The main
downside right now is the slow paths are still mostly handled serially
and so I am only seeing about a 5% improvement in a test that does sin
calls on an array of doubles.  I think more changes could be done to improve
the amount of parallelism in the vector versions but this is a start.
Perhaps we could remove some of the slow paths in the vector versions like
we do with the sincos function.
The current implementation does not build because when linking libmvec
it gets undefined externals for __branred, __docos, __dubsin, __mpcos,
__mpsin, and __sincostab.  How should this be handled?  Should they be
exported from libm so that libmvec can call them or should they beÂ
copied into libmvec so that they don't have to be externally visible?
Are there any issues with making libmvec depend on libm?
The vector ABI for aarch64 is not yet defined, I believe ARM is working
on that.  As you can see from the GCC patch I am just using the same
approach as x86 and just changed the vecsize_mangle variable to 'n' for
128 bit vectors on Aarch64.
Comments?
Steve Ellcey
sellcey@cavium.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simd-gcc.patch
Type: text/x-patch
Size: 4632 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20180306/5c3494c1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simd-glibc-infrastructure.patch
Type: text/x-patch
Size: 3643 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20180306/5c3494c1/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simd-glibc-sincos.patch
Type: text/x-patch
Size: 17476 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20180306/5c3494c1/attachment-0002.bin>
More information about the Libc-alpha
mailing list