Skip to content

[SYCL] Add clang support for device_global #5597

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 35 commits into from
Mar 16, 2022

Conversation

schittir
Copy link
Contributor

@schittir schittir commented Feb 16, 2022

This patch implements the basic functionality and some diagnostics
for SYCL device_global attributes. The rest of the diagnostics are to
be added in a subsequent PR.

This patch includes:

  1. Add [[__sycl_detail__::device_global]] attribute and use it to check
    some restrictions on variable declarations of device_global type
  2. Add [[__sycl_detail__::global_variable_allowed]] attribute and avoid
    diagnosing err_sycl_restrict if variables of device_global type use it
  3. Adds "sycl-unique-id", an LLVM IR attribute, to provide a unique
    string identifier for each device global variable

Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

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

The functional part (under it I mean the changes described by design doc - https://github.com/intel/llvm/blob/sycl/sycl/doc/design/DeviceGlobal.md, i.e. everything except diagnostics) looks ok to me. Let's focus on that and add some testing:

  • We need IR checking that sycl-unique-id is properly attached
  • We need Sema test checking that device_global variable can be captured to SYCL kernel.

schittir and others added 3 commits February 17, 2022 10:18
- Check type of the variable, not the variable itself when checking
presence of the attribute
- Fix generation of LLVM IR attribute
- Add the CodeGen test
@schittir schittir marked this pull request as ready for review March 3, 2022 18:55
@schittir schittir requested a review from a team as a code owner March 3, 2022 18:55
@smanna12
Copy link
Contributor

smanna12 commented Mar 3, 2022

@schittir, please fix the conflicts

@schittir
Copy link
Contributor Author

Please also update PR description to include note about upcoming patch which covers diagnostics.

Done.

@schittir
Copy link
Contributor Author

I am not sure how to reproduce the failing "timed-out" tests.
SYCL :: Plugin/level_zero_batch_test_copy_with_compute.cpp test failed with the latest commit, whereas the last time, SYCL :: ESIMD/kmeans/kmeans.cpp failed. The latter doesn't fail anymore, leading me to think that these are flaky...
I will look into this more, but if anybody has any thoughts or previous experience with this, please feel free to share. Thank you.

@smanna12
Copy link
Contributor

smanna12 commented Mar 13, 2022

I am not sure how to reproduce the failing "timed-out" tests. SYCL :: Plugin/level_zero_batch_test_copy_with_compute.cpp test failed with the latest commit, whereas the last time, SYCL :: ESIMD/kmeans/kmeans.cpp failed. The latter doesn't fail anymore, leading me to think that these are flaky... I will look into this more, but if anybody has any thoughts or previous experience with this, please feel free to share. Thank you.

@schittir I am seeing same timeout test issue in other PR's (#4533 (comment))
https://github.com/intel/llvm/runs/5518378302?check_suite_focus=true
Timed Out Tests (1):
SYCL :: Plugin/level_zero_batch_test_copy_with_compute.cpp

I am seeing same timeout test issue in other PR's (#5782)
https://github.com/intel/llvm/runs/5518378332?check_suite_focus=true
Timed Out Tests (1):
SYCL :: ESIMD/kmeans/kmeans.cpp

Both failures are unrelated to your patch.

@schittir
Copy link
Contributor Author

I am not sure how to reproduce the failing "timed-out" tests. SYCL :: Plugin/level_zero_batch_test_copy_with_compute.cpp test failed with the latest commit, whereas the last time, SYCL :: ESIMD/kmeans/kmeans.cpp failed. The latter doesn't fail anymore, leading me to think that these are flaky... I will look into this more, but if anybody has any thoughts or previous experience with this, please feel free to share. Thank you.

@schittir I am seeing same timeout test issue in other PR's (#4533 (comment)) https://github.com/intel/llvm/runs/5518378302?check_suite_focus=true Timed Out Tests (1): SYCL :: Plugin/level_zero_batch_test_copy_with_compute.cpp

I am seeing same timeout test issue in other PR's (#5782) https://github.com/intel/llvm/runs/5518378332?check_suite_focus=true Timed Out Tests (1): SYCL :: ESIMD/kmeans/kmeans.cpp

Both failures are unrelated to your patch.

Thank you, Soumi!

smanna12
smanna12 previously approved these changes Mar 14, 2022
Copy link
Contributor

@smanna12 smanna12 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.

Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

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

Looks ok to me. But I'd like to get approve from @elizabethandrews too.

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!

@schittir
Copy link
Contributor Author

@smanna12 @elizabethandrews could you please take a look again?

@schittir
Copy link
Contributor Author

Test failures unrelated to this PR.
The following timed-out:
SYCL :: KernelAndProgram/multiple-kernel-linking.cpp
SYCL :: Plugin/level_zero_batch_test.cpp
SYCL :: Plugin/level_zero_batch_test_copy_with_compute.cpp
SYCL :: Plugin/retain_events.cpp
SYCL :: Printf/float.cpp
SYCL :: USM/copy.cpp

@bader bader merged commit c42abb5 into intel:sycl Mar 16, 2022
steffenlarsen pushed a commit that referenced this pull request Aug 30, 2022
…5810)

This PR is a follow up to PR #5597 to implement the diagnostics not covered in #5597 

As it stands currently, this PR includes implementation for cases described in this documentation and their templated versions - https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/proposed/sycl_ext_oneapi_device_global.asciidoc#restrictions-on-creating-device-global-objects except the shadow variable/namespace case. Specifically, it covers cases where device_global is declared as a private member inside a struct and within methods inside struct, their template versions/instantiation and device_global array.
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.

9 participants