From 99d40951df87790fb884ce1c42d5e2a7a0009ee0 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 23 Apr 2018 16:26:46 +0100 Subject: COMPMID-1023: Import memory for OpenCL Change-Id: I201bc00a1261814737e6b6878ecfe9904bae0cc1 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/128212 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/validation/NEON/UNIT/TensorAllocator.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tests/validation/NEON/UNIT') diff --git a/tests/validation/NEON/UNIT/TensorAllocator.cpp b/tests/validation/NEON/UNIT/TensorAllocator.cpp index 4732f3f088..872054f3d1 100644 --- a/tests/validation/NEON/UNIT/TensorAllocator.cpp +++ b/tests/validation/NEON/UNIT/TensorAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -24,6 +24,7 @@ #include "arm_compute/runtime/TensorAllocator.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" @@ -45,10 +46,7 @@ TEST_CASE(ImportMemory, framework::DatasetMode::ALL) TensorInfo info(TensorShape(24U, 16U, 3U), 1, DataType::F32); // Allocate memory buffer - std::shared_ptr buf(new uint8_t[info.total_size()](), [](uint8_t *ptr) - { - delete[] ptr; - }); + auto buf = std::make_shared(info.total_size()); // Negative case : Import empty memory Tensor t1; @@ -68,7 +66,7 @@ TEST_CASE(ImportMemory, framework::DatasetMode::ALL) t3.allocator()->init(info); ARM_COMPUTE_EXPECT(bool(t3.allocator()->import_memory(Memory(buf.get()))), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(!t3.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(t3.buffer() == buf.get(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(t3.buffer() == reinterpret_cast(buf->buffer()), framework::LogLevel::ERRORS); t3.allocator()->free(); ARM_COMPUTE_EXPECT(t3.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(t3.buffer() == nullptr, framework::LogLevel::ERRORS); @@ -78,7 +76,7 @@ TEST_CASE(ImportMemory, framework::DatasetMode::ALL) t4.allocator()->init(info); ARM_COMPUTE_EXPECT(bool(t4.allocator()->import_memory(Memory(buf))), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(!t4.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(t4.buffer() == buf.get(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(t4.buffer() == reinterpret_cast(buf->buffer()), framework::LogLevel::ERRORS); t4.allocator()->free(); ARM_COMPUTE_EXPECT(t4.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(t4.buffer() == nullptr, framework::LogLevel::ERRORS); -- cgit v1.2.1