Re: [PATCH] amdgcn: Add vectorized math routines

Kwok Cheung Yeung <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hello

Sorry for the delay in replying. I've gone through the licenses for each 
file - apart from v64df_gamma.c ,v64sf_gamma.c, v64df_log10.c and 
v64sf_log10.c (which are all rather trivial), all the .c files already 
contain the copyright header from the file from which they were derived. 
A number of the original files simply had no license notice, so there 
was nothing to copy over.

No license:

v64_mathcnst.c, v64df_acos.c, v64df_asin.c, v64df_atan.c, v64df_atan2.c, 
v64df_cos.c, v64df_cosh.c, v64df_ispos.c, v64df_numtest.c, v64df_sin.c, 
v64df_sinh.c, v64sf_acos.c, v64sf_asin.c, v64sf_atan.c, v64sf_atan2.c, 
v64sf_cos.c, v64sf_cosh.c, v64sf_ispos.c, v64sf_numtest.c, v64sf_sin.c, 
v64sf_sinh.c

Sun Microsystems license:

v64df_acosh.c, v64df_asinh.c, v64df_atanh.c, v64df_copysign.c, 
v64df_erf.c, v64df_finite.c, v64df_fmod.c, v64df_gamma.c, v64df_hypot.c, 
v64df_ilogb.c, v64df_isnan.c, v64df_lgamma_r.c, v64df_lgamma.c, 
v64df_modf.c, v64df_pow.c, v64df_remainder.c, v64df_rint.c, 
v64df_scalb.c, v64df_scalbn.c, v64df_signif.c, v64df_tan.c, 
v64df_tgamma.c, v64sf_acosh.c, v64sf_asinh.c, v64sf_atanh.c, 
v64sf_copysign.c, v64sf_erf.c, v64sf_exp.c, v64sf_finite.c, 
v64sf_fmod.c, v64sf_gamma.c, v64sf_hypot.c, v64sf_ilogb.c, 
v64sf_isnan.c, v64sf_lgamma_r.c, v64sf_lgamma.c, v64sf_modf.c, 
v64sf_pow.c, v64sf_remainder.c, v64sf_rint.c, v64sf_scalb.c, 
v64sf_scalbn.c, v64sf_signif.c, v64sf_tan.c, v64sf_tgamma.c

Red Hat license:

v64df_exp2.c, v64sf_exp2.c

'Software Manual for the Elementary Functions' attribution:

v64df_asine.c, v64df_atangent.c, v64df_exp.c, v64df_log.c, 
v64df_log10.c, v64df_sine.c, v64df_sineh.c, v64df_sqrt.c, v64df_tanh.c, 
v64sf_asine.c, v64sf_atangent.c, v64sf_log.c, v64sf_log10.c, 
v64sf_sine.c, v64sf_sineh.c, v64sf_sqrt.c, v64sf_tanh.c

Original:

v64df_log2.c, v64sf_log2.c, v64_reent.c

The amdgcnmach.h file has portions from:

newlib/libm/common/fdlibm.h (Sun Microsystems license)
newlib/libm/mathfp/zmath.h (no license)
newlib/libm/common/math_errf.c (ARM license)
newlib/libm/common/math_config.h (ARM license)

so I have added the Sun and ARM copyright notices to the file. I have 
split off the vector macro library used by all the functions into a 
separate file amdgcn_veclib.h to make the authorship more clear, and 
have amdgcnmach.h include that.

I have added a copyright notice for Siemens (my parent company) at the 
top of each file, with terms similar to the usual MIT/BSD clauses.

Okay for inclusion in Newlib?

Thanks,

Kwok


> Hi Kwok,
> 
> You need to provide headers in all the source and include files.  Some
> files mention they are based on an existing
> newlib file.  Those files should copy the license header over and not just
> have a reference (imagine if
> someone were to delete the original file or rename it).  You are not
> allowed to change the licensing
> of a file you have based off of but you can add additional copyright info
> for your additions if you wish.
> 
> As mentioned you need to add a license header for the new amdgcnmatch.h
> header file that is used everywhere.
> 
> -- Jeff J.
> 
> On Fri, Dec 2, 2022 at 5:04 PM Kwok Cheung Yeung <[email protected]>
> wrote:
> 
>> Hello
>>
>> This patch implements a set of vectorized math routines for use by the
>> auto-vectorizer in GCC for the AMD GCN architecture. The implementation
>> is located in libm/machine/amdgcn, and is based on the current set of
>> scalar math routines in Newlib, from libm/common, libm/math and
>> libm/mathfp (where the level of accuracy was deemed sufficient for our
>> purposes). I have ensured that the copyright notices from the original
>> were retained.
>>
>> The vectorized routines make extensive use of the GCC vector extensions
>> for C, some GCN-specific builtins in GCC, and a SIMD abstraction library
>> located in libm/machine/amdgcn/amdgcnmach.h. As the builtins are a
>> recent addition to GCC, I have added #if statements to skip compilation
>> of the routines that use them to ensure that Newlib will still build for
>> older versions of GCC.
>>
>> Versions for 2-lane vectors up to 64-lane vectors (in powers of 2) are
>> provided for all public functions. Versions with <64 lanes (which is the
>> 'natural' vector width for AMD GCN) are shims that call the 64-lane
>> version with the unused lanes masked out.
>>
>> Okay for inclusion into Newlib?
>>
>> Thanks
>>
>> Kwok Yeung
0001-amdgcn-Add-vectorized-math-routines.patch (text/plain, 593.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.