static */
| 1562 | } |
| 1563 | |
| 1564 | /* static */ port::Status GpuDriver::EnablePeerAccess(GpuContext* from, |
| 1565 | GpuContext* to) { |
| 1566 | if (from == to) { |
| 1567 | return port::Status::OK(); // A context can always access its own memory. |
| 1568 | } |
| 1569 | |
| 1570 | ScopedActivateContext activated{from}; |
| 1571 | CUresult result = cuCtxEnablePeerAccess(to->context(), 0 /* = flags */); |
| 1572 | if (result != CUDA_SUCCESS && |
| 1573 | result != CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED) { |
| 1574 | return port::Status( |
| 1575 | port::error::INTERNAL, |
| 1576 | absl::StrFormat("failed to enable peer access from %p to %p: %s", from, |
| 1577 | to, ToString(result))); |
| 1578 | } |
| 1579 | |
| 1580 | return port::Status::OK(); |
| 1581 | } |
| 1582 | |
| 1583 | /* static */ bool GpuDriver::BeginGraphCaptureOnStream( |
| 1584 | GpuContext* context, CUstream stream, GpuStreamCaptureMode mode) { |