FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[SYClomatic] Add cub::RadixSort.SortBlockedToStriped header by abhilash1910 · Pull Request #1562 · oneapi-src/SYCLomatic · GitHub

[SYClomatic] Add cub::RadixSort.SortBlockedToStriped header - #1562

Merged
zhimingwang36 merged 17 commits into
oneapi-src:SYCLomaticfrom
abhilash1910:block_radixsort_variants
Jan 9, 2024
Merged

[SYClomatic] Add cub::RadixSort.SortBlockedToStriped header#1562
zhimingwang36 merged 17 commits into
oneapi-src:SYCLomaticfrom
abhilash1910:block_radixsort_variants

Conversation

abhilash1910 commented Dec 27, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

PR to add SortBlockedToStriped sorting ,
depends on #1483 (scatter_to_striped added in exchange)
cc @mmichel11 @danhoeflinger @yihanwg

abhilash1910 requested a review from a team as a code owner December 27, 2023 06:44
abhilash1910 marked this pull request as draft December 27, 2023 06:44
abhilash1910 marked this pull request as ready for review January 2, 2024 10:44

mmichel11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In addition to the comments here, I think a test case would also be nice to ensure correctness in the SYCLomatic-test repo.

if (begin_bit >= end_bit) {

exchange<T, VALUES_PER_THREAD>(_local_memory)
.scatter_to_striped(item, keys);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do we need to synchronize here before we exit the loop and call twiddle_out over the keys?

abhilash1910 Jan 4, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I do not think a local barrier is required here since we call a barrier outside the exchange loop before twiddling out.


#pragma unroll
for (int i = 0; i < VALUES_PER_THREAD; ++i) {
unsigned_keys[i] = detail::traits<T>::twiddle_in(unsigned_keys[i]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

My understanding is that twiddle_in and twiddle_out throw a runtime exception when it is not a supported type. Maybe it is not worth addressing here, but would it be better to catch this at compile time instead based on the type of T?

abhilash1910 commented Jan 4, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Thanks @mmichel11 for the suggestions, I think the modifications can be addressed later as well since this PR is for basic functionality . I am in progress of adding test suite for this sorting algos. Since there is a feature freeze on 8th, if it looks ok I can put it in for merging . Any modifications on this can be addressed on another PR as well . Let me know your thoughts. Thanks.

Also tagging @zhimingwang36 for review.

int begin_bit = 0, int end_bit = 8 * sizeof(T)) {

uint32_t(&unsigned_keys)[VALUES_PER_THREAD] =
reinterpret_cast<uint32_t(&)[VALUES_PER_THREAD]>(keys);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why should we convert to uint32_t instead of using T directly?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

How was this resolved?
(In general, I'd recommend letting the reviewer resolve threads when they are satisfied, rather than resolving them yourself.)

Copy link
Copy Markdown
Contributor

@abhilash1910 Thank you working on this, can you please also provide a test patch in SYCLomatic-test repo?

danhoeflinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

At a high level, is the only difference between this and the radix_sort function that we are doing the final exchange from scatter_to_striped rather than scatter_to_blocked?

If so, it seems like we shouldn't copy / rewrite the entire function to accomplish this. We should be able to just adjust that final exchange and rely on the same code otherwise. This can be done a number of ways, with a simple helper and a branch, or via some functor / lambda.

abhilash1910 commented Jan 5, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

At a high level, is the only difference between this and the radix_sort function that we are doing the final exchange from scatter_to_striped rather than scatter_to_blocked?

If so, it seems like we shouldn't copy / rewrite the entire function to accomplish this. We should be able to just adjust that final exchange and rely on the same code otherwise. This can be done a number of ways, with a simple helper and a branch, or via some functor / lambda.

Yeah thought so, reduced it to a helper + branch. Addressed other issues as well.
Can this be reviewed on priority ? @danhoeflinger @mmichel11 @yihanwg .Thanks

Copy link
Copy Markdown
Contributor

@abhilash1910 I am seeing clang-format failing in CI. Could you resolve this?

Copy link
Copy Markdown
Contributor Author

@mmichel11 @danhoeflinger fixed the issues. Lets wait for CI to run . Thanks.

danhoeflinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

mmichel11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL