@@ -263,7 +263,10 @@ class buffer {
263
263
size_t get_count () const { return size (); }
264
264
size_t size () const noexcept { return Range.size (); }
265
265
266
- size_t get_size () const { return size () * sizeof (T); }
266
+ __SYCL2020_DEPRECATED (
267
+ " get_size() is deprecated, please use byte_size() instead" )
268
+ size_t get_size () const { return byte_size (); }
269
+ size_t byte_size () const noexcept { return size () * sizeof (T); }
267
270
268
271
AllocatorT get_allocator () const {
269
272
return impl->template get_allocator <AllocatorT>();
@@ -343,7 +346,7 @@ class buffer {
343
346
template <typename ReinterpretT, int ReinterpretDim>
344
347
buffer<ReinterpretT, ReinterpretDim, AllocatorT>
345
348
reinterpret (range<ReinterpretDim> reinterpretRange) const {
346
- if (sizeof (ReinterpretT) * reinterpretRange.size () != get_size ())
349
+ if (sizeof (ReinterpretT) * reinterpretRange.size () != byte_size ())
347
350
throw cl::sycl::invalid_object_error (
348
351
" Total size in bytes represented by the type and range of the "
349
352
" reinterpreted SYCL buffer does not equal the total size in bytes "
@@ -369,7 +372,7 @@ class buffer {
369
372
(sizeof (ReinterpretT) != sizeof (T))),
370
373
buffer<ReinterpretT, ReinterpretDim, AllocatorT>>::type
371
374
reinterpret () const {
372
- long sz = get_size (); // TODO: switch to byte_size() once implemented
375
+ long sz = byte_size ();
373
376
if (sz % sizeof (ReinterpretT) != 0 )
374
377
throw cl::sycl::invalid_object_error (
375
378
" Total byte size of buffer is not evenly divisible by the size of "
0 commit comments