Doc. no. P10010R0
Date: 2018-03-14
Project: Programming Language C++
Audience: SG1 Parallelism and Concurrency
Library Evolution Working Group
Reply to: Alisdair Meredith <ameredith1@bloomberg.net>

Target Vectorization Policies from Parallelism V2 TS to C++20

Table of Contents

  1. Revision History
  2. 1 Introduction
  3. 2 Stating the problem
  4. 3 Propose Solution
  5. 4 Other Directions
  6. 5 Formal Wording
  7. 6 Acknowledgements
  8. 7 References

Revision History

Revision 0

Original version of the paper for the 2018 Jacksonville meeting.

1 Introduction

The Parallelism v2 working draft has new vector policies for the parallel algorithms that might better target C++20 directly.

2 Stating the problem

We plan to send the Parallelism V2 working paper to PDTS ballot at the Jacksonville meeting. It seems reasonable to conclude that if we want feedback from the TS process, then anything in that TS vehicle will miss the merge deadline for C++20.

Of the (expected) three components to that TS, the Task Blocks feature depends on the exception_list class that is still underspecified for general use, and waiting feedback from such a TS process.

The simd library type has been going through rapid evolution and been subject to much change in the review process, so seems appropriate to seek feedback through the TS process.

Finally, there are two new vectorization policies for the parallel algorithms, which rely on the main <algorithm> header providing overloads for the new policies in the non-experimental std namespace in order to be usable. The algorithms can safely be implemented as reverting to serial or any other lesser parallel behavior without using the freedoms granted by the wavefront policies, so implementability is much less of a concern than QoI. There is no room in the design space for how we dispatch to the algorithms to be seeking TS feedback, so it is seems reasonable to suggest that if we want this feature, it would be more appropriate to target the C++20 standard directly, avoiding the awkward interaction with the std and experimental namespaces. We are still early enough in the C++20 cycle to respond to unexpected implementer feedback, and the current state of the C++17 parallel algorithms is that most standard library vendors are still starting or in the middle of their first implementation of the parallel algorithms, so it would be easier to tackle these extra policies now along with the rest of that work.

3 Propose Solution

Propose directly merging the contents of section 5 and 7 of the current working draft of the Parallelism V2 TS into the C++20 Working paper, and then striking those sections, and the corresponing rows of the feature macros table from section 4 of the Parallelism TS.

4 Other Directions

Considered suggesting a merge of the wavefront policies into C++20 without striking the content from the Parallism TS V2. However, it does not seem useful to have two duplicate copies of the same wording, with either a burden to maintain both, or seeing the two diverge over time. The benefit of maintaining both copies is that it removes the urgency of answering this question immediately at the Jacksoville meeting.

5 Formal Wording

Merge the contents of section 5 and 7 of N4725 into the C++ Working paper, and then strike those sections from the Parallelism V2 TS Working Paper.

When merging, all references to the inline namespace std::experimental::parallism_v2 should be replaced with simply namespace std. Any reference to an <experimental/*> header should be replaced (or merged into) the corresponding standard (non-experimental) header.

For guidance to the editors on merging, clauses 5.2-5.4 should be added as new subclauses under 23.19 [execpol]. Section 7 already had the stable tag [parallel.alg], so should readily merge into the same top level tag in the main standard.

Strike the following rows from Table 1 - Feature Test Macro(s) in the Parallism V2 TS:

__cpp_lib_experimental_execution_vector_policy
__cpp_lib_experimental_parallel_for_loop

Corresponding rows should be added to the feature detection macros standing document (prior to any merging with the C++ Working Paper) with the _experimental term redacted.

6 Acknowledgements

Thanks to all the troublemakers in Jacksonville who persuaded me there was time to write this late paper!

7 References