-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL][Docs] Allow copy-construction of device_global #15075
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
steffenlarsen
merged 18 commits into
intel:sycl
from
steffenlarsen:steffen/allow_copy_ctor_device_global
Oct 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2df6194
[SYCL][Docs] Allow copy-construction of device_global
steffenlarsen bbf50c4
Allow cases for copying device_global with different template arguments
steffenlarsen c83c716
Fix buffer size
steffenlarsen 27b2129
Fix formatting
steffenlarsen fdaf3f6
More formatting fixes
steffenlarsen d35e68e
Fix extraction of values from device_global with different template args
steffenlarsen 86df6b5
Merge remote-tracking branch 'intel/sycl' into steffen/allow_copy_cto…
steffenlarsen 6e204da
Merge remote-tracking branch 'intel/sycl' into steffen/allow_copy_cto…
steffenlarsen bf0a40d
Fix wording and requirements
steffenlarsen d1c4ac2
Remove redundant ctors
steffenlarsen 09c7d4b
Fix expected errors
steffenlarsen 376185b
Add unsupported tracker to new test
steffenlarsen eca9cad
Make post-modification ctor undefined behavior
steffenlarsen a9b3acd
Readd copy ctor
steffenlarsen 10d207e
Add UB to readded ctor
steffenlarsen a531a18
Add back base ctors to avoid llvm-spirv issues
steffenlarsen c66d01d
Forward declare and specialize trait in one place
steffenlarsen 67df6e8
Apply suggestions from code review
steffenlarsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // RUN: %{build} -std=c++23 -o %t.out | ||
| // RUN: %{run} %t.out | ||
| // | ||
| // The OpenCL GPU backends do not currently support device_global backend | ||
| // calls. | ||
| // UNSUPPORTED: opencl && gpu | ||
| // | ||
| // Tests the copy ctor on device_global without device_image_scope. | ||
|
|
||
| #include <sycl/detail/core.hpp> | ||
|
|
||
| namespace oneapiext = sycl::ext::oneapi::experimental; | ||
|
|
||
| oneapiext::device_global<const int> DGInit{3}; | ||
| oneapiext::device_global<const int> DGCopy{DGInit}; | ||
|
|
||
| int main() { | ||
| sycl::queue Q; | ||
|
|
||
| int ReadVals[2] = {0, 0}; | ||
| { | ||
| sycl::buffer<int, 1> ReadValsBuff{ReadVals, 2}; | ||
|
|
||
| Q.submit([&](sycl::handler &CGH) { | ||
| sycl::accessor ReadValsAcc{ReadValsBuff, CGH, sycl::write_only}; | ||
| CGH.single_task([=]() { | ||
| ReadValsAcc[0] = DGInit.get(); | ||
| ReadValsAcc[1] = DGCopy.get(); | ||
| }); | ||
| }).wait_and_throw(); | ||
| } | ||
|
|
||
| assert(ReadVals[0] == 3); | ||
| assert(ReadVals[1] == 3); | ||
|
|
||
| return 0; | ||
| } |
18 changes: 18 additions & 0 deletions
18
sycl/test/extensions/device_global/device_global_copy_negative.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // RUN: %clangxx -std=c++23 -fsycl -fsycl-targets=%sycl_triple -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s | ||
| // | ||
| // Tests that the copy ctor on device_global with device_image_scope is | ||
| // unavailable. | ||
|
|
||
| #include <sycl/sycl.hpp> | ||
|
|
||
| namespace oneapiext = sycl::ext::oneapi::experimental; | ||
|
|
||
| using device_image_properties = | ||
| decltype(oneapiext::properties{oneapiext::device_image_scope}); | ||
|
|
||
| oneapiext::device_global<const int, device_image_properties> DGInit{3}; | ||
| oneapiext::device_global<const int, device_image_properties> DGCopy{DGInit}; | ||
|
|
||
| // expected-error@sycl/ext/oneapi/device_global/device_global.hpp:* {{call to deleted constructor}} | ||
|
|
||
| int main() { return 0; } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.