Commit Graph

51 Commits

Author SHA1 Message Date
Louis Dionne 1b6d6e595b [pstl] Allow customizing whether per-TU insulation is provided
Like we do in libc++, PSTL needs the ability to constrain
ABI-unstable symbols to each translation unit. This is OFF by
default (like for libc++), because most people don't care about
this and there is a cost associated to enabling the option (code
bloat because templates are not deduped across TUs).

I'm using '#pragma clang attribute push' to avoid marking each
declaration with an attribute, which quickly becomes difficult
to maintain.

llvm-svn: 368684
2019-08-13 12:49:00 +00:00
Louis Dionne 09a7a627af [NFC][pstl] Run clang-format
We really need to do that consistently when applying patches.

llvm-svn: 368312
2019-08-08 17:10:45 +00:00
Louis Dionne 2153607379 [pstl] Remove stray semicolon
llvm-svn: 368302
2019-08-08 14:49:28 +00:00
Louis Dionne a8a436ef95 [pstl] Error out when the backend is left unspecified
Instead of silently falling back to the serial backend, it's better if
we fail loudly when the parallel backend is left unspecified. Since we
have a __pstl_config_site header, a backend should always be specified.

llvm-svn: 368285
2019-08-08 12:43:13 +00:00
Louis Dionne bf4808439f [pstl] Add a __pstl_config_site header to record the CMake configuration
This commit adds a __pstl_config_site header that contains the value of
macros specified at CMake configuration time. It works similarly to
libc++'s __config_site header, except we always include it as a separate
file instead of concatenating it to the main configuration header.

It is necessary to thread the includes for that header into libc++'s
lit configuration, otherwise we'd be requiring an installation step
prior to running the test suite.

llvm-svn: 368284
2019-08-08 12:43:04 +00:00
Louis Dionne 956892433f [pstl][libc++] Provide uglified header names for interface headers
For the few (currently four) headers that make up the PSTL's interface
to other Standard Libraries, provide a stable uglified header file that
can be included by those Standard Libraries.

We can then more easily change the internal organization of the PSTL
without having to change the integration with Standard Libraries.

llvm-svn: 368088
2019-08-06 21:11:24 +00:00
Louis Dionne 23f073100d [NFC][pstl] Remove stray semi-colon
llvm-svn: 367928
2019-08-05 21:20:42 +00:00
Eric Fiselier 4ea8ed4135 [pstl] Fully qualify pstl names.
Previously the code used "using namespace __pstl;" at block
scope to introduce these names. This could cause conflicts with
names defined by the standard library. So we should fully qualify
them instead.

llvm-svn: 367468
2019-07-31 19:14:16 +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
Hans Wennborg 8f5b44aead Bump the trunk version to 10.0.0svn
and clear the release notes.

llvm-svn: 366427
2019-07-18 11:51:05 +00:00
Louis Dionne 3559fcd114 [pstl] Use std::transform_reduce instead of hand-rolled implementation
llvm-svn: 366233
2019-07-16 17:29:09 +00:00
Louis Dionne c26e27d802 [NFC] Fix -Wreorder warning in TBB backend
llvm-svn: 366232
2019-07-16 17:29:03 +00:00
Louis Dionne 58864fad39 [pstl] Fix compilation with TBB backend
Some types were not using the right namespace qualification.

llvm-svn: 366208
2019-07-16 13:45:10 +00:00
Louis Dionne c862ea27b7 [NFC][pstl] Remove unused utility code
llvm-svn: 365346
2019-07-08 16:35:49 +00:00
Louis Dionne b152f9f392 [pstl] Use a different namespace for each backend
Also, use a single point of customization to set what namespace __par_backend
"points to", which provides a better separation of concerns.

llvm-svn: 365337
2019-07-08 16:05:00 +00:00
Louis Dionne 766accd364 [pstl] Add missing includes
llvm-svn: 365218
2019-07-05 16:05:26 +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 d9b7b2d5f7 [NFC][pstl] Do not name each header file in the leading comment
With the renaming that will happen, it's just a pain to maintain the
right names.

llvm-svn: 365156
2019-07-04 19:39:29 +00:00
Louis Dionne 0ca6d390ba [NFC][pstl] Run clang-format
llvm-svn: 365152
2019-07-04 19:04:28 +00:00
Louis Dionne 55227a7b4d [pstl] Make sure we include the pstl_config header in the glue headers
llvm-svn: 365150
2019-07-04 18:19:20 +00:00
Louis Dionne 04c5bc989a [pstl] Default to the serial backend when unspecified
This is a stopgap measure to make it easier to integrate the PSTL into
libc++. In the future, we should have a system similar to what libc++
does, where we specify settings at configuration time and generate a
__config_site header that is part of the PSTL.

llvm-svn: 363958
2019-06-20 17:56:51 +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
Mikhail Dvorskiy 36d1f2443b [pstl] The optimized parallel versions of sort, stable_sort algorithms, TBB parallel backend.
Summary: 
A modification of the parallel sorting algorithm, additionally optimized for a partially sorted array.

Reviewers: rodgert
           ldionne

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

llvm-svn: 362678
2019-06-06 07:34:46 +00:00
Louis Dionne e38a82405b [pstl] Use OpenMP pragmas with Clang, which supports them
Most importantly, Clang doesn't seem to support the non-OpenMP pragmas
that were being used previously.

llvm-svn: 362155
2019-05-30 21:09:19 +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 65a422c81c [pstl] Make the default backend be the serial backend and always provide parallel policies
Summary:
Before this change, the default backend was TBB but one could disable
anything related to TBB by removing the parallel policies. This change
uses the serial backend by default and removes the ability to disable
parallel policies, which is not useful anymore.

Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 359134
2019-04-24 20:12:36 +00:00
Louis Dionne dcf4b9aee0 [pstl] Add a serial backend for the PSTL
Summary:
The serial backend performs all tasks serially and does not require
threads. It does not have any dependencies beyond normal C++, but
it is not very efficient either.

Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 358700
2019-04-18 18:20:19 +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 ab38599bb1 [pstl] Setup the _PSTL_VERSION macro like _LIBCPP_VERSION, and add release notes
Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358193
2019-04-11 17:08:55 +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 0352f201dd [pstl] Fix incorrect forward declaration of __pattern_unique_copy
The forward declaration didn't take an execution policy, but the
definition does.

llvm-svn: 358130
2019-04-10 19:48:18 +00:00
Louis Dionne 6d6fbc86c8 [pstl] Add missing forward declarations for equal
We added the 4-iterator variants of std::equal in r357613, but we
forgot to add the corresponding forward declarations.

llvm-svn: 358129
2019-04-10 19:35:42 +00:00
Louis Dionne e3e24ad25f Fix header inclusion order failures
Summary: See https://bugs.llvm.org/show_bug.cgi?id=41432

Subscribers: libcxx-commits

Tags: #libc

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

llvm-svn: 358121
2019-04-10 18:52:24 +00:00
Louis Dionne 8a497a958b [pstl] Improve the parallel version of std::equal
When an execution policy is provided, we attempt to run std::equal in
parallel instead of always doing it serially.

Thanks to Mikhail Dvorskiy for the patch.

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

llvm-svn: 357613
2019-04-03 17:34:57 +00:00
Louis Dionne a735985abe [pstl] Mangle the parallel_strict_scan backend function
llvm-svn: 357422
2019-04-01 19:34:09 +00:00
Louis Dionne 95c585e258 [pstl] Indent preprocessor directives as part of the clang-format rules
Summary:
Indenting preprocessor directives provides a significant gain in
readability. We do it for normal if statements, and it makes sense
to do it for preprocessor ifs too.

Reviewers: rodgert, MikeDvorskiy

Subscribers: jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 357401
2019-04-01 15:21:46 +00:00
Louis Dionne c7c6413119 [pstl] Qualify calls to internal functions
This guards against unintended ADL issues.
Thanks to Thomas Rogers for the patch.

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

llvm-svn: 357306
2019-03-29 20:11:24 +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
Louis Dionne 65bd5d8aa3 [pstl][NFC] Remove some warnings
llvm-svn: 356945
2019-03-25 20:44:07 +00:00
Louis Dionne 524e5e9019 [PSTL][NFC] Add missing #include
llvm-svn: 356917
2019-03-25 16:20:49 +00:00
Louis Dionne 86d4ec756b [pstl] Call the right overload of std::equal with an execution policy
Thanks to Mikhail Dvorskiy for the patch.

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

llvm-svn: 356891
2019-03-25 12:37:51 +00:00
Louis Dionne 6aad7945d7 [pstl] Fix missing parallel policy guards
Thanks to @jerryct for the patch.
Differential Revision: https://reviews.llvm.org/D57638

llvm-svn: 355161
2019-03-01 01:26:35 +00:00
Louis Dionne 28dc566701 [pstl] Remove some warnings when compiling with a recent Clang
There were multiple warnings for lambda captures that are unused, so
I removed those captures. I also fixed a couple of -Wsign-compare
warnings. Note that some warnings still remain, this change is not
exhaustive.

llvm-svn: 354148
2019-02-15 17:30:35 +00:00
Chandler Carruth 57b08b0944 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351648
2019-01-19 10:56:40 +00:00
Louis Dionne 8a7c2ab990 [pstl] Fix compile errors when PARALLEL_POLICIES is disabled
Reviewed as https://reviews.llvm.org/D56139.
Thanks to @jerryct for the patch.

llvm-svn: 350813
2019-01-10 11:23:33 +00:00
Louis Dionne 6b4cc66f9a [pstl] A fix of __pstl namespace usage for include/pstl/internal/glue_algorithm_defs.h
Reviewed as https://reviews.llvm.org/D55920

llvm-svn: 350723
2019-01-09 14:07:09 +00:00
Louis Dionne 1f66672515 [pstl] Avoid shadowing explicit lambda capture with lambda parameter
Summary:
Recent Clangs give an error for this. Note that the size of this diff is
caused by running clang-format on the result of removing the captures.
I guess we'll see how well that works for us.

Reviewers: jfb, rodgert

Subscribers: jkorous, dexonsmith, libcxx-commits, mclow.lists

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

llvm-svn: 350544
2019-01-07 17:31:17 +00:00
Louis Dionne 436aa40a13 [NFC][pstl] Re-run Clang-format on the whole repository
llvm-svn: 349814
2018-12-20 20:28:56 +00:00