| 1702 | } |
| 1703 | |
| 1704 | void ChannelImpl::DynamicSublinear::erase_candidate(TensorInfo* ptr) { |
| 1705 | // close dtr will just clear candidates, so nothing to erase |
| 1706 | if (candidates.empty()) { |
| 1707 | ptr->cand_index = UINT_MAX; |
| 1708 | return; |
| 1709 | } |
| 1710 | // some tensors may be erased already, just skip them |
| 1711 | if (ptr->cand_index != UINT_MAX) { |
| 1712 | std::swap(candidates[ptr->cand_index], candidates.back()); |
| 1713 | candidates[ptr->cand_index]->cand_index = ptr->cand_index; |
| 1714 | candidates.pop_back(); |
| 1715 | ptr->cand_index = UINT_MAX; |
| 1716 | } |
| 1717 | } |
| 1718 | |
| 1719 | void ChannelImpl::DynamicSublinear::update_used_time(TensorInfo* ptr) { |
| 1720 | ptr->last_used_time = estimate_timestamp; |