| 149 | static thread_local OpDef::allocator_t local_allocator; |
| 150 | |
| 151 | void OpDef::set_allocator(allocator_t allocator) { |
| 152 | mgb_assert(!local_allocator, "allocator has been set before"); |
| 153 | local_allocator = allocator; |
| 154 | } |
| 155 | |
| 156 | DeviceTensorStorage::RawStorage OpDef::allocate(CompNode device, size_t size) const { |
| 157 | return local_allocator(device, size); |