This is an archive of the discontinued LLVM Phabricator instance.

[libc++][PSTL] Implement std::{any, all, none}_of
ClosedPublic

Authored by philnik on Feb 2 2023, 2:40 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rG8af259e8d90b: [libc++][PSTL] Implement std::{any, all, none}_of

Diff Detail

Event Timeline

philnik created this revision.Feb 2 2023, 2:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 2:40 AM
Herald added a subscriber: miyuki. · View Herald Transcript
philnik updated this revision to Diff 500797.Feb 27 2023, 8:05 AM

Try to fix CI

philnik updated this revision to Diff 501212.Feb 28 2023, 10:20 AM

Try to fix CI

philnik updated this revision to Diff 501350.Feb 28 2023, 6:01 PM

Try to fix CI

philnik updated this revision to Diff 501352.Feb 28 2023, 6:24 PM

Fix header guard

philnik updated this revision to Diff 501525.Mar 1 2023, 8:33 AM

Try to fix CI

ldionne added inline comments.Mar 13 2023, 8:58 AM
libcxx/include/__algorithm/any_of.h
1

I would suggest splitting the PSTL all_of, any_of and none_of into a separate header to avoid impacting the dependencies of the basic any_of algorithm.

libcxx/include/execution
57

I would say no, as for most other extensions.

ldionne added inline comments.Mar 13 2023, 9:34 AM
libcxx/test/std/algorithms/alg.nonmodifying/alg.any_of/pstl.any_of.pass.cpp
29

Like other algorithms, this should be tested on the different iterator categories.

philnik updated this revision to Diff 517299.Apr 26 2023, 1:38 PM
philnik marked 3 inline comments as done.
  • Rebased
  • Address comments
philnik updated this revision to Diff 517389.Apr 26 2023, 4:43 PM

Improve tests

philnik published this revision for review.Apr 26 2023, 4:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 4:44 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Apr 27 2023, 9:22 AM

This is nice! I would suggest refactoring the serial backend so that we can enable this with -fexperimental-library sooner rather than later, maybe after stamping out a couple more algorithms just to confirm there are no unknowns.

libcxx/include/__algorithm/pstl_any_all_none_of.h
29 ↗(On Diff #517389)

Can you please make sure you have tests for all nodiscard extensions you're adding?

35 ↗(On Diff #517389)

I suspect we might end up removing those, but until then, we should keep the code self-descriptive.

libcxx/include/__pstl/internal/parallel_impl.h
69 ↗(On Diff #517389)

Let's be explicit about the type when we pass it. We can remove it later if not needed.

libcxx/include/__type_traits/is_execution_policy.h
38–39 ↗(On Diff #517389)

Let's return auto const& instead, this is kinda confusing for no benefit.

libcxx/test/std/algorithms/alg.nonmodifying/alg.all_of/pstl.all_of.pass.cpp
36

Let's test on a few sizes of sequences: 1-element, 2-elements, and more than e.g. 100 elements. Not to test the backend itself (which will require its own tests per our discussion), but to test the interaction between the "front-end" of the API and the backend.

This revision is now accepted and ready to land.Apr 27 2023, 9:22 AM
philnik updated this revision to Diff 517647.Apr 27 2023, 11:04 AM
philnik marked 5 inline comments as done.

Address comments

philnik updated this revision to Diff 517664.Apr 27 2023, 11:51 AM
  • Try to fix CI
  • Fix test
philnik updated this revision to Diff 517696.Apr 27 2023, 1:37 PM

Generate files

philnik updated this revision to Diff 517748.Apr 27 2023, 4:32 PM

Try to fix CI

philnik updated this revision to Diff 517926.Apr 28 2023, 7:59 AM

Try to fix CI

philnik updated this revision to Diff 517967.Apr 28 2023, 9:52 AM

Try to fix CI

philnik updated this revision to Diff 517973.Apr 28 2023, 10:00 AM

Try to fix CI

philnik updated this revision to Diff 518000.Apr 28 2023, 11:18 AM

More fixes

philnik updated this revision to Diff 518048.Apr 28 2023, 2:03 PM

Try to fix CI

philnik updated this revision to Diff 518058.Apr 28 2023, 2:41 PM

Another try

philnik updated this revision to Diff 518095.Apr 28 2023, 4:57 PM

Another try

philnik updated this revision to Diff 518096.Apr 28 2023, 5:01 PM

Fix formatting

philnik updated this revision to Diff 518128.Apr 28 2023, 9:12 PM

fix formatting

This revision was landed with ongoing or failed builds.Apr 29 2023, 8:42 PM
This revision was automatically updated to reflect the committed changes.