| 129 | } |
| 130 | |
| 131 | void CLTensorAllocator::allocate() |
| 132 | { |
| 133 | // Allocate tensor backing memory |
| 134 | if (_associated_memory_group == nullptr) |
| 135 | { |
| 136 | // Perform memory allocation |
| 137 | if (static_global_cl_allocator != nullptr) |
| 138 | { |
| 139 | _memory.set_owned_region(static_global_cl_allocator->make_region(info().total_size(), 0)); |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | _memory.set_owned_region(allocate_region(info().total_size(), 0)); |
| 144 | } |
| 145 | } |
| 146 | else |
| 147 | { |
| 148 | // Finalize memory management instead |
| 149 | _associated_memory_group->finalize_memory(_owner, _memory, info().total_size(), alignment()); |
| 150 | } |
| 151 | |
| 152 | // Allocate and fill the quantization parameter arrays |
| 153 | if (is_data_type_quantized_per_channel(info().data_type())) |
| 154 | { |
| 155 | const size_t pad_size = 0; |
| 156 | populate_quantization_info(_scale, _offset, info().quantization_info(), pad_size); |
| 157 | } |
| 158 | |
| 159 | // Lock allocator |
| 160 | info().set_is_resizable(false); |
| 161 | } |
| 162 | |
| 163 | void CLTensorAllocator::free() |
| 164 | { |
nothing calls this directly
no test coverage detected