-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Add SYCL2020 target::device enumeration value (#4587)
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
- Loading branch information
1 parent
9c0508b
commit f710886
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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,29 @@ | ||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out | ||
|
||
// This short test simply confirms that target::device | ||
// is supported correctly. | ||
// TODO: delete this test and test the functionality | ||
// over in llvm-test-suite along with the other changes | ||
// needed to support the SYCL 2020 target updates. | ||
|
||
#include <CL/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue testQueue; | ||
sycl::range<1> ndRng(1); | ||
int kernelResult; | ||
{ | ||
sycl::buffer<int, 1> buffer(&kernelResult, ndRng); | ||
|
||
testQueue.submit([&](sycl::handler &cgh) { | ||
auto ptr = buffer.get_access<sycl::access_mode::read_write, | ||
sycl::target::device>(cgh); | ||
cgh.single_task<class kernel>([=]() { ptr[0] = 5; }); | ||
}); | ||
} // ~buffer | ||
|
||
// std::cout << "kernelResult should be 5: " << kernelResult << std::endl; | ||
assert(kernelResult == 5); | ||
|
||
return 0; | ||
} |