Skip to content

[SYCL] Add support for [[intel::reqd_sub_group_… #2137

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 10 commits into from
Jul 22, 2020

Conversation

smanna12
Copy link
Contributor

…size()]]

This patch adds new spelling of IntelReqdSubGroupSize attribute
and generates a diagnostic which will tell that previous spelling
of the attribute is deprecated.

Signed-off-by: Soumi Manna [email protected]

smanna12 added 2 commits July 19, 2020 23:34
…size()]]

This patch adds new spelling of IntelReqdSubGroupSize attribute
and generates a diagnostic which will tell that previous spelling
of the attribute is deprecated.

Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
@smanna12 smanna12 changed the title [WIP] [DO NOT REVIEW] [SYCL] Add support for [[intel::reqd_sub_group_… [WIP] [SYCL] Add support for [[intel::reqd_sub_group_… Jul 20, 2020
@smanna12 smanna12 changed the title [WIP] [SYCL] Add support for [[intel::reqd_sub_group_… [SYCL] Add support for [[intel::reqd_sub_group_… Jul 20, 2020
@smanna12 smanna12 marked this pull request as ready for review July 20, 2020 12:29
@@ -10969,6 +10969,9 @@ def err_ivdep_declrefexpr_arg : Error<
def warn_ivdep_redundant : Warning <"ignoring redundant Intel FPGA loop "
"attribute 'ivdep': safelen %select{INF|%1}0 >= safelen %select{INF|%3}2">,
InGroup<IgnoredAttributes>;
def warn_attribute_spelling_deprecated : Warning<
"previous spelling of attribute %0 is deprecated">,
Copy link
Contributor

Choose a reason for hiding this comment

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

User's aren't particularly knowledgeable about the fact that the same attribute can be spelled in 2 different ways. They tend to treat them as different attributes with similar/same behavior.

Additionally, we likely want to suggest

This should probably be:
"attribute %0 is deprecated
Then a note of: <note_function_suggestion > "did you mean %1?"

Additionally, See if you can find if there is a good note that we can use to suggest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

User's aren't particularly knowledgeable about the fact that the same attribute can be spelled in 2 different ways. They tend to treat them as different attributes with similar/same behavior.

Additionally, we likely want to suggest

This should probably be:
"attribute %0 is deprecated
Then a note of: <note_function_suggestion > "did you mean %1?"

Additionally, See if you can find if there is a good note that we can use to suggest

Thanks @erichkeane for the suggestion. I will look at this and update the diagnostic.

Signed-off-by: Soumi Manna <[email protected]>
@@ -10969,6 +10969,9 @@ def err_ivdep_declrefexpr_arg : Error<
def warn_ivdep_redundant : Warning <"ignoring redundant Intel FPGA loop "
"attribute 'ivdep': safelen %select{INF|%1}0 >= safelen %select{INF|%3}2">,
InGroup<IgnoredAttributes>;
def warn_attribute_spelling_deprecated : Warning<
"attribute %0 is deprecated, did you mean to use 'reqd_sub_group_size' instead?">,
Copy link
Contributor

Choose a reason for hiding this comment

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

I had suggested making this a warning + note (using something like note_function_suggestion) as it seems to fit how diagnostics work better, and still have a preference for it. But @elizabethandrews @Fznamznon and @premanandrao can make the final call here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally prefer adding a note. However I see instances of 'did you mean' in error/warning message itself in DiagnosticsSemaKinds.td. @erichkeane what does clang community recommend? If they recommend using a separate note, @smanna12 would you mind adding a note? There are examples in DiagnosticsSemaKinds.td

Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect we are consistently inconsistent :) Clang typically doesn't have its warnings be prescriptive, but I can see that we do in a bunch of cases. I'm not sure we have official guidance.

That said, if we leave it alone, i think the suggested replacement needs to be a replacement as well. Finally, don't we mean:

'did you mean to use 'intel::reqd_sub_group_size' instead?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @elizabethandrews and @erichkeane for the comments.

However I see instances of 'did you mean' in error/warning message itself in DiagnosticsSemaKinds.td.
Yes, i saw several examples that used and so added in the warning message.

I have added warning+ note and updated all tests with it.

Signed-off-by: Soumi Manna <[email protected]>
InGroup<DeprecatedAttributes>;
def note_spelling_suggestion : Note<
"did you mean to use 'intel::reqd_sub_group_size' instead?">;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make intel::reqd_sub_group_size a %0 instead, then fill it in with your Diag call.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was actually surprised a general 'did you mean' like this one did not exist already.

Copy link
Contributor

Choose a reason for hiding this comment

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

@elizabethandrews : the only one I found was note_function_suggestion, which is textually identical to what I'd like, but is function-specific. I'm tempted to update the name in the upstream to make it work for anything...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make intel::reqd_sub_group_size a %0 instead, then fill it in with your Diag call.

Done.

@@ -5,7 +5,9 @@
template <int SIZE>
class KernelFunctor {
public:
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels weird to me that existing tests all throw warnings now. I am not sure what is usually done when spellings are changed though. Personally I would just prefer updating these tests to use the new spelling (except where this functionality is actually being checked). @erichkeane thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I could go either way. There aren't that many tests to just 'fix' the spelling of here, so I'd probably suggest just fixing all the spellings instead.

If this was more widespread (that is, the tests were a pain to change), or a situation where there was a difference in the implementation, I'd consider just using the -Wno flag in the tests. In this case, I think just changing the spelling in the tests is better than adding the warning/note to ALL of them.

Copy link
Contributor

Choose a reason for hiding this comment

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

That said, probably leave at least 1 to validate the deprecated warning :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea. That's what I meant by 'except where this functionality is actually being checked' :)

@smanna12 sorry but can you make this change? I think it's just cleaner this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea. That's what I meant by 'except where this functionality is actually being checked' :)

@smanna12 sorry but can you make this change? I think it's just cleaner this way.

Sure. I will do this.

Copy link
Contributor

@erichkeane erichkeane Jul 21, 2020

Choose a reason for hiding this comment

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

I think you still need to leave ONE example (perhaps add a new example) to validate the new warning/note.

Done

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, right. By mistake, I changed all spellings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the multiple submission.

Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

LGTM

erichkeane
erichkeane previously approved these changes Jul 21, 2020
@smanna12
Copy link
Contributor Author

Thanks for the review.

Signed-off-by: Soumi Manna <[email protected]>
Copy link
Contributor

@MrSidims MrSidims left a comment

Choose a reason for hiding this comment

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

@smanna12 thanks for clarification and sharing plans! The patch is LGTM with an exception of one unresolved comment from @erichkeane

@bader bader merged commit b2da2c8 into sycl Jul 22, 2020
@bader bader deleted the NewSpellingOfReqdSubGroupAttr branch July 22, 2020 15:28
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.

6 participants