Skip to content
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

[SYCLomatic] Create separate util file for groups #1784

Merged
merged 46 commits into from
May 30, 2024

Conversation

abhilash1910
Copy link
Contributor

@abhilash1910 abhilash1910 commented Mar 13, 2024

From email discussion on SYCLcompat for cooperative group apis, this is created to add all header algorithms related to block/warp for sycl.
This PR only replaces the group apis - exchange and sort (from these PRs : #1562 & #1483 ) which were added to the dpct_extensions.h file to group_utils.h file. No other changes apart from removing the existing code from extensions to the group_utils.h file. Correspondingly the tests related to PRs oneapi-src/SYCLomatic-test#601 & oneapi-src/SYCLomatic-test#594 need to be updated accordingly with respect to the changes in namespace only. The aim of this PR is only to remove the functionality from extensions namespace to group_utils namespace.
cc @danhoeflinger @mmichel11 @zhimingwang36 @yihanwg

@abhilash1910 abhilash1910 requested a review from a team as a code owner March 13, 2024 10:22
@abhilash1910 abhilash1910 marked this pull request as draft March 13, 2024 10:22
@abhilash1910 abhilash1910 marked this pull request as ready for review April 12, 2024 06:12
@danhoeflinger
Copy link
Contributor

Is this moving functionality from the other header as is or rewriting + making changes?

If we are moving code and keeping the namespace and everything the same, that is one type of review where we just need to insure that all existing SYCLomatic code can still see the new location, and it is successfully unchanged, etc.
If that is the case we need to remove the other code (where it was moved from).

If we are doing more than just moving code, then we need to review it as "new code", and also figure out how it fits with what is already there.

It would be good to make this clear in the description of the PR (without requiring the context of the email discussion to understand it).

@abhilash1910
Copy link
Contributor Author

abhilash1910 commented Apr 14, 2024

Is this moving functionality from the other header as is or rewriting + making changes?

If we are moving code and keeping the namespace and everything the same, that is one type of review where we just need to insure that all existing SYCLomatic code can still see the new location, and it is successfully unchanged, etc. If that is the case we need to remove the other code (where it was moved from).

If we are doing more than just moving code, then we need to review it as "new code", and also figure out how it fits with what is already there.

It would be good to make this clear in the description of the PR (without requiring the context of the email discussion to understand it).

Yes added description - this is mainly a step for removing the existing sort & exchange coop-group apis from dpct extensions namespace to group_utils namespace without changing any functionality.
This would require an inclusion of dpcpp_extension.h headers for radix_sort because the detail namespace has radix_rank + twiddle_in operations which are essential for sort. As per @yihanwg review, changes in tests no longer needed as the file is included in dpl_utils.h

Copy link
Contributor

@yihanwg yihanwg left a comment

Choose a reason for hiding this comment

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

I'd like to include group_utils.h in dpct/dpl_utils.h, so this PR will not breaking any existing code.

//
//===----------------------------------------------------------------===//

#ifndef __DPCT_DPCPP_EXTENSIONS_H__
Copy link
Contributor

Choose a reason for hiding this comment

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

The include guard name should be changed since it is currently mirroring the macro name in the dpcpp_extensions.h file.

#include "dpl_extras/iterators.h"
#include "dpl_extras/memory.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like except for the added #include "group_utils.hpp", the other changes are just shifting the order of the includes. Does this matter or can we restore these unneeded changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this was caused by the format issue, let me revert to original.


#include "dpct.hpp"
#include "dpl_extras/dpcpp_extensions.h"
#include "functional.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be "dpl_extras/functional.h"

@abhilash1910 abhilash1910 requested a review from yihanwg April 16, 2024 16:26
@abhilash1910 abhilash1910 requested a review from yihanwg May 20, 2024 06:17
@yihanwg
Copy link
Contributor

yihanwg commented May 21, 2024

Basically LGTM. You should check https://github.com/oneapi-src/SYCLomatic/blob/SYCLomatic/clang/lib/DPCT/HeaderTypes.inc as well to see if it needs to add a new entry.

Copy link
Contributor

@yihanwg yihanwg left a comment

Choose a reason for hiding this comment

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

LGTM, @danhoeflinger @mmichel11 Can you please take another look?

@@ -73,6 +73,9 @@ const std::string FftUtilsAllContentStr =
const std::string LapackUtilsAllContentStr =
#include "clang/DPCT/lapack_utils.hpp.inc"
;
const std::string GroupUtilsAllContentStr =
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about why, but you may need to add a similar line to this to follow the example of LapackUtilsAllContentStr:

extern const std::string LapackUtilsAllContentStr;

(still failing the lit check)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added , but still fails in lit.

@mmichel11
Copy link
Contributor

I don't see any issues within group_utils.hpp header, so once the header addition issues are resolved this PR LGTM.

@abhilash1910
Copy link
Contributor Author

@yihanwg @zhimingwang36 could you help with the lit failure issue in CI ? Thanks.

@yihanwg
Copy link
Contributor

yihanwg commented May 28, 2024

@yihanwg @zhimingwang36 could you help with the lit failure issue in CI ? Thanks.

Sure, let me take a look.

[update] Fixed.

@yihanwg yihanwg changed the title [SYCLomatic]Create separate util file for groups [SYCLomatic] Create separate util file for groups May 29, 2024
Copy link
Contributor

@danhoeflinger danhoeflinger left a comment

Choose a reason for hiding this comment

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

LGTM

@zhimingwang36 zhimingwang36 merged commit b2e5588 into oneapi-src:SYCLomatic May 30, 2024
21 checks passed
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