RT0510 Buffer must be constructed with nonzero range!

While compiling with ComputeCPP CE 1.3
cl::sycl::buffer<size_t, 1> empty_buffer(cl::sycl::range<1>(0));

Error: [ComputeCpp:RT0510] Unknown Error . Please contact Codeplay Support at ht
tp://support.codeplay.com/ (Buffer must be constructed with nonzero range!)

Is it possible to construct zero-sized buffers in SYCL?

Hi @dofamin01
You need to specify a number > 0 items when initializing the range, 0 items is not allowed by ComputeCpp.

Thanks, I found some workaround to avoid this by using default constructor and buffer::get_count() of them.

We were discussing that as an option, good find.

Is there any link to read this discussion? I wonder why not allowing zero-range buffers. To eliminate creating zero-ranged accessors? Found same question on Intel issues thread https://github.com/intel/llvm/issues/123

I meant we were talking about whether you could use the default constructor. I believe this was discussed within the SYCL working group but that’s all I know.
You could always raise an issue for discussion on the SYCL spec GitHub repo.