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

Unroll some tight loops #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Unroll some tight loops #235

wants to merge 1 commit into from

Conversation

howard0su
Copy link
Collaborator

No description provided.

@fventuri
Copy link
Collaborator

fventuri commented Jul 6, 2024

Good idea Howard!
I don't know how C++ compilers work these days, but perhaps a block like this:

            *output++ = float(*input++);
            *output++ = float(*input++);
            *output++ = float(*input++);
            *output++ = float(*input++);

could be replaced by something like this:

            const int16_t *in = input + 4 * m;
            float *out = output + 4 * m;
            out[0] = float(int[0]);
            out[1] = float(int[1]);
            out[2] = float(int[2]);
            out[3] = float(int[3]);

I don't know if from the point of the compiler the second option could use SIMD instructions, since there are no output+_ and input++ around, but perhaps the compiler figures it out since it is idiomatic.

There's also the volk library (https://www.libvolk.org/) that has a couple of functions called 'volk_16i_s32f_convert_32f' (https://www.libvolk.org/doxygen/volk_16i_s32f_convert_32f.html) and 'volk_16ic_convert_32fc' (https://www.libvolk.org/doxygen/volk_16ic_convert_32fc.html), which are optimized for different types of hardware, but I am not sure if its license (GPL v3) is compatible with this project's license.

Franco

@howard0su
Copy link
Collaborator Author

howard0su commented Jul 6, 2024 via email

@cozycactus
Copy link
Contributor

what do you think about fast int16_t to float conversion like this https://github.com/m-ou-se/floatconv
when i did perf it showed conversion takes many cpu %

@cozycactus
Copy link
Contributor

@howard0su
Copy link
Collaborator Author

howard0su commented Jul 7, 2024 via email

@cozycactus
Copy link
Contributor

i tried this optimization and i have found only convert_float one showed under one percent better cpu usage on r2iq thread...

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

Successfully merging this pull request may close these issues.

3 participants