[all-commits] [llvm/llvm-project] a3ce29: [libc++][PSTL] Introduce cpu traits (#88134)

Louis Dionne via All-commits all-commits at lists.llvm.org
Mon Apr 15 07:30:22 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3ce29f7bb5510131971ac5ccc63132dd48c8dd2
      https://github.com/llvm/llvm-project/commit/a3ce29f7bb5510131971ac5ccc63132dd48c8dd2
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__algorithm/pstl_backends/cpu_backend.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/any_of.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/backend.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/fill.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/find_if.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/for_each.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/libdispatch.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/merge.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/stable_sort.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/transform.h
    M libcxx/include/__algorithm/pstl_backends/cpu_backends/transform_reduce.h
    A libcxx/include/__pstl/cpu_algos/cpu_traits.h
    M libcxx/include/module.modulemap
    M libcxx/src/pstl/libdispatch.cpp
    M libcxx/test/libcxx/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp
    M libcxx/utils/generate_iwyu_mapping.py

  Log Message:
  -----------
  [libc++][PSTL] Introduce cpu traits (#88134)

Currently, CPU backends in the PSTL are created by defining functions
in the __par_backend namespace. Then, the PSTL includes the CPU backend
that gets configured via CMake and gets those definitions.

This prevents CPU backends from easily co-existing and is a bit
confusing.
To solve this problem, this patch introduces the notion of __cpu_traits,
which is a cheap encapsulation of the basis operations required to
implement a CPU-based PSTL. Different backends can now define their own
tag and coexist, and the CPU-based PSTL will simply use __cpu_traits to
dispatch to the right implementation of e.g. __for_each.

Note that this patch doesn't change the actual implementation of the
backends in any way, it only modifies how that implementation is
accessed
to implement PSTL algorithms.

This patch is a step towards #88131.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list