Skip to content

Commit ee66942

Browse files
CUDA: fix peer access logic (#3231)
1 parent 111163e commit ee66942

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ggml-cuda.cu

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6286,12 +6286,14 @@ void ggml_cuda_set_peer_access(const int n_tokens) {
62866286
continue;
62876287
}
62886288

6289-
int canAccessPeer;
6290-
CUDA_CHECK(cudaDeviceCanAccessPeer(&canAccessPeer, id, id_other));
6291-
if (enable_peer_access) {
6292-
CUDA_CHECK(cudaDeviceEnablePeerAccess(id_other, 0));
6293-
} else {
6294-
CUDA_CHECK(cudaDeviceDisablePeerAccess(id_other));
6289+
int can_access_peer;
6290+
CUDA_CHECK(cudaDeviceCanAccessPeer(&can_access_peer, id, id_other));
6291+
if (can_access_peer) {
6292+
if (enable_peer_access) {
6293+
CUDA_CHECK(cudaDeviceEnablePeerAccess(id_other, 0));
6294+
} else {
6295+
CUDA_CHECK(cudaDeviceDisablePeerAccess(id_other));
6296+
}
62956297
}
62966298
}
62976299
}

0 commit comments

Comments
 (0)