[all-commits] [llvm/llvm-project] cb1468: [libc] Adding a version of memcpy w/ software pref...

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Fri Jul 7 03:37:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cb1468d3cbb7774332647dee3475d4e4f85c21e2
      https://github.com/llvm/llvm-project/commit/cb1468d3cbb7774332647dee3475d4e4f85c21e2
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2023-07-07 (Fri, 07 Jul 2023)

  Changed paths:
    M libc/src/string/CMakeLists.txt
    M libc/src/string/memory_utils/op_builtin.h
    M libc/src/string/memory_utils/x86_64/memcpy_implementations.h
    M utils/bazel/llvm-project-overlay/libc/BUILD.bazel

  Log Message:
  -----------
  [libc] Adding a version of memcpy w/ software prefetching

For machines with a lot of cores, hardware prefetchers can saturate the memory bus when utilization is high.
In this case it is desirable to turn off the hardware prefetcher completely.
This has a big impact on the performance of memory functions such as `memcpy` that rely on the fact that the next cache line will be readily available.

This patch adds the 'LIBC_COPT_MEMCPY_X86_USE_SOFTWARE_PREFETCHING' compile time option that generates a version of memcpy with software prefetching. While not fully restoring the original performances it mitigates the impact to an acceptable level.

Reviewed By: rtenneti

Differential Revision: https://reviews.llvm.org/D154494




More information about the All-commits mailing list