Skip to content

[SYCL] Update tests with new test cases for FPGA function attributes #3089

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 4 commits into from
Jan 26, 2021

Conversation

smanna12
Copy link
Contributor

@smanna12 smanna12 commented Jan 25, 2021

Template parameter support was added for

  1. [[intel::max_global_work_dim)]] attribute on [SYCL] Add template parameter support for max_global_work_dim attribute #2816
  2. [[intel::num_simd_work_items()]] attribute on [SYCL] Add template parameter support for num_simd_work_items attribute #2510
  3. [[intel::reqd_sub_group_size()]] attribute on [SYCL] Add template parameter support for intel_reqd_sub_group_size a… #1807

This patch adds the following new test cases that were not there before to verify/improve the template support:

  1. Test that checks wrong function template instantiation and ensures that the type
    is checked properly when instantiating from the template definition.
  2. Test that checks expression is not a constant expression.
  3. Test that checks expression is a constant expression.
  4. Test that checks template parameter support on function.

NOTE: No change in compiler. All new test cases have already been supported.

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

Template parameter support was added for

 1. [[intel::max_global_work_dim)]] attribute on intel#2816
 2. [[intel::num_simd_work_items()]] attribute on intel#2510
 3. [[intel::reqd_sub_group_size()]] attribute on intel#1807

This patch adds the following new test cases that were not there before to improve the support:

 1. Test that checks wrong function template instantiation and ensures that the type
    is checked properly when instantiating from the template definition.
 2. Test that checks expression is not a constant expression.
 3. Test that checks expression is a constant expression.
 4. Test that checks template parameter support on function.

NOTE: No change in compiler. All new test cases have already been supported.

Signed-off-by: Soumi Manna <[email protected]>
@smanna12 smanna12 changed the title [SYCL] Add new test cases for FPGA attributes [SYCL] Add new test cases (to verify template parameter support) for FPGA attributes Jan 25, 2021
@smanna12 smanna12 changed the title [SYCL] Add new test cases (to verify template parameter support) for FPGA attributes [SYCL] Update tests with new test cases for FPGA function attributes Jan 25, 2021
@smanna12 smanna12 marked this pull request as ready for review January 25, 2021 06:34
@smanna12 smanna12 requested a review from AaronBallman January 25, 2021 06:34
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. Thanks!

@smanna12
Copy link
Contributor Author

LGTM. Thanks!

Thanks @elizabethandrews for the reviews.

struct S {};
void var() {
//expected-note@+1{{in instantiation of function template specialization 'func<S>' requested here}}
func<S>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Another interesting test would be: func<float>(); to see if we get an exciting implicit conversion to int there or not. Also, a test like func<int>();, which should be accepted.

Copy link
Contributor Author

@smanna12 smanna12 Jan 26, 2021

Choose a reason for hiding this comment

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

Another interesting test would be: func(); to see if we get an exciting implicit conversion to int there or not.

Test is added. We get an implicit conversion to int for all attributes here.

Also, a test like func();, which should be accepted.

Test is added.
[intel::max_global_work_dim)]] -- accepts this test
[[intel::num_simd_work_items()]] -- does not accept this test
[[intel::reqd_sub_group_size()]] -- does not accept this test

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it expected that we get an implicit conversion for func<float>() or was that a surprise (if a surprise, maybe open an issue for it)?

Also, is the inconsistency between the other attributes with func<int>() expected? I would assume we'd want all of these or none of these to behave the same way. If it's unexpected, maybe open another issue?

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 have created #3100 for this issue and assigned to me. I will investigate this behavior for all of these in a separate PR. Thanks @AaronBallman for suggesting about this tests.

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

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

Changes LGTM!

@smanna12
Copy link
Contributor Author

Thank you @elizabethandrews and @AaronBallman for the discussion and reviews.

Copy link
Contributor

@premanandrao premanandrao left a comment

Choose a reason for hiding this comment

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

Sorry, I missed the earlier notifications.
Looks good to me.

@smanna12
Copy link
Contributor Author

Sorry, I missed the earlier notifications.
Looks good to me.

Thanks @premanandrao.

@romanovvlad romanovvlad merged commit 4109213 into intel:sycl Jan 26, 2021
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