Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generators of headers for inlining whole sleef functions #282

Closed
shibatch opened this issue Feb 18, 2020 · 5 comments
Closed

Add generators of headers for inlining whole sleef functions #282

shibatch opened this issue Feb 18, 2020 · 5 comments

Comments

@shibatch
Copy link
Owner

There have been several requests for providing vectorized SLEEF functions in a header file,

#230

It turned out that this functionality is not too hard to implement.
We can use C preprocessor (cpp) to generate such header files.
We will apply cpp a few times to sleefsimddp.c and sleefsimdsp.c with SLEEF_GENHEADER macro and other appropriate macros defined.
Part of the codes in misc.h and helper files will be guarded with #if, so that irrelevant lines will not appear in the resulting header files.

A header file is generated for each vector extension.
The resulting header files contain inline functions defined in dd.h and df.h, and functions defined in sleefsimddp.c and sleefsimdsp.c with all the function names renamed to the ones specified in the standard SLEEF API.

Since the inline functions in helper files are not renamed, those header files with different vector extensions cannot be included from a same file.

An example of generated header file can be seen at the following URL.

http://www.aist-nara.ac.jp/~n-sibata/header_example/sleefinline_avx2.h

Please see the example of generated header file and let me know you thought.

@shibatch
Copy link
Owner Author

@fpetrogalli
Copy link
Collaborator

This sounds good to me in principle. One thing that you should make sure, it that duplication is minimal, if any is needed at all. This is to avoid having to update code in both the library and the header files when an algorithm is changed. Does that make sense?

@shibatch
Copy link
Owner Author

There will be almost no code duplication. Those header files are generated from the existing sleefsimddp.c and sleefsimdsp.c. Some of the macros have to be written in a special format in order to process them in a later stage.

@fpetrogalli
Copy link
Collaborator

Sounds good to me!

@blapie
Copy link
Collaborator

blapie commented Nov 23, 2023

I'm closing this issue as I believe it was solved by #283. Feel free to re-open if not the case or open a new issue.

@blapie blapie closed this as completed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants