-
Notifications
You must be signed in to change notification settings - Fork 401
Add PDL to cub::DeviceRadixSort
#9247
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
Draft
gonidelis
wants to merge
15
commits into
NVIDIA:main
Choose a base branch
from
gonidelis:pdl_radix_sort
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+176
−31
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cbf1f0b
Experiment with fused radix histogram scan
gonidelis 4b92d16
trying: PDL between lookback init and onesweep
gonidelis 939bc1c
isolate kernel histogram + exclusive_sum fusion to evaluate perf
gonidelis 3eff7dc
try: only init kernel set perf gain/loss
gonidelis 6be60fe
try: add safe-boundary PDL from exclusive sum to lookback init
gonidelis 1bfc271
try: add edge PDL from histogram to exclusive sum and move pdl trigge…
gonidelis 3606917
try: isolate deeper onesweep PDL sync
gonidelis 1ff10c6
try: gate radix onesweep PDL by problem size
gonidelis 048478e
try: move sync further deep
gonidelis 4cde1de
try: Add PDL startup init for onesweep radix sort
gonidelis 011166b
try: don't guard small input sizes, pdl all input sizes see if new ch…
gonidelis b8fafc6
try: Add PDL edge from radix histogram to exclusive sum
gonidelis 54251a2
try: unify init kernels
gonidelis e5eb5ff
Wire radix sort init kernels through C API
gonidelis 5daa5ec
pre-commit formatting
gonidelis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -477,6 +477,46 @@ __launch_bounds__(current_policy<PolicySelector>().histogram.threads_per_block) | |
| agent.Process(); | ||
| } | ||
|
|
||
| template <typename PolicySelector, bool TRIGGER_AT_START, bool FENCE_BEFORE_END_TRIGGER, typename InitT0, typename InitT1> | ||
| _CCCL_KERNEL_ATTRIBUTES void DeviceRadixSortInitKernel( | ||
| _CCCL_GRID_CONSTANT InitT0* const d_items0, | ||
| _CCCL_GRID_CONSTANT const size_t num_items0, | ||
| _CCCL_GRID_CONSTANT InitT1* const d_items1, | ||
| _CCCL_GRID_CONSTANT const size_t num_items1) | ||
| { | ||
| if constexpr (TRIGGER_AT_START) | ||
| { | ||
| _CCCL_PDL_GRID_DEPENDENCY_SYNC(); | ||
| _CCCL_PDL_TRIGGER_NEXT_LAUNCH(); | ||
| } | ||
|
|
||
| const size_t stride = static_cast<size_t>(blockDim.x) * gridDim.x; | ||
| for (size_t idx = static_cast<size_t>(blockIdx.x) * blockDim.x + threadIdx.x; | ||
| idx < ::cuda::std::max(num_items0, num_items1); | ||
| idx += stride) | ||
| { | ||
| if (idx < num_items0) | ||
| { | ||
| d_items0[idx] = 0; | ||
| } | ||
| if (idx < num_items1) | ||
| { | ||
| d_items1[idx] = 0; | ||
| } | ||
| } | ||
|
|
||
| if constexpr (FENCE_BEFORE_END_TRIGGER) | ||
| { | ||
| __threadfence(); | ||
| } | ||
|
|
||
| if constexpr (!TRIGGER_AT_START) | ||
| { | ||
| _CCCL_PDL_GRID_DEPENDENCY_SYNC(); | ||
| _CCCL_PDL_TRIGGER_NEXT_LAUNCH(); | ||
| } | ||
|
Comment on lines
+513
to
+517
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neither a grid dependency sync nor a trigger make sense at the end of the kernel. I think this can just be removed. |
||
| } | ||
|
|
||
| template <typename PolicySelector, | ||
| SortOrder Order, | ||
| typename KeyT, | ||
|
|
@@ -553,6 +593,8 @@ _CCCL_KERNEL_ATTRIBUTES void DeviceRadixSortExclusiveSumKernel(_CCCL_GRID_CONSTA | |
| using BlockScan = cub::BlockScan<OffsetT, BLOCK_THREADS>; | ||
| __shared__ typename BlockScan::TempStorage temp_storage; | ||
|
|
||
| _CCCL_PDL_GRID_DEPENDENCY_SYNC(); | ||
|
|
||
| // load the bins | ||
| OffsetT bins[BINS_PER_THREAD]; | ||
| int bin_start = blockIdx.x * RADIX_DIGITS; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Therefore, this can be removed as well.