-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libc][bazel] Enable software prefetching for memcpy #108939
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will affect only Bazel configuration for now.
@llvm/pr-subscribers-libc Author: Guillaume Chatelet (gchatelet) ChangesThis will affect only Bazel configuration for now. Full diff: https://github.com/llvm/llvm-project/pull/108939.diff 1 Files Affected:
diff --git a/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl b/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
index f65da9e98226b6..96d7fa86e9ddf2 100644
--- a/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
@@ -24,7 +24,7 @@ LIBC_CONFIGURE_OPTIONS = [
# Documentation in libc/src/string/memory_utils/...
# "LIBC_COPT_MEMCPY_USE_EMBEDDED_TINY",
# "LIBC_COPT_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE",
- # "LIBC_COPT_MEMCPY_X86_USE_SOFTWARE_PREFETCHING",
+ "LIBC_COPT_MEMCPY_X86_USE_SOFTWARE_PREFETCHING",
"LIBC_COPT_MEMSET_X86_USE_SOFTWARE_PREFETCHING",
# Documentation in libc/docs/dev/printf_behavior.rst
|
michaelrj-google
approved these changes
Sep 17, 2024
gchatelet
added a commit
that referenced
this pull request
Oct 7, 2024
Reverts #108939 When `AVX` is available but `-mprefer-vector-width=128` some of the `mov` instructions turn into the x86 `rep;movsb` instruction leading to poor performance on "old" architectures (sandybridge, haswell). The possible solutions are : get rid of the `-mprefer-vector-width` option or use smaller static copy sizes in `inline_memcpy_x86_sse2_ge64_sw_prefetching`. Right now a copy size of 3 cache lines (192B) relying exclusively on xmm registers gets turned into `rep;movsb`.
gchatelet
added a commit
to gchatelet/llvm-project
that referenced
this pull request
Oct 21, 2024
…movsb` When using `-mprefer-vector-width=128` with `-march=sandybridge` copying 3 cache lines in one go (192B) gets converted into `rep;movsb` which translate into a 60% hit in performance. Consecutive calls to `__builtin_memcpy_inline` (implementation behind `builtin::Memcpy::block_offset`) are not coalesced by the compiler and so calling it three times in a row generates the desired assembly. It only differs in the interleaving of the loads and stores and does not affect performance. This is needed to reland llvm#108939.
gchatelet
added a commit
that referenced
this pull request
Oct 22, 2024
…movsb` (#113161) When using `-mprefer-vector-width=128` with `-march=sandybridge` copying 3 cache lines in one go (192B) gets converted into `rep;movsb` which translate into a 60% hit in performance. Consecutive calls to `__builtin_memcpy_inline` (implementation behind `builtin::Memcpy::block_offset`) are not coalesced by the compiler and so calling it three times in a row generates the desired assembly. It only differs in the interleaving of the loads and stores and does not affect performance. This is needed to reland #108939.
gchatelet
added a commit
to gchatelet/llvm-project
that referenced
this pull request
Oct 28, 2024
This will affect only Bazel configuration for now. This is a reland of llvm#108939 which has been reverted because of codegen issues fixed by llvm#113161.
gchatelet
added a commit
that referenced
this pull request
Oct 28, 2024
NoumanAmir657
pushed a commit
to NoumanAmir657/llvm-project
that referenced
this pull request
Nov 4, 2024
…3886) This will affect only Bazel configuration for now. This is a reland of llvm#108939 which has been reverted because of codegen issues fixed by llvm#113161.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will affect only Bazel configuration for now.