-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL] Report an error when SYCL_DEVICE_TYPE is set incorrectly. #1134
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
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=cpu %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=gpu %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=acc %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=host %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=CPU %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=GPU %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=ACC %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=Cpu %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=Gpu %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=Acc %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=Host %t.out | ||
// RUN: env SYCL_DEVICE_TYPE=XPU %t.out | ||
|
||
AGindinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//==------------------- device-check.cpp --------------------------==// | ||
// This is a diagnostic test which ensures that | ||
// device types are case-insensitive. | ||
// It also checks for SYCL_DEVICE being set incorrectly. | ||
//==---------------------------------------------------------------==// | ||
|
||
#include <CL/sycl.hpp> | ||
#include <iostream> | ||
|
||
using namespace cl::sycl; | ||
|
||
|
||
int main() { | ||
try { | ||
queue q = queue(); | ||
auto device = q.get_device(); | ||
auto deviceName = device.get_info<cl::sycl::info::device::name>(); | ||
std::cout << " Device Name: " << deviceName << std::endl; | ||
} | ||
|
||
catch (runtime_error &E) { | ||
if (std::string(E.what()).find( | ||
"SYCL_DEVICE_TYPE is not recognized. Must be GPU, CPU, ACC or HOST.") == | ||
std::string::npos) { | ||
std::cout << "Test failed: received error is incorrect." << std::endl; | ||
return 1; | ||
} else { | ||
std::cout << "Test passed: caught the expected error." << std::endl; | ||
return 0; | ||
} | ||
} | ||
|
||
std::cout << "Test passed: results are correct." << std::endl; | ||
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.