| 403 | } |
| 404 | |
| 405 | at::Tensor waitReload(at::Tensor tensor, long id) |
| 406 | { |
| 407 | assert(hasKey(reload_events_, id)); |
| 408 | reload_events_[id]->block(at::cuda::getCurrentCUDAStream()); |
| 409 | |
| 410 | assert(hasKey(reload_buffers_, id)); |
| 411 | auto ten = reload_buffers_.at(id); |
| 412 | |
| 413 | // We can't release here because the tensor is still being used |
| 414 | // We will need "freeReloadedTensor" after the last user of the tensor to call |
| 415 | // ".record_stream". As it is a bit complicated, we clear the buffer and do at the end of |
| 416 | // the backward pass for now. reload_buffers_.erase(id); |
| 417 | return ten; |
| 418 | } |
| 419 | |
| 420 | void offloadParameter(at::Tensor tensor, long ds_id) { param_registry_->offload(ds_id); } |
| 421 | void reloadParameter(at::Tensor tensor, long ds_id) { param_registry_->reload(ds_id); } |
no test coverage detected