Lines Matching refs:align
33 align_type align; member
43 …tionHeader::AllocationHeader(size_type size, align_type align) noexcept : size{size}, align{align}… in AllocationHeader() argument
102 constexpr PoolAllocator::size_type PoolAllocator::total_size_(size_type size, align_type align) noe… in total_size_() argument
106 return AllocationHeader::header_size() + size + util::to_underlying(align) - 1; in total_size_()
134 PetscCall(PetscUnpoisonMemoryRegion(header, total_size_(header->size, header->align))); in delete_ptr_()
149 PoolAllocator::pool_type::iterator PoolAllocator::find_align_(align_type align) noexcept in find_align_() argument
151 …egin(), this->pool().end(), align, [](const pool_type::value_type &pair, const align_type &align) … in find_align_() argument
154 PoolAllocator::pool_type::const_iterator PoolAllocator::find_align_(align_type align) const noexcept in find_align_()
156 …egin(), this->pool().end(), align, [](const pool_type::value_type &pair, const align_type &align) … in find_align_() argument
220 const auto align = util::to_underlying(in_align); in valid_alignment_() local
223 …PetscAssert((align > 0) && (align <= max_align), PETSC_COMM_SELF, PETSC_ERR_MEMC, "Alignment %zu m… in valid_alignment_()
224 …PetscAssert(!(align & (align - 1)), PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Alignment %zu must be a… in valid_alignment_()
297 PetscErrorCode PoolAllocator::allocate_ptr_(size_type size, align_type align, void **ret_ptr) noexc… in allocate_ptr_() argument
300 const auto total_size = total_size_(size, align); in allocate_ptr_()
308 PetscCall(valid_alignment_(align)); in allocate_ptr_()
330 …unsigned char *>(util::construct_at(reinterpret_cast<AllocationHeader *>(base_ptr), size, align))); in allocate_ptr_()
334 *ret_ptr = std::align(util::to_underlying(align), size, aligned_ptr, usable_size); in allocate_ptr_()
336 …led to align pointer %p (size %zu, alignment %zu)", aligned_ptr, size, util::to_underlying(align)); in allocate_ptr_()
386 PetscErrorCode PoolAllocator::get_attributes(const void *ptr, size_type *size, align_type *align) n… in get_attributes() argument
392 if (align) PetscAssertPointer(align, 3); in get_attributes()
393 if (PetscLikely(size || align)) { in get_attributes()
399 if (align) *align = header->align; in get_attributes()
424 PetscErrorCode PoolAllocator::try_allocate(void **out_ptr, size_type size, align_type align, bool *… in try_allocate() argument
432 PetscCall(valid_alignment_(align)); in try_allocate()
435 const auto align_it = find_align_(align); in try_allocate()
437 if (align_it != this->pool().end() && align_it->first == align) { in try_allocate()
472 PetscErrorCode PoolAllocator::allocate(void **out_ptr, size_type size, align_type align, bool *allo… in allocate() argument
479 PetscCall(try_allocate(out_ptr, size, align, &success)); in allocate()
480 if (!success) PetscCall(allocate_ptr_(size, align, out_ptr)); in allocate()
500 PetscErrorCode PoolAllocator::deallocate(void **in_ptr, size_type size, align_type align) noexcept in deallocate() argument
513 auto it = find_align_(align); in deallocate()
515 …if (it == this->pool().end() || it->first != align) PetscCallCXX(it = this->pool().insert(it, {ali… in deallocate()
596 align_type align{}; in operator delete() local
599 PetscCallAbort(PETSC_COMM_SELF, allocated.get_attributes(ptr, &size, &align)); in operator delete()
600 PetscCallAbort(PETSC_COMM_SELF, allocated.deallocate(&ptr, size, align)); in operator delete()
606 void *PoolAllocated::operator new(size_type size, std::align_val_t align) noexcept in operator new() argument
611 PetscCallAbort(PETSC_COMM_SELF, pool().allocate(&ptr, size, static_cast<align_type>(align))); in operator new()
615 void PoolAllocated::operator delete(void *ptr, std::align_val_t align) noexcept in operator delete() argument
622 PetscCallAbort(PETSC_COMM_SELF, pool().deallocate(&ptr, size, static_cast<align_type>(align))); in operator delete()