| 170 | } |
| 171 | |
| 172 | Result<std::unique_ptr<Buffer>> MyMemoryManager::CopyNonOwnedTo( |
| 173 | const Buffer& buf, const std::shared_ptr<MemoryManager>& to) { |
| 174 | if (!allow_copy()) { |
| 175 | return nullptr; |
| 176 | } |
| 177 | if (to->is_cpu() && buf.parent()) { |
| 178 | // MyDevice to CPU |
| 179 | return MemoryManager::CopyNonOwned(*buf.parent(), to); |
| 180 | } |
| 181 | return nullptr; |
| 182 | } |
| 183 | |
| 184 | Result<std::shared_ptr<Buffer>> MyMemoryManager::ViewBufferFrom( |
| 185 | const std::shared_ptr<Buffer>& buf, const std::shared_ptr<MemoryManager>& from) { |