@@ -566,8 +566,8 @@ Creating a file `simple-sycl-app.cpp` with the following C++/SYCL code:
566
566
# include <sycl/sycl.hpp>
567
567
568
568
int main () {
569
- // Creating buffer of 4 ints to be used inside the kernel code
570
- sycl::buffer< sycl::cl_int , 1> Buffer(4);
569
+ // Creating buffer of 4 elements to be used inside the kernel code
570
+ sycl::buffer< size_t , 1> Buffer(4);
571
571
572
572
// Creating SYCL queue
573
573
sycl::queue Queue;
@@ -577,19 +577,19 @@ int main() {
577
577
578
578
// Submitting command group(work) to queue
579
579
Queue.submit([& ](sycl::handler & cgh) {
580
- // Getting write only access to the buffer on a device
581
- auto Accessor = Buffer.get_access < sycl::access::mode::write >( cgh ) ;
580
+ // Getting write only access to the buffer on a device.
581
+ sycl::accessor Accessor{Buffer, cgh, sycl::write_only} ;
582
582
// Executing kernel
583
583
cgh.parallel_for< class FillBuffer>(
584
584
NumOfWorkItems, [= ](sycl::id< 1> WIid) {
585
- // Fill buffer with indexes
586
- Accessor[WIid] = (sycl::cl_int) WIid.get(0);
585
+ // Fill buffer with indexes.
586
+ Accessor[WIid] = WIid.get(0);
587
587
}) ;
588
588
});
589
589
590
590
// Getting read only access to the buffer on the host.
591
591
// Implicit barrier waiting for queue to complete the work.
592
- const auto HostAccessor = Buffer.get_access< sycl::access::mode::read> () ;
592
+ sycl::host_accessor HostAccessor{ Buffer, sycl::read_only} ;
593
593
594
594
// Check the results
595
595
bool MismatchFound = false ;
0 commit comments