aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CL/UNIT/TensorAllocator.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-11-14 13:16:56 +0000
committerIsabella Gottardi <isabella.gottardi@arm.com>2018-11-21 09:52:04 +0000
commitdf3103622b7de05f4e35b22a2c94b4a46eab4efc (patch)
tree17e10253e7a069c69d10bea0882b699b99d74b86 /tests/validation/CL/UNIT/TensorAllocator.cpp
parentc47ef20d69e8ea0f519fdc679435cd7037fc18fe (diff)
downloadComputeLibrary-df3103622b7de05f4e35b22a2c94b4a46eab4efc.tar.gz
COMPMID-1088: Use IMemoryRegion in interfaces where possible
-Simplifies import memory interface -Changes the used of void** handles with appropriate interfaces. Change-Id: I5918c855c11f46352058864623336b352162a4b7
Diffstat (limited to 'tests/validation/CL/UNIT/TensorAllocator.cpp')
-rw-r--r--tests/validation/CL/UNIT/TensorAllocator.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/validation/CL/UNIT/TensorAllocator.cpp b/tests/validation/CL/UNIT/TensorAllocator.cpp
index a34a37eb7b..849eee84d0 100644
--- a/tests/validation/CL/UNIT/TensorAllocator.cpp
+++ b/tests/validation/CL/UNIT/TensorAllocator.cpp
@@ -45,31 +45,32 @@ TEST_CASE(ImportMemory, framework::DatasetMode::ALL)
// Init tensor info
TensorInfo info(TensorShape(24U, 16U, 3U), 1, DataType::F32);
- // Allocate memory
- auto buf = std::make_shared<CLBufferMemoryRegion>(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, info.total_size());
+ // Allocate memory buffer
+ const size_t total_size = info.total_size();
+ auto buf = cl::Buffer(CLScheduler::get().context(), CL_MEM_READ_WRITE, total_size);
- // Negative case : Import empty memory
+ // Negative case : Import nullptr
CLTensor t1;
t1.allocator()->init(info);
- ARM_COMPUTE_EXPECT(!bool(t1.allocator()->import_memory(CLMemory())), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!bool(t1.allocator()->import_memory(cl::Buffer())), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(t1.info()->is_resizable(), framework::LogLevel::ERRORS);
// Negative case : Import memory to a tensor that is memory managed
CLTensor t2;
CLMemoryGroup mg;
t2.allocator()->set_associated_memory_group(&mg);
- ARM_COMPUTE_EXPECT(!bool(t2.allocator()->import_memory(CLMemory(buf))), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!bool(t2.allocator()->import_memory(buf)), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(t2.info()->is_resizable(), framework::LogLevel::ERRORS);
- // Positive case : Set managed pointer
+ // Positive case : Set raw pointer
CLTensor t3;
t3.allocator()->init(info);
- ARM_COMPUTE_EXPECT(bool(t3.allocator()->import_memory(CLMemory(buf))), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(bool(t3.allocator()->import_memory(buf)), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!t3.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(t3.cl_buffer().get() == buf->cl_data().get(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(t3.cl_buffer().get() == buf.get(), 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);
+ ARM_COMPUTE_EXPECT(t3.cl_buffer().get() != buf.get(), framework::LogLevel::ERRORS);
}
TEST_SUITE_END()