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

Switch to a better memmove #2984

Draft
wants to merge 4 commits into
base: community
Choose a base branch
from
Draft

Switch to a better memmove #2984

wants to merge 4 commits into from

Conversation

stellar-aria
Copy link
Collaborator

@stellar-aria stellar-aria commented Nov 27, 2024

This changes the (extremely naive) memmove implementation out for one that progressively copies in larger blocks until it reaches 8 quadwords.

Copy link
Contributor

github-actions bot commented Nov 27, 2024

Test Results

106 tests  ±0   106 ✅ ±0   0s ⏱️ -1s
 16 suites ±0     0 💤 ±0 
 16 files   ±0     0 ❌ ±0 

Results for commit 19c9875. ± Comparison against base commit 6eab902.

♻️ This comment has been updated with latest results.

@stellar-aria stellar-aria marked this pull request as draft November 27, 2024 20:06
@stellar-aria
Copy link
Collaborator Author

stellar-aria commented Nov 27, 2024

Had to check for correctness after realizing that building for Release disabled my test assertions in the benchmark/test. New implementation passed.

@stellar-aria stellar-aria marked this pull request as ready for review November 27, 2024 20:09
src/deluge/dsp/memmove.c Outdated Show resolved Hide resolved
src/deluge/dsp/memmove.c Outdated Show resolved Hide resolved
src/deluge/dsp/memmove.c Outdated Show resolved Hide resolved
src/mem_functions.h Outdated Show resolved Hide resolved
@stellar-aria
Copy link
Collaborator Author

Apparently the multi-load/multi-store intrinsics are new to GCC 14.2 :(

@nikodemus
Copy link
Collaborator

Idle thought: there's not a ton of memmove use-sites, I wonder if we could guarantee a healthy (like quadword) alignment for most?

@stellar-aria
Copy link
Collaborator Author

Idle thought: there's not a ton of memmove use-sites, I wonder if we could guarantee a healthy (like quadword) alignment for most?

We probably could, but better to just have an agnostic algorithm that's really fast anyways like this one and not accidentally get caught up when something in std:: uses it.

Copy link
Collaborator

@m-m-adams m-m-adams left a comment

Choose a reason for hiding this comment

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

lgtm but also we should remember to update these when gcc is updated, this generates worse assembly than the vld1q_u8_x4 intrinsic

@stellar-aria
Copy link
Collaborator Author

lgtm but also we should remember to update these when gcc is updated, this generates worse assembly than the vld1q_u8_x4 intrinsic

Considering we'll likely get 14.2 this week, I'll probably just rip 'em out before the merge even happens. They'll collide and error otherwise

@stellar-aria stellar-aria marked this pull request as draft December 16, 2024 23:20
@stellar-aria
Copy link
Collaborator Author

Currently blocked by xpack-dev-tools/arm-none-eabi-gcc-xpack#38

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