Skip to content

Commit

Permalink
[SYCL] Add SYCL2020 target::device enumeration value (#4587)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
  • Loading branch information
cperkinsintel authored Sep 17, 2021
1 parent 9c0508b commit f710886
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sycl/include/CL/sycl/access/access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ enum class target {
image = 2017,
host_buffer = 2018,
host_image = 2019,
image_array = 2020
image_array = 2020,
device = global_buffer,
};

enum class mode {
Expand Down
29 changes: 29 additions & 0 deletions sycl/test/basic_tests/accessor/target_device.cpp
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;
}

0 comments on commit f710886

Please sign in to comment.