Lines Matching refs:ptr

409 inline bool MemoryBlock<T, A, S>::owns_pointer(const T *ptr) const noexcept  in owns_pointer()
412 return (ptr >= mem_) && (ptr < std::next(mem_, size())); in owns_pointer()
430 inline PetscErrorCode MemoryBlock<T, A, S>::try_allocate_chunk(size_type req_size, T **ptr, const s… in try_allocate_chunk() argument
443 *ptr = mem_ + block_alloced; in try_allocate_chunk()
453 *ptr = mem_ + chunk.start(); in try_allocate_chunk()
514 inline PetscErrorCode MemoryBlock<T, A, S>::try_deallocate_chunk(T **ptr, const stream_type *stream… in try_deallocate_chunk() argument
519 PetscCall(try_find_chunk(*ptr, &chunk)); in try_deallocate_chunk()
522 *ptr = nullptr; in try_deallocate_chunk()
540 inline PetscErrorCode MemoryBlock<T, A, S>::try_find_chunk(const T *ptr, chunk_type **ret_chunk) no… in try_find_chunk() argument
544 if (owns_pointer(ptr)) { in try_find_chunk()
545 const auto offset = static_cast<size_type>(ptr - mem_); in try_find_chunk()
554 …n though it is within block range [%zu, %zu)", reinterpret_cast<uintptr_t>(ptr), reinterpret_cast<… in try_find_chunk()
594 inline PetscErrorCode SegmentedMemoryPoolAllocatorBase<T>::allocate(value_type **ptr, size_type n, … in allocate() argument
597 PetscCall(PetscMalloc1(n, ptr)); in allocate()
603 inline PetscErrorCode SegmentedMemoryPoolAllocatorBase<T>::deallocate(value_type *ptr, const device… in deallocate() argument
606 PetscCall(PetscFree(ptr)); in deallocate()
612 inline PetscErrorCode SegmentedMemoryPoolAllocatorBase<T>::zero(value_type *ptr, size_type n, const… in zero() argument
615 PetscCall(PetscArrayzero(ptr, n)); in zero()
630 inline PetscErrorCode SegmentedMemoryPoolAllocatorBase<T>::set_canary(value_type *ptr, size_type n,… in set_canary() argument
636 for (size_type i = 0; i < n; ++i) ptr[i] = canary; in set_canary()
752 …Type, AllocType, DefaultChunkSize>::allocate_(size_type size, value_type **ptr, const stream_type … in allocate_() argument
759 PetscCall(block.try_allocate_chunk(size, ptr, stream, &found)); in allocate_()
767 PetscCall(pool_.back().try_allocate_chunk(size, ptr, stream, &found)); in allocate_()
796 …Type, AllocType, DefaultChunkSize>::allocate(size_t req_size, value_type **ptr, const stream_type … in allocate() argument
801 PetscAssertPointer(ptr, 2); in allocate()
815 *ptr = ret_ptr; in allocate()
830 …MemType, StreamType, AllocType, DefaultChunkSize>::deallocate(value_type **ptr, const stream_type … in deallocate() argument
833 PetscAssertPointer(ptr, 1); in deallocate()
836 if (!*ptr) PetscFunctionReturn(PETSC_SUCCESS); in deallocate()
840 PetscCall(block.try_deallocate_chunk(ptr, stream, &found)); in deallocate()
863 …AllocType, DefaultChunkSize>::reallocate(size_t new_req_size, value_type **ptr, const stream_type … in reallocate() argument
868 const auto old_ptr = *ptr; in reallocate()
872 PetscAssertPointer(ptr, 2); in reallocate()
877 PetscCall(deallocate(ptr, stream)); in reallocate()
886 …ETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Memory pool does not own %p, so cannot reallocate it", *ptr); in reallocate()
890 *ptr = nullptr; in reallocate()
892 PetscCall(allocate(new_size, ptr, stream)); in reallocate()
893 PetscCall(allocator_.uninitialized_copy(*ptr, old_ptr, new_size, stream)); in reallocate()