| 194 | } |
| 195 | |
| 196 | Result<std::shared_ptr<Buffer>> MyMemoryManager::ViewBufferTo( |
| 197 | const std::shared_ptr<Buffer>& buf, const std::shared_ptr<MemoryManager>& to) { |
| 198 | if (!allow_view()) { |
| 199 | return nullptr; |
| 200 | } |
| 201 | if (to->is_cpu() && buf->parent()) { |
| 202 | // MyDevice on CPU: unwrap buffer |
| 203 | return buf->parent(); |
| 204 | } |
| 205 | return nullptr; |
| 206 | } |
| 207 | |
| 208 | // Like AssertBufferEqual, but doesn't call Buffer::data() |
| 209 | void AssertMyBufferEqual(const Buffer& buffer, std::string_view expected) { |