-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] sub-devices selected by ONEAPI_DEVICE_SELECTOR as root devices #7167
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 7 commits into
intel:sycl
from
cperkinsintel:cperkins-ods-subdevice-pretend
Nov 3, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7267060
initial commit, before testing
cperkinsintel 082c4c2
overlooked expression reuse
cperkinsintel f35dd92
Merge branch 'sycl' into cperkins-ods-subdevice-pretend
cperkinsintel ed6fe7d
check for nullptr
cperkinsintel 688173e
specify template overload for jenkins. add tests for TempAssignGuard
cperkinsintel 742d5a6
punctuation and spelling
cperkinsintel 5ebc7ef
Update sycl/test/basic_tests/temp-assign-guard.cpp
cperkinsintel 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
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,69 @@ | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %t.out | ||
|
||
#include <sycl/detail/util.hpp> | ||
#include <sycl/sycl.hpp> | ||
using namespace sycl; | ||
|
||
struct someStruct { | ||
int firstValue; | ||
bool secondValue; | ||
}; | ||
|
||
int main() { | ||
someStruct myStruct; | ||
myStruct.firstValue = 2; | ||
myStruct.secondValue = false; | ||
someStruct moarStruct; | ||
moarStruct.firstValue = 3; | ||
moarStruct.secondValue = false; | ||
someStruct *moarPtr = &moarStruct; | ||
int anotherValue = 4; | ||
|
||
{ // Scope to limit lifetime of TempAssignGuards. | ||
|
||
sycl::detail::TempAssignGuard myTAG_1(myStruct.firstValue, -20); | ||
sycl::detail::TempAssignGuard myTAG_2(myStruct.secondValue, true); | ||
sycl::detail::TempAssignGuard moarTAG_1(moarPtr->firstValue, -30); | ||
sycl::detail::TempAssignGuard moarTAG_2(moarPtr->secondValue, true); | ||
sycl::detail::TempAssignGuard anotherTAG(anotherValue, -40); | ||
|
||
// Ensure values have been temporarily assigned. | ||
assert(myStruct.firstValue == -20); | ||
assert(myStruct.secondValue == true); | ||
assert(moarStruct.firstValue == -30); | ||
assert(moarStruct.secondValue == true); | ||
assert(anotherValue == -40); | ||
} | ||
|
||
// Ensure values have been restored. | ||
assert(myStruct.firstValue == 2); | ||
assert(myStruct.secondValue == false); | ||
assert(moarStruct.firstValue == 3); | ||
assert(moarStruct.secondValue == false); | ||
assert(anotherValue == 4); | ||
|
||
// Test exceptions | ||
int exceptionalValue = 5; | ||
try { | ||
sycl::detail::TempAssignGuard exceptionalTAG(exceptionalValue, -50); | ||
assert(exceptionalValue == -50); | ||
throw 7; // Baby needs a new pair of shoes. | ||
} catch (...) { | ||
assert(exceptionalValue == 5); | ||
} | ||
assert(exceptionalValue == 5); | ||
|
||
// Test premature exit | ||
int prematureValue = 6; | ||
{ | ||
sycl::detail::TempAssignGuard prematureTAG(prematureValue, -60); | ||
assert(prematureValue == -60); | ||
goto dragons; | ||
assert(true == false); | ||
} | ||
dragons: | ||
assert(prematureValue == 6); | ||
|
||
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.