Commit Graph

25 Commits

Author SHA1 Message Date
Ruslan Arutyunyan 843c12d6a0 [libc++][pstl] Implement tag dispatching mechanism for Parallel STL
Implement the mechanism that simplifies the execution policy/iterator
category dispatching and allows to implement customizations for
the parallel algorithms with adding custom tags

Reviewed By: rodgert, MikeDvorskiy

Differential Revision: https://reviews.llvm.org/D104492
2022-01-28 04:09:51 +03:00
Louis Dionne 5425106e49 [libc++] Remove test-suite annotations for unsupported Clang versions
Differential Revision: https://reviews.llvm.org/D108471
2021-08-20 15:05:13 -04:00
Louis Dionne c4823cc5db [pstl] Workaround more errors in the test suite 2021-05-26 15:45:01 -04:00
Louis Dionne 3b9a1bb1af [pstl] Fix -Wundef errors in the test suite 2021-05-26 15:24:49 -04:00
zoecarver 7f607ac6af [pstl] Use logical operator for loop condition in tests
Fix a probable typo in two PSTL tests that causes warnings with GCC.

Patch by Jonathan Wakely (jwakely).

Reviewed By: zoecarver

Differential Revision: https://reviews.llvm.org/D102327
2021-05-13 10:11:40 -07:00
Thomas Rodgers 2e15f4ac57 [pstl] Replace direct use of assert() with _PSTL_ASSERT
Standard libraries may (libstdc++ in particular) forbid direct use of
assert()/<cassert> in library code.

Differential Revision: https://reviews.llvm.org/D60249
2020-11-02 18:35:54 -05:00
Louis Dionne b5e896c049 [libc++][pstl] Remove c++98 from UNSUPPORTED annotations
c++98 isn't used by the test suite anymore, only c++03 is.
2020-07-29 14:17:32 -04:00
Louis Dionne 26b0a23084 [pstl] Fix a few errors when running PSTL tests through the libc++ test suite 2020-07-08 14:39:16 -04:00
Dvorskiy, Mikhail 5b0502dff5 [pstl] A fix for move placement-new (and destroy) allocated objects from raw memory.
https://reviews.llvm.org/D74123

The fix affects follow algorithms:
remove_if, unique, rotate, inplace_merge, partial_sort_copy, set_union, set_intersection, set_difference, set_symmetric_difference.

For "is_trivial" types there are no problems with "creating objects/clean-up"
For non-trivial types the algo results are also correct, but possible incorrect copying/moving "operator=" calls "by raw memory" within one of mentioned algo or incorrect destructor calls in the end of algo.
2020-05-18 17:00:13 +03:00
Mikhail Dvorskiy 36b8d02c8d [pstl] A hot fix for exclusive_scan (+ lost enable_if in declaration)
It fixes an ambiguity issue in case of a user has a custom policy and
calls a version of exclusive_scan with binary operation.

Differential Revision: https://reviews.llvm.org/D62719
2020-03-17 16:22:24 -04:00
Louis Dionne 0a06eb911b [libc++] Take 2: Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

The first attempt to commit this failed because it exposed a bug in the
tests for modules. Now that this has been fixed, it should be safe to
commit this.

Reviewers: EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

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

llvm-svn: 367903
2019-08-05 18:29:14 +00:00
Louis Dionne a3c83b7511 Revert "[libc++] Integrate the PSTL into libc++"
This reverts r366593, which caused unforeseen breakage on the build bots.
I'm reverting until the problems have been figured out and fixed.

llvm-svn: 366603
2019-07-19 18:52:46 +00:00
Louis Dionne 910323e667 [libc++] Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

Reviewers: rodgert, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

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

llvm-svn: 366593
2019-07-19 17:02:42 +00:00
Louis Dionne 01963cec9b [NFC][pstl] Run clang-format on the sources, including the tests
llvm-svn: 366492
2019-07-18 20:22:28 +00:00
Louis Dionne 249c1c7407 [pstl] Declare main() as returning int, not int32_t
llvm-svn: 366490
2019-07-18 20:21:52 +00:00
Louis Dionne 989cad2476 [pstl] Use utilities from <functional> instead of reinventing the wheel
llvm-svn: 365158
2019-07-04 20:00:39 +00:00
Louis Dionne 6ab35c9dc0 [pstl] Mark pstl tests as unsupported before C++17
This is required to run the tests in lit with libc++'s tests.

llvm-svn: 363942
2019-06-20 16:22:06 +00:00
Louis Dionne 3491119f9b [pstl] Remove warnings in tests and headers
Mostly unused parameter, unused local typedefs and shadowed declarations.
This massaging it necessary if we want to be able to run the tests under
the libc++ lit configuration.

llvm-svn: 363872
2019-06-19 20:15:50 +00:00
Louis Dionne 9d54063c82 [pstl] Remove stray usage of pstl::execution instead of std::execution
llvm-svn: 363723
2019-06-18 19:34:04 +00:00
Louis Dionne 5c4c44310a [pstl] Remove various warnings in the pstl headers and tests
- unused parameter warnings
- don't use single-letter template parameter names, like we do in libc++
- sign-comparison warnings
- unused variables in the tests
- unused local typedefs in the tests
- the use of #include_next
- field reordering in the tests
- unused lambda captures

Note that the rationale for why the static_casts to unsigned are OK is
that last - first must always be non-negative, since [first, last) is
a valid range.

llvm-svn: 362148
2019-05-30 20:46:31 +00:00
Louis Dionne 4d88b17b3f [pstl] Remove the stdlib headers from the PSTL and move them to the tests
Summary:
PSTL should not provide those headers since they belong to the standard
library. Instead, we define a dummy standard library in the tests that
provides those headers.

Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358497
2019-04-16 14:38:08 +00:00
Louis Dionne 3dee12e4a5 [pstl] Move to single underscore-capital for macros and include guards
Summary: Per the LLVM convention.

Reviewers: rodgert

Subscribers: jkorous, dexonsmith, jdoerfert, libcxx-commits

Tags: #libc

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

llvm-svn: 358131
2019-04-10 19:51:40 +00:00
Louis Dionne 0408a7892e [pstl] Uglify internal names of the library
llvm-svn: 357203
2019-03-28 19:10:32 +00:00
Louis Dionne 1dd1b5d5f2 [pstl] Introduce forward declarations
Necessary when pstl is included from with <algorithm> and <numeric> to
prevent a partially declared standard library when pstl itself uses
algorithms from <algorithm> and <numeric>.

Also, this patch makes sure that configuration comes via standard headers.
Directly including pstl_config.h in implementation files is incompatible
with inclusion of pstl into a standard library implementation which
provides it's own library wide configuration and may configure the
library differently to the pstl_config.h used by the standalone
implementation.

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

llvm-svn: 357189
2019-03-28 17:22:19 +00:00
Louis Dionne 3b62047b8b Restructure test suite to follow libc++ standard layout
Summary: Subsumes changes requested in https://reviews.llvm.org/D59110

Reviewers: EricWF, ldionne

Subscribers: mgorny, krytarowski, jfb, jdoerfert, libcxx-commits

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

llvm-svn: 357124
2019-03-27 21:28:24 +00:00