From 17b12307edeaf488cfdf0cc3fa00b8f08293c93e Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 18 Jun 2018 18:13:51 +0100 Subject: COMPMID-1293: Handle aligned allocations Change-Id: I6e642c8cd968240f883c327464519e57e5d0c3e3 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/136088 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/validation/NEON/UNIT/TensorAllocator.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/validation/NEON/UNIT') diff --git a/tests/validation/NEON/UNIT/TensorAllocator.cpp b/tests/validation/NEON/UNIT/TensorAllocator.cpp index 872054f3d1..7781107210 100644 --- a/tests/validation/NEON/UNIT/TensorAllocator.cpp +++ b/tests/validation/NEON/UNIT/TensorAllocator.cpp @@ -23,9 +23,12 @@ */ #include "arm_compute/runtime/TensorAllocator.h" +#include "arm_compute/core/utils/misc/Utility.h" #include "arm_compute/runtime/MemoryGroup.h" #include "arm_compute/runtime/MemoryRegion.h" + #include "support/ToolchainSupport.h" + #include "tests/Utils.h" #include "tests/framework/Asserts.h" #include "tests/framework/Macros.h" @@ -82,6 +85,22 @@ TEST_CASE(ImportMemory, framework::DatasetMode::ALL) ARM_COMPUTE_EXPECT(t4.buffer() == nullptr, framework::LogLevel::ERRORS); } +TEST_CASE(AlignedAlloc, framework::DatasetMode::ALL) +{ + // Init tensor info + TensorInfo info(TensorShape(24U, 16U, 3U), 1, DataType::F32); + const size_t requested_alignment = 1024; + + Tensor t; + t.allocator()->init(info, requested_alignment); + t.allocator()->allocate(); + + ARM_COMPUTE_EXPECT(t.buffer() != nullptr, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(t.allocator()->alignment() == requested_alignment, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(arm_compute::utility::check_aligned(reinterpret_cast(t.buffer()), requested_alignment), + framework::LogLevel::ERRORS); +} + TEST_SUITE_END() TEST_SUITE_END() TEST_SUITE_END() -- cgit v1.2.1