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

Use bit shifts in generic and byte_shuffle reverse #728

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

argilo
Copy link
Member

@argilo argilo commented Dec 16, 2023

Using bit shifts instead of bit fields seems to be much more compiler-friendly, and results in large speedups with both GCC & Clang, across x86_64, aarch64, and armhf. When compiling with Clang, the generic protokernel comes close to being the fastest protokernel on all three architectures.

Compiler generic before generic after byte_shuffle before byte_shuffle after
GCC x86_64 2687 389 3193 167
Clang x86_64 1398 46 4883 168
GCC aarch64 (Pi 5) 3406 1887 4007 458
Clang aarch64 (Pi 5) 1187 78 5089 111
GCC armhf (Pi 4) 6674 4331 5771 963
Clang armhf (Pi 4) 3322 321 6994 1022

@marcusmueller
Copy link
Member

Obvious win! It's interesting how much clang and gcc diverge here, and also, that there's no consistency in which implementation wins. Fun fact, looking at disassebly, here: clang reworks the the generic bit shift implementation into the bintree_permute_top_donw code, basically, for AVX2 (which explains why run times are near identical).

@argilo
Copy link
Member Author

argilo commented Dec 16, 2023

Clang is also smart enough to use rbit on ARM, which explains why the generic protokernel does so well.

Copy link
Contributor

@jdemel jdemel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. A nice performance win. Also, this is an interesting data point that Clang might produce faster code than GCC.

@jdemel jdemel merged commit b8e7801 into gnuradio:main Dec 17, 2023
33 checks passed
Alesha72003 pushed a commit to Alesha72003/volk that referenced this pull request May 15, 2024
Use bit shifts in generic and byte_shuffle reverse
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