| 450 | } |
| 451 | |
| 452 | void TensorImplDft::device_share_host_memory() { |
| 453 | if (is_host()) { |
| 454 | if (!m_dev_tensor) { |
| 455 | m_dev_tensor = std::make_shared<mgb::DeviceTensorND>( |
| 456 | m_host_tensor->comp_node(), m_host_tensor->layout()); |
| 457 | } |
| 458 | if (m_host_tensor->raw_ptr() != m_dev_tensor->raw_ptr()) { |
| 459 | auto& host_storage = m_host_tensor->storage(); |
| 460 | mgb::DeviceTensorStorage device_storage; |
| 461 | device_storage.reset( |
| 462 | host_storage.comp_node(), host_storage.size(), |
| 463 | host_storage.raw_storage()); |
| 464 | m_dev_tensor->only_reset_raw_storage(device_storage); |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | #endif |
| 470 |
no test coverage detected