Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Update scan deduced types to be standards-compliant. #1176

Merged

Conversation

alliepiper
Copy link
Collaborator

Heads up that this patch changes the output of scan algorithms under certain edge cases. See the updated unit test for examples.

TBB's scan was implemented differently than the other backends, leading
to some failing unit tests.

This patch fixes these inconsistencies by making the following changes:

  • Follow P0571's guidance regarding accumulator variable type.
    • https://wg21.link/P0571
    • The accumulator's type is now:
      • The type of the user-supplied initial value (if provided), or
      • The input iterator's value type if no initial value.
  • Follow C++ standard guidance for default binary operator type.
    • https://eel.is/c++draft/exclusive.scan#1
    • Thrust binary/unary functors now specialize a default void template
      parameter. Types are deduced and forwarded transparently.
    • Updated the scan's default binary operator to the new
      thrust::plus<> specialization.
  • The intermediate_type_from_function_and_iterators helper is no
    longer needed and has been removed.

Closes #1170.

@alliepiper
Copy link
Collaborator Author

Internal CL: 28484173

@alliepiper alliepiper added testing: internal ci in progress Currently testing on internal NVIDIA CI (DVS). testing: gpuCI passed Passed gpuCI testing. labels Jun 1, 2020
@brycelelbach
Copy link
Collaborator

Make sure to note in the commit message that this is a breaking change so that I will include it in the breaking changes section of the changelog for the next release.

@alliepiper alliepiper removed testing: internal ci in progress Currently testing on internal NVIDIA CI (DVS). testing: gpuCI passed Passed gpuCI testing. labels Jun 3, 2020
TBB's scan was implemented differently than the other backends, leading
to some failing unit tests.

This patch fixes these inconsistencies by making the following changes:

- Follow P0571's guidance regarding accumulator variable type.
  - https://wg21.link/P0571
  - The accumulator's type is now:
    - The type of the user-supplied initial value (if provided), or
    - The input iterator's value type if no initial value.
- Follow C++ standard guidance for default binary operator type.
  - https://eel.is/c++draft/exclusive.scan#1
  - Thrust binary/unary functors now specialize a default void template
    parameter. Types are deduced and forwarded transparently.
  - Updated the scan's default binary operator to the new
    `thrust::plus<>` specialization.
- The `intermediate_type_from_function_and_iterators` helper is no
  longer needed and has been removed.

Closes NVIDIA#1170.
@alliepiper alliepiper force-pushed the bug/github/scan_edgecases/1170 branch from 83eff97 to b30a856 Compare June 8, 2020 16:47
@alliepiper alliepiper merged commit b528451 into NVIDIA:master Jun 8, 2020
@alliepiper alliepiper deleted the bug/github/scan_edgecases/1170 branch July 3, 2020 20:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement consistent scan accumulation per P0571
3 participants