MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / TEST_CASE

Function TEST_CASE

tests/validation/NEON/UNIT/MemoryManager.cpp:49–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47TEST_SUITE(MemoryManager)
48
49TEST_CASE(BlobMemoryManagerSimpleWithinFunctionLevel, framework::DatasetMode::ALL)
50{
51 Allocator allocator{};
52 auto lifetime_mgr = std::make_shared<BlobLifetimeManager>();
53 auto pool_mgr = std::make_shared<PoolManager>();
54 auto mm = std::make_shared<MemoryManagerOnDemand>(lifetime_mgr, pool_mgr);
55
56 // Create tensors
57 Tensor src = create_tensor<Tensor>(TensorShape(27U, 11U, 3U), DataType::F32, 1);
58 Tensor dst = create_tensor<Tensor>(TensorShape(27U, 11U, 3U), DataType::F32, 1);
59
60 // Create and configure function
61 NENormalizationLayer norm_layer_1(mm);
62 NENormalizationLayer norm_layer_2(mm);
63 norm_layer_1.configure(&src, &dst, NormalizationLayerInfo(NormType::CROSS_MAP, 3));
64 norm_layer_2.configure(&src, &dst, NormalizationLayerInfo(NormType::IN_MAP_1D, 3));
65
66 ARM_COMPUTE_ASSERT(src.info()->is_resizable());
67 ARM_COMPUTE_ASSERT(dst.info()->is_resizable());
68
69 // Allocate tensors
70 src.allocator()->allocate();
71 dst.allocator()->allocate();
72
73 ARM_COMPUTE_ASSERT(!src.info()->is_resizable());
74 ARM_COMPUTE_ASSERT(!dst.info()->is_resizable());
75
76 // Finalize memory manager
77 mm->populate(allocator, 1 /* num_pools */);
78 ARM_COMPUTE_EXPECT(mm->pool_manager()->num_pools() == 1, framework::LogLevel::ERRORS);
79 ARM_COMPUTE_EXPECT(mm->lifetime_manager()->are_all_finalized(), framework::LogLevel::ERRORS);
80
81 // Fill tensors
82 arm_compute::test::library->fill_tensor_uniform(Accessor(src), 0);
83
84 // Compute functions
85 norm_layer_1.run();
86 norm_layer_2.run();
87
88 // Clear manager
89 mm->clear();
90 ARM_COMPUTE_EXPECT(mm->pool_manager()->num_pools() == 0, framework::LogLevel::ERRORS);
91}
92
93TEST_SUITE_END()
94TEST_SUITE_END()

Callers

nothing calls this directly

Calls 15

AccessorClass · 0.85
num_poolsMethod · 0.80
pool_managerMethod · 0.80
are_all_finalizedMethod · 0.80
lifetime_managerMethod · 0.80
fill_tensor_uniformMethod · 0.80
TensorShapeClass · 0.50
configureMethod · 0.45
is_resizableMethod · 0.45
infoMethod · 0.45
allocateMethod · 0.45

Tested by

no test coverage detected