Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add P0443r14 executor and a a few P1897 algorithms #5053

Merged
merged 38 commits into from
Feb 26, 2021

Conversation

msimberg
Copy link
Contributor

@msimberg msimberg commented Nov 13, 2020

Adds the remaining CPOs and traits from P0443r14 (see #5045). I've used the fallback implementations from P0443r14 pretty much verbatim, so there might be room for changes here.

Also adds transform and sync_wait as the first algorithms (and wait, get for symmetry with the current future functionality, although these should proably not stay). Also adds a sink_receiver (should be called void_receiver?).

Adds a simple executor for our coroutines based on the new functionality. The bulk_execute functionality is incomplete but I'd like to keep it like this for now until the proposal evolves a bit more.

Extends tag_fallback_invoke with tag_priority_invoke, which gives three options: tag_override_invoke which always takes precedence over user-defined tag_invokes, then uses user-defined tag_invokes, and finally uses tag_fallback_invoke if nothing else matches.

@K-ballo (and others interested), I had a need for a type list transform and unique. I'm sure you have a better idea of how to do that efficiently (especially unique), so I'd appreciate your eyes on that (see https://github.com/msimberg/hpx/blob/1fa6ec165d410d0508183cb0e1d532e1840f0cf6/libs/core/type_support/include/hpx/type_support/pack.hpp#L196-L237).

Includes #5033.

To do:

  • Add documentation for the new CPOs
  • Update documentation for the existing CPOs
  • Move traits out from traits namespace (objections?)

@msimberg
Copy link
Contributor Author

retest

tag_priority{,_noexcept} extends the tag_fallback{,_noexcept} helper
structs to also allow overriding user-defined tag_invoke overloads.
tag_priority{,_noexcept} will prefer tag_override_invoke overloads if
available, then tag_invoke overloads if available, and last
tag_fallback_invoke overloads if available. This helper struct is useful
for implementing P0443 customization points which prefer member
functions whenever available, even if tag_invoke overloads are
available. On the other hand they fall back in many cases to default
implementations based on other customization points.
@msimberg
Copy link
Contributor Author

I welcome reviews on this one.

hkaiser
hkaiser previously approved these changes Feb 24, 2021
Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@msimberg
Copy link
Contributor Author

msimberg commented Feb 24, 2021

LGTM, thanks!

Thanks @hkaiser for looking through this! I'm turning this back into a draft because it looks like gcc 7 and 8 are not happy with the changes. I'm not planning on making any further functional changes.

@msimberg msimberg marked this pull request as draft February 24, 2021 08:53
@hkaiser
Copy link
Member

hkaiser commented Feb 24, 2021

One question I had was whether we should use tag_fallback_invoke instead of tag_invoke where possible (based on our experience with segregating the segmented algorithms).

@msimberg
Copy link
Contributor Author

One question I had was whether we should use tag_fallback_invoke instead of tag_invoke where possible (based on our experience with segregating the segmented algorithms).

Absolutely! The P0443 customization points use tag_priority which gives both tag_fallback_invoke and tag_priority_invoke (the latter because according to P0443 member functions should always take precedence over free functions, or tag_invoke overloads in our case). sync_wait and transform are not even CPOs here, but should be, and should use tag_fallback_invoke (I've already changed this in upcoming commits).

@msimberg
Copy link
Contributor Author

This should now be ok. Let's see if CI agrees. GCC 7 and 8 seemed to be more eager in instantiating templates compared to newer versions of GCC and clang.

@msimberg msimberg force-pushed the p0443-executor branch 2 times, most recently from 44a0a10 to 2352d97 Compare February 26, 2021 08:46
- Move enable_ifs to template parameters
- Add enable_ifs to some member functions that did not have it
- Use enable_if_t instead of enable_if
- Change some leftover decay to decay_t
- Small fixes to basic_submit test
@msimberg msimberg changed the title P0443 executor Add P0443r14 executor and a a few P1897 algorithms Feb 26, 2021
@msimberg msimberg merged commit d027517 into STEllAR-GROUP:master Feb 26, 2021
@msimberg msimberg deleted the p0443-executor branch February 26, 2021 13:52
@aurianer aurianer added the category: senders/receivers Implementations of the p0443r14 / p2300 + p1897 proposals label May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: executors category: senders/receivers Implementations of the p0443r14 / p2300 + p1897 proposals type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants