5#include <batchlas/export.hh>
55 : queue_(other.queue_), ptr_(other.ptr_), size_(other.size_),
56 block_(other.block_), offset_(other.offset_), seq_(other.seq_) {
57 other.queue_ =
nullptr;
69 queue_ = other.queue_;
72 block_ = other.block_;
73 offset_ = other.offset_;
75 other.queue_ =
nullptr;
93 operator
Span<std::
byte>() const &;
94 operator
Span<std::
byte>() const && = delete;
97 std::
byte*
data() const & {
return ptr_; }
98 std::byte*
data() const && = delete;
100 std::
size_t size()
const {
return size_; }
116 void release_(
bool diagnose_out_of_order) noexcept;
118 WorkspaceLease(
Queue* q, std::
byte* p, std::
size_t n, std::
size_t block, std::
size_t offset,
120 : queue_(q), ptr_(p), size_(n), block_(block), offset_(offset), seq_(seq) {}
122 Queue* queue_ =
nullptr;
123 std::byte* ptr_ =
nullptr;
124 std::size_t size_ = 0;
125 std::size_t block_ = 0;
126 std::size_t offset_ = 0;
128 std::uint64_t seq_ = 0;
void release() noexcept
Give the bytes back before the handle goes out of scope.
Span< std::byte > span() const &
The borrowed bytes.
WorkspaceLease(const WorkspaceLease &)=delete
WorkspaceLease & operator=(const WorkspaceLease &)=delete
WorkspaceLease(WorkspaceLease &&other) noexcept
Take over other's loan; other becomes empty.
WorkspaceLease()=default
An empty lease that owns nothing.
WorkspaceLease & operator=(WorkspaceLease &&other) noexcept
Release this lease's loan, then take over other's.
~WorkspaceLease()
Returns the loan to the arena (see release()).
std::size_t size() const
Number of bytes borrowed.
std::byte * data() const &&=delete
std::byte * data() const &
Pointer to the borrowed bytes; lvalue-only, as span(). nullptr for an empty lease.
Where BatchLAS work runs: a device, a backend, an ordered SYCL queue and a workspace arena.
Non-owning view of size() contiguous elements of type T.