diff options
Diffstat (limited to 'src/runtime')
-rw-r--r-- | src/runtime/TensorAllocator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/TensorAllocator.cpp b/src/runtime/TensorAllocator.cpp index 7352932ac7..34ea929f28 100644 --- a/src/runtime/TensorAllocator.cpp +++ b/src/runtime/TensorAllocator.cpp @@ -132,13 +132,15 @@ uint8_t *TensorAllocator::data() const void TensorAllocator::allocate() { + // Align to 64-byte boundaries by default if alignment is not specified + const size_t alignment_to_use = (alignment() != 0) ? alignment() : 64; if(_associated_memory_group == nullptr) { - _memory.set_owned_region(support::cpp14::make_unique<MemoryRegion>(info().total_size(), alignment())); + _memory.set_owned_region(support::cpp14::make_unique<MemoryRegion>(info().total_size(), alignment_to_use)); } else { - _associated_memory_group->finalize_memory(_owner, _memory, info().total_size(), alignment()); + _associated_memory_group->finalize_memory(_owner, _memory, info().total_size(), alignment_to_use); } info().set_is_resizable(false); } |