Why use uint64_t for passing MemoryBuffer pointers? Why use uint64_t and uint16_t for buffer sizes and alignment respectively? Should we not use (u)int8_t* for buffer pointers?
I think we need to rework the buffers.
Consider the following from "benchmark/memory.cc:113":
MemoryBuffer MemoryBuffer::wrap(uint64_t p, uint64_t len, AddressSpace addr_space_id)
{
return MemoryBuffer(p, len, addr_space_id);
}
Here uint64_t
is used to hold a pointer, pointer size depends on system type. Passing pointers like this will fail for 63-bit and below systems and lead to errors for 65-bit and above systems. Since we want to manipulate the buffers on an 8-bit--per--byte level I think we should make the pointers either void*
(since they essentially are just buffers) or (u)int8_t*
since we want to manipulate them on that level. I would go for void*
.
Why restrict len
to being 64-bit? I think we should make this size_t
for flexibility or uint32_t
as most MPI implementations are still restricted to 32-bit sizes for buffers.
Also consider "benchmark/memory.cc:52":
MemoryBuffer::MemoryBuffer(Allocator* alloc, uint64_t len, uint16_t align)
: p_(0), len_(len), align_(align), alloc_(alloc)
{
if (alloc_) {
p_ = alloc_->alloc(len_, align_);
addr_space_id_ = alloc_->address_space_id();
}
}
Why restrict align
to uint16_t
? Currently larger aligns are not realistic, but why not simply make it size_t
for future ease of use?