| 87 | } |
| 88 | |
| 89 | Result<std::unique_ptr<Buffer>> MemoryManager::CopyNonOwned( |
| 90 | const Buffer& buf, const std::shared_ptr<MemoryManager>& to) { |
| 91 | const auto& from = buf.memory_manager(); |
| 92 | auto maybe_buffer = to->CopyNonOwnedFrom(buf, from); |
| 93 | COPY_BUFFER_RETURN(maybe_buffer, to); |
| 94 | // `to` doesn't support copying from `from`, try the other way |
| 95 | maybe_buffer = from->CopyNonOwnedTo(buf, to); |
| 96 | COPY_BUFFER_RETURN(maybe_buffer, to); |
| 97 | |
| 98 | return Status::NotImplemented("Copying buffer from ", from->device()->ToString(), |
| 99 | " to ", to->device()->ToString(), " not supported"); |
| 100 | } |
| 101 | |
| 102 | Result<std::shared_ptr<Buffer>> MemoryManager::ViewBuffer( |
| 103 | const std::shared_ptr<Buffer>& buf, const std::shared_ptr<MemoryManager>& to) { |
nothing calls this directly
no test coverage detected