Wrong data output

Greetings! I have a question about code below. When i set size parameter bigger than some number(i don’t know exactly) 10241024256 my buffer obtains zero results instead of 1. What could be the problem? I tested it on gpu and also on cpu. Also i tried hierchical kernels. Futhermore , i got the same damaged results when did propper range<3> cycle with right group size and item size.

const u_quad_t size = 1024*1024*256;
cl::sycl::buffer<u_quad_t, 1> mas(cl::sycl::range<1>{size});

cl::sycl::queue qq(cl::sycl::gpu_selector{});
{
       qq.submit([&](cl::sycl::handler h){
       auto result = mas.get_access<cl::sycl::access::mode::write>(h);
       h.parallel_for<vector_addition>(cl::sycl:range<1>{size},[=](cl::sycl::item<1> index){
                              result[index] = 1;
                  });
        });
        
       auto c = mas.get_access<cl::sycl::access::mode::write>(h);
       for(int i =0 ; i < size: i++){
               std::cout  << c[i] << std::endl;
       }

}


Hi @alex2671, you should try setting an error handler on your queue. It’s possible that the size is too large and the kernel is failing to run. This sample shows how to use an asynchronous handler (you’ll also need to call one of the functions that throws, like queue::throw() to see if an error has happened).

One possible issue is that you’re using mode::write instead of mode::read when declaring the accessor c.