Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
/cubPublic archive

Add DeviceMergeSort::StableSortKeysCopy API#565

Merged
gevtushenko merged 4 commits intoNVIDIA:mainfromdavidwendt:stable-sort-keys-copy
Sep 12, 2022

Conversation

davidwendt
Copy link
Contributor

CUB has aSortKeysCopy and aStableSortKeys. This PR addsStableSortKeysCopy so a sort in-place is not required. The in-placeStableSortKeys requires a temporary vector if a copy is needed.

SinceStableSortKeys callsSortKeys andSortKeysCopy uses the same kernels asSortKeys (which appear to already be stable-sort enabled), the newStableSortKeysCopy simply callsSortKeysCopy.

@davidwendtdavidwendt marked this pull request as ready for reviewSeptember 1, 2022 20:25
Copy link
Collaborator

@gevtushenkogevtushenko left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! A few minor suggestions below.

Comment on lines 1117 to 1142
template <typename KeyInputIteratorT,
typename KeyIteratorT,
typename OffsetT,
typename CompareOpT>
CUB_DETAIL_RUNTIME_DEBUG_SYNC_IS_NOT_SUPPORTED
CUB_RUNTIME_FUNCTION static cudaError_t
StableSortKeysCopy(void *d_temp_storage,
std::size_t &temp_storage_bytes,
KeyInputIteratorT d_input_keys,
KeyIteratorT d_output_keys,
OffsetT num_items,
CompareOpT compare_op,
cudaStream_t stream,
bool debug_synchronous)
{
CUB_DETAIL_RUNTIME_DEBUG_SYNC_USAGE_LOG

return StableSortKeysCopy<KeyInputIteratorT, KeyIteratorT, OffsetT, CompareOpT>(d_temp_storage,
temp_storage_bytes,
d_input_keys,
d_output_keys,
num_items,
compare_op,
stream);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
template<typename KeyInputIteratorT,
typename KeyIteratorT,
typename OffsetT,
typename CompareOpT>
CUB_DETAIL_RUNTIME_DEBUG_SYNC_IS_NOT_SUPPORTED
CUB_RUNTIME_FUNCTIONstatic cudaError_t
StableSortKeysCopy(void *d_temp_storage,
std::size_t &temp_storage_bytes,
KeyInputIteratorT d_input_keys,
KeyIteratorT d_output_keys,
OffsetT num_items,
CompareOpT compare_op,
cudaStream_t stream,
bool debug_synchronous)
{
CUB_DETAIL_RUNTIME_DEBUG_SYNC_USAGE_LOG
return StableSortKeysCopy<KeyInputIteratorT, KeyIteratorT, OffsetT, CompareOpT>(d_temp_storage,
temp_storage_bytes,
d_input_keys,
d_output_keys,
num_items,
compare_op,
stream);
}

This is not required. Thedebug_synchronous overloads exist so as not to break API. For the new functions, we don't have anything to break, so let's remove this overload.

@@ -234,6 +234,18 @@ void TestKeys(std::int64_t num_items,
CustomLess()));

AssertTrue(CheckResult(d_keys));

CubDebugExit(cub::DeviceMergeSort::StableSortKeysCopy(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just realized that there might be a value in something like:

Suggested change
CubDebugExit(cub::DeviceMergeSort::StableSortKeysCopy(
thrust::fill(d_keys.begin(), d_keys.end(), KeyType{});
CubDebugExit(cub::DeviceMergeSort::StableSortKeysCopy(

gevtushenko added a commit to gevtushenko/thrust that referenced this pull requestSep 9, 2022
Copy link
Collaborator

@misccomiscco left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution and the excellent documentation

@gevtushenkogevtushenko merged commit33a6a81 intoNVIDIA:mainSep 12, 2022
@gevtushenkogevtushenko added testing: gpuCI passedPassed gpuCI testing. type: enhancementNew feature or request. labelsSep 12, 2022
@gevtushenkogevtushenko added this to the2.1.0 milestoneSep 12, 2022
@davidwendtdavidwendt deleted the stable-sort-keys-copy branchSeptember 12, 2022 12:46
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@misccomisccomiscco approved these changes

@gevtushenkogevtushenkogevtushenko approved these changes

Assignees
No one assigned
Labels
testing: gpuCI passedPassed gpuCI testing.type: enhancementNew feature or request.
Projects
Archived in project
Milestone
2.1.0
Development

Successfully merging this pull request may close these issues.

3 participants
@davidwendt@miscco@gevtushenko

[8]ページ先頭

©2009-2025 Movatter.jp