Lines Matching +full:- +full:std

38     return static_cast<const T &>(*this).record_event_(std::forward<E>(event));  in record_event()
44 return static_cast<const T &>(*this).wait_for_(std::forward<E>(event)); in wait_for_event()
51 using default_stream_type = std::nullptr_t;
71 const typename StreamBase<T>::id_type StreamBase<T>::INVALID_ID = -1;
90 // Represents a checked-out region of a MemoryBlock. Tracks the offset into the owning
98 using size_type = std::size_t;
138 // MemoryChunk - Private API
146 return (stream_id_ == strm->INVALID_ID) || (stream_id_ == strm->get_id()); in stream_compat_()
150 // MemoryChunk - Public API
165std::move(other.event_)), open_(util::exchange(other.open_, false)), stream_id_(util::exchange(oth… in MemoryChunk()
174 event_ = std::move(other.event_); in operator =()
178 start_ = std::move(other.start_); in operator =()
184 MemoryChunk::release - release a chunk on a stream
187 . stream - the stream to release the chunk with
193 Future allocation requests which attempt to claim the chunk on the same stream may re-acquire
205 stream_id_ = stream->get_id(); in release()
206 PetscCall(stream->record_event(event_)); in release()
211 MemoryChunk::claim - attempt to claim a particular chunk
214 + stream - the stream on which to attempt to claim
215 . req_size - the requested size (in elements) to attempt to claim
216 - serialize - (optional, false) whether the claimant allows serialization
219 . success - true if the chunk was claimed, false otherwise
227 if (serialize && !stream_compat_(stream)) PetscCall(stream->wait_for_event(event_)); in claim()
235 MemoryChunk::can_claim - test whether a particular chunk can be claimed
238 + stream - the stream on which to attempt to claim
239 . req_size - the requested size (in elements) to attempt to claim
240 - serialize - whether the claimant allows serialization
243 . [return] - true if the chunk is claimable given the configuration, false otherwise
260 MemoryChunk::resize - grow a chunk to new size
263 . newsize - the new size Requested
278 MemoryChunk::contains - query whether a memory chunk contains a particular offset
281 . offset - The offset from the MemoryBlock start
296 // and restoring a block is thread-safe (so may be used by multiple device streams).
308 using chunk_list_type = std::vector<chunk_type>;
313 ~MemoryBlock() noexcept(std::is_nothrow_destructible<chunk_list_type>::value);
322 /* --- actual functions --- */
342 // MemoryBlock - Private API
351 PetscCall(allocator_->deallocate(mem_, stream)); in clear_()
360 // MemoryBlock - Public API
369 PetscCallAbort(PETSC_COMM_SELF, alloc->allocate(&mem_, s, stream)); in MemoryBlock()
375 MemoryBlock<T, A, S>::~MemoryBlock() noexcept(std::is_nothrow_destructible<chunk_list_type>::value) in ~MemoryBlock()
385 …locator_(other.allocator_), size_(util::exchange(other.size_, 0)), chunks_(std::move(other.chunks_… in MemoryBlock()
400 chunks_ = std::move(other.chunks_); in operator =()
406 MemoryBock::owns_pointer - returns true if this block owns a pointer, false otherwise
412 return (ptr >= mem_) && (ptr < std::next(mem_, size())); in owns_pointer()
416 MemoryBlock::try_allocate_chunk - try to get a chunk from this MemoryBlock
419 + req_size - the requested size of the allocation (in elements)
420 . ptr - ptr to fill
421 - stream - stream to fill the pointer on
424 . success - true if chunk was gotten, false otherwise
498 MemoryBlock::try_deallocate_chunk - try to restore a chunk to this MemoryBlock
501 + ptr - ptr to restore
502 - stream - stream to restore the pointer on
505 . success - true if chunk was restored, false otherwise
521 PetscCall(chunk->release(stream)); in try_deallocate_chunk()
531 MemoryBlock::try_find_chunk - try to find the chunk which owns ptr
534 . ptr - the pointer to look for
537 . ret_chunk - pointer to the owning chunk or nullptr if not found
545 const auto offset = static_cast<size_type>(ptr - mem_); in try_find_chunk()
554 …tr_t>(ptr), reinterpret_cast<uintptr_t>(mem_), reinterpret_cast<uintptr_t>(std::next(mem_, size())… in try_find_chunk()
577 using size_type = std::size_t;
632 using limit_type = std::numeric_limits<real_value_type>; in set_canary()
645 // Stream-aware async memory allocator. Holds a list of memory "blocks" which each control an
647 // consecutive, non-overlapping regions of the block. Chunks may be in 1 of 2 states:
667 // |-----------------------------------------------------------------------------------------
670 // | ||-------------||
671 // | || || -------------------------------------------------------------------
674 // | || || | x-----x-------x-----xx---------x---------x------x-----x
675 // | || MemoryBlock || -> | ------|-------------|----------|----------------|--------
677 // | || || | ---------------------------------------------------------
678 // | || || -------------------------------------------------------------------
679 // | ||-------------||
685 …eam, typename AllocType = impl::SegmentedMemoryPoolAllocatorBase<MemType>, std::size_t DefaultChun…
689 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
696 using pool_type = std::deque<block_type>;
699 …explicit SegmentedMemoryPool(AllocType = AllocType{}, std::size_t = DefaultChunkSize) noexcept(std
701 …PetscErrorCode allocate(size_t, value_type **, const stream_type *, size_type = std::alignment_of<…
720 // SegmentedMemoryPool - Private API
723 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
726 const auto block_size = std::max(size, chunk_size_); in make_block_()
734 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
742 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
751 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
757 PetscCall(this->register_finalize(stream)); in allocate_()
773 // SegmentedMemoryPool - Public API
776 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
777 …moryPool(AllocType alloc, std::size_t size) noexcept(std::is_nothrow_default_constructible<pool_ty… in SegmentedMemoryPool()
782 SegmentedMemoryPool::allocate - get an allocation from the memory pool
785 + req_size - size (in elements) to get
786 . ptr - the pointer to hold the allocation
787 - stream - the stream on which to get the allocation
790 . ptr - the pointer holding the allocation
795 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
810 std::align(alignment, size, vptr, aligned_size); in allocate()
820 SegmentedMemoryPool::deallocate - release a pointer back to the memory pool
823 + ptr - the pointer to release
824 - stream - the stream to release it on
829 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
847 SegmentedMemoryPool::reallocate - Resize an allocated buffer
850 + new_req_size - the new buffer size
851 . ptr - pointer to the buffer
852 - stream - stream to resize with
855 . ptr - pointer to the new region
862 template <typename MemType, typename StreamType, typename AllocType, std::size_t DefaultChunkSize>
888 if (chunk->capacity() < new_size) { in reallocate()
891 PetscCall(chunk->release(stream)); in reallocate()
896 PetscCall(chunk->resize(new_size)); in reallocate()