This is an archive of the discontinued LLVM Phabricator instance.

[libc++][PSTL] Simplify the partitioning algorithm until we have better data to know how to chunk better
ClosedPublic

Authored by philnik on Jul 17 2023, 5:59 PM.

Details

Summary

The current chunking strategy is very bad for sorting, and we don't really know how to chunk in general. This fixes the performance problem for sorting.

Diff Detail

Event Timeline

philnik created this revision.Jul 17 2023, 5:59 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: krytarowski. · View Herald Transcript
philnik requested review of this revision.Jul 17 2023, 5:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 5:59 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne added inline comments.Jul 18 2023, 7:39 AM
libcxx/src/pstl/libdispatch.cpp
11

You can likely minimize some includes.

libcxx/test/libcxx/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp
11 ↗(On Diff #541286)

This shouldn't be needed even in your WIP patches. This should be enabled by default on the apple-system job.

philnik updated this revision to Diff 542699.Jul 20 2023, 3:15 PM
philnik marked 2 inline comments as done.

Address comments

philnik updated this revision to Diff 546903.Aug 3 2023, 9:15 AM

Try to fix CI

ldionne requested changes to this revision.Aug 7 2023, 8:20 AM

Requesting changes until the tests are fixed.

This revision now requires changes to proceed.Aug 7 2023, 8:20 AM
philnik updated this revision to Diff 547968.Aug 7 2023, 3:03 PM
  • Rebased
  • Try to fix CI
ldionne accepted this revision.Aug 14 2023, 8:22 AM

LGTM w/ test and passing CI, assuming fixing the CI is just a matter of rebasing and poking the CI.

libcxx/src/pstl/libdispatch.cpp
24–26

Can you add tests that check the exact values for element_count == 0 and 1?

This revision is now accepted and ready to land.Aug 14 2023, 8:22 AM
philnik updated this revision to Diff 549996.Aug 14 2023, 9:39 AM
philnik marked an inline comment as done.

Address comments

libcxx/src/pstl/libdispatch.cpp
24–26

We already have that.

This revision was landed with ongoing or failed builds.Aug 14 2023, 4:44 PM
This revision was automatically updated to reflect the committed changes.