diff --git a/oneflow/core/ep/cpu/cpu_device.cpp b/oneflow/core/ep/cpu/cpu_device.cpp index 14c0415b6ec..c9132bb4b93 100644 --- a/oneflow/core/ep/cpu/cpu_device.cpp +++ b/oneflow/core/ep/cpu/cpu_device.cpp @@ -44,7 +44,7 @@ Maybe CpuDevice::Alloc(const AllocationOptions& options, void** ptr, size_ CHECK_OR_RETURN(device); return device->AllocPinned(options, ptr, size); } else { - *ptr = aligned_alloc(kMaxAlignmentRequirement, size); + *ptr = aligned_alloc(kMaxAlignmentRequirement, RoundUp(size, kMaxAlignmentRequirement)); if (*ptr == nullptr) { return Error::RuntimeError() << "allocate failed"; } else {