From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- 20.02/_ref_tensor_handle_tests_8cpp.xhtml | 236 ++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 20.02/_ref_tensor_handle_tests_8cpp.xhtml (limited to '20.02/_ref_tensor_handle_tests_8cpp.xhtml') diff --git a/20.02/_ref_tensor_handle_tests_8cpp.xhtml b/20.02/_ref_tensor_handle_tests_8cpp.xhtml new file mode 100644 index 0000000000..2967ecc585 --- /dev/null +++ b/20.02/_ref_tensor_handle_tests_8cpp.xhtml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + +ArmNN: src/backends/reference/test/RefTensorHandleTests.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
RefTensorHandleTests.cpp File Reference
+
+
+
#include <reference/RefTensorHandle.hpp>
+#include <boost/test/unit_test.hpp>
+
+

Go to the source code of this file.

+ + + + + + + + + + +

+Functions

 BOOST_AUTO_TEST_CASE (AcquireAndRelease)
 
 BOOST_AUTO_TEST_CASE (CheckSourceType)
 
 BOOST_AUTO_TEST_CASE (ReusePointer)
 
 BOOST_AUTO_TEST_CASE (MisalignedPointer)
 
+

Function Documentation

+ +

◆ BOOST_AUTO_TEST_CASE() [1/4]

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (AcquireAndRelease )
+
+ +

Definition at line 12 of file RefTensorHandleTests.cpp.

+ +

References BOOST_CHECK(), armnn::Float32, and armnn::info.

+
13 {
14  std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
15 
16  TensorInfo info({1,1,1,1}, DataType::Float32);
17  RefTensorHandle handle(info, memoryManager);
18 
19  handle.Manage();
20  handle.Allocate();
21 
22  memoryManager->Acquire();
23  {
24  float *buffer = reinterpret_cast<float *>(handle.Map());
25 
26  BOOST_CHECK(buffer != nullptr); // Yields a valid pointer
27 
28  buffer[0] = 2.5f;
29 
30  BOOST_CHECK(buffer[0] == 2.5f); // Memory is writable and readable
31 
32  }
33  memoryManager->Release();
34 
35  memoryManager->Acquire();
36  {
37  float *buffer = reinterpret_cast<float *>(handle.Map());
38 
39  BOOST_CHECK(buffer != nullptr); // Yields a valid pointer
40 
41  buffer[0] = 3.5f;
42 
43  BOOST_CHECK(buffer[0] == 3.5f); // Memory is writable and readable
44  }
45  memoryManager->Release();
46 }
+ +
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
+ +
+
+
+ +

◆ BOOST_AUTO_TEST_CASE() [2/4]

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (CheckSourceType )
+
+ +

Definition at line 50 of file RefTensorHandleTests.cpp.

+ +

References BOOST_CHECK(), armnn::DmaBuf, armnn::DmaBufProtected, armnn::Float32, armnn::info, and armnn::Malloc.

+
51 {
52  std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
53 
54  TensorInfo info({1}, DataType::Float32);
55  RefTensorHandle handle(info, memoryManager, static_cast<unsigned int>(MemorySource::Malloc));
56 
57  int* testPtr = new int(4);
58 
59  // Not supported
60  BOOST_CHECK(!handle.Import(static_cast<void *>(testPtr), MemorySource::DmaBuf));
61 
62  // Not supported
63  BOOST_CHECK(!handle.Import(static_cast<void *>(testPtr), MemorySource::DmaBufProtected));
64 
65  // Supported
66  BOOST_CHECK(handle.Import(static_cast<void *>(testPtr), MemorySource::Malloc));
67 
68  delete testPtr;
69 }
+ +
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
+ +
+
+
+ +

◆ BOOST_AUTO_TEST_CASE() [3/4]

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (ReusePointer )
+
+ +

Definition at line 71 of file RefTensorHandleTests.cpp.

+ +

References BOOST_CHECK(), armnn::Float32, armnn::info, and armnn::Malloc.

+
72 {
73  std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
74 
75  TensorInfo info({1}, DataType::Float32);
76  RefTensorHandle handle(info, memoryManager, static_cast<unsigned int>(MemorySource::Malloc));
77 
78  int* testPtr = new int(4);
79 
80  handle.Import(static_cast<void *>(testPtr), MemorySource::Malloc);
81 
82  // Reusing previously Imported pointer
83  BOOST_CHECK(handle.Import(static_cast<void *>(testPtr), MemorySource::Malloc));
84 
85  delete testPtr;
86 }
+ +
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
+ +
+
+
+ +

◆ BOOST_AUTO_TEST_CASE() [4/4]

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (MisalignedPointer )
+
+ +

Definition at line 88 of file RefTensorHandleTests.cpp.

+ +

References BOOST_AUTO_TEST_SUITE_END(), BOOST_CHECK(), armnn::Float32, armnn::info, and armnn::Malloc.

+
89 {
90  std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
91 
92  TensorInfo info({2}, DataType::Float32);
93  RefTensorHandle handle(info, memoryManager, static_cast<unsigned int>(MemorySource::Malloc));
94 
95  // Allocate a 2 int array
96  int* testPtr = new int[2];
97 
98  // Increment pointer by 1 byte
99  void* misalignedPtr = static_cast<void*>(reinterpret_cast<char*>(testPtr) + 1);
100 
101  BOOST_CHECK(!handle.Import(misalignedPtr, MemorySource::Malloc));
102 
103  delete[] testPtr;
104 }
+ +
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
+ +
+
+
+
+
+ + + + -- cgit v1.2.1