| 453 | |
| 454 | public: |
| 455 | void alloc_dynamic(VarNode* var, DeviceTensorStorage& dest, size_t size) override { |
| 456 | ASSERT_LT(dest.size(), size); |
| 457 | ++m_nr_alive; |
| 458 | auto ptr = dest.comp_node().alloc_device(size); |
| 459 | auto del = [this, cn = dest.comp_node()](void* ptr) { |
| 460 | cn.free_device(ptr); |
| 461 | auto nr = m_nr_alive.fetch_sub(1); |
| 462 | ASSERT_GT(nr, 0u); |
| 463 | }; |
| 464 | dest.reset(dest.comp_node(), size, {static_cast<dt_byte*>(ptr), del}); |
| 465 | } |
| 466 | |
| 467 | size_t nr_alive() const { return m_nr_alive; } |
| 468 |
nothing calls this directly
no test coverage detected