Skip to content

[SYCL][ESIMD] Convert esimd operator to friend method. #2994

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

Merged
merged 1 commit into from
Jan 11, 2021

Conversation

cmc-rep
Copy link
Contributor

@cmc-rep cmc-rep commented Jan 5, 2021

Signed-off-by: Gang Y Chen [email protected]

@@ -184,30 +184,26 @@ template <typename Ty, int N> class simd {
// {/quote}
// * if not different, then auto should not be used
#define DEF_BINOP(BINOP, OPASSIGN) \
auto operator BINOP(const simd &RHS) const { \
ESIMD_INLINE friend auto operator BINOP(const simd &x, const simd &y) { \
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make parameter naming consistent with other friends (here and below):

Suggested change
ESIMD_INLINE friend auto operator BINOP(const simd &x, const simd &y) { \
ESIMD_INLINE friend auto operator BINOP(const simd &Y, const simd &Y) { \

@cmc-rep
Copy link
Contributor Author

cmc-rep commented Jan 6, 2021

I am waiting for the test result. It seems taking forever

vladimirlaz
vladimirlaz previously approved these changes Jan 7, 2021
Copy link
Contributor

@vladimirlaz vladimirlaz left a comment

Choose a reason for hiding this comment

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

Approve to start testing

@vladimirlaz vladimirlaz self-requested a review January 7, 2021 07:17
@cmc-rep cmc-rep force-pushed the cmc-rep-change branch 2 times, most recently from 85bc19b to 612d783 Compare January 7, 2021 17:10
@cmc-rep
Copy link
Contributor Author

cmc-rep commented Jan 7, 2021

Updated change

@cmc-rep cmc-rep requested a review from kychendev January 8, 2021 16:33
auto R = data() RELOP RHS.data(); \
ESIMD_INLINE friend simd<uint16_t, N> operator RELOP(const simd &X, \
const simd &Y) { \
auto R = X.data() RELOP Y.data(); \
mask_type_t<N> M(1); \
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit (maybe for another patch): since M is all ones, isn't M & convert<mask_type_t<N>>(R) equivalent to convert<mask_type_t<N>>(R) thus making M redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

M(1) is not part of my change. Not sure why it is written this way. I would be cautious to make unnecessary change

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I see that it is not part of this change, that's why it is just a nit for another patch. I thought you wrote this part.

ESIMD_INLINE friend auto operator BINOP(const simd_view &X, \
const simd_view &Y) { \
return (X BINOP Y.read()); \
} \
simd_view &operator OPASSIGN(const value_type &RHS) { \
Copy link
Contributor

Choose a reason for hiding this comment

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

is value_type BINOP value_type combination missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cannot have that, cause ambiguous with the friend method definition in simd class

Copy link
Contributor

Choose a reason for hiding this comment

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

I see thanks.

} \
ESIMD_INLINE friend simd<uint16_t, length> operator RELOP( \
const simd_view &X, const simd_view &Y) { \
return (X RELOP Y.read()); \
}
Copy link
Contributor

Choose a reason for hiding this comment

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

is value_type RELOP value_type combination missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cannot have that, cause ambiguous with the friend method definition in simd class

@cmc-rep
Copy link
Contributor Author

cmc-rep commented Jan 8, 2021

@kbobrovs please help me merge this PR. Somehow I am not authorized to merge

kychendev
kychendev previously approved these changes Jan 8, 2021
@@ -389,7 +429,7 @@ template <typename BaseTy, typename RegionTy> class simd_view {
// - std::pair<top_region_type, base_region_type>
//
RegionTy M_region;
};
}; // namespace gpu
Copy link
Contributor

Choose a reason for hiding this comment

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

Missed this one in the initial review. Please fix.

Suggested change
}; // namespace gpu
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will work on some change to the same file again. Could I fix it in the next change. So I can move on working on the next change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kbobrovs, fix it. Please review and merge timely.

@cmc-rep
Copy link
Contributor Author

cmc-rep commented Jan 9, 2021

@konst, this PR is ready, please help with merge

@cmc-rep
Copy link
Contributor Author

cmc-rep commented Jan 9, 2021

@kbobrovs this PR is ready, please help with merge

@bader bader changed the title [SYCL][ESIMD] - convert esimd operator to friend methodw [SYCL][ESIMD] Convert esimd operator to friend method. Jan 11, 2021
@bader bader merged commit 023bc53 into intel:sycl Jan 11, 2021
@cmc-rep cmc-rep deleted the cmc-rep-change branch January 11, 2021 16:49
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