From e85232c6c0e03b784b5be2c7528f0ace9ef78fd8 Mon Sep 17 00:00:00 2001 From: aelovikov-intel Date: Wed, 18 Jan 2023 13:44:11 -0800 Subject: [PATCH] [SYCL] Update simple-sycl-app.cpp example in GetStartedGuide.md (#8025) Fixes https://github.com/intel/llvm/issues/5738 --- sycl/doc/GetStartedGuide.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sycl/doc/GetStartedGuide.md b/sycl/doc/GetStartedGuide.md index 847f1bafab230..3583b53d98066 100644 --- a/sycl/doc/GetStartedGuide.md +++ b/sycl/doc/GetStartedGuide.md @@ -566,8 +566,8 @@ Creating a file `simple-sycl-app.cpp` with the following C++/SYCL code: #include int main() { - // Creating buffer of 4 ints to be used inside the kernel code - sycl::buffer Buffer(4); + // Creating buffer of 4 elements to be used inside the kernel code + sycl::buffer Buffer(4); // Creating SYCL queue sycl::queue Queue; @@ -577,19 +577,19 @@ int main() { // Submitting command group(work) to queue Queue.submit([&](sycl::handler &cgh) { - // Getting write only access to the buffer on a device - auto Accessor = Buffer.get_access(cgh); + // Getting write only access to the buffer on a device. + sycl::accessor Accessor{Buffer, cgh, sycl::write_only}; // Executing kernel cgh.parallel_for( NumOfWorkItems, [=](sycl::id<1> WIid) { - // Fill buffer with indexes - Accessor[WIid] = (sycl::cl_int)WIid.get(0); + // Fill buffer with indexes. + Accessor[WIid] = WIid.get(0); }); }); // Getting read only access to the buffer on the host. // Implicit barrier waiting for queue to complete the work. - const auto HostAccessor = Buffer.get_access(); + sycl::host_accessor HostAccessor{Buffer, sycl::read_only}; // Check the results bool MismatchFound = false;