Skip to content

Commit 7be5f2c

Browse files
committed
Guard for prefetchAsync GPU capability. #470 #451 #477
1 parent f3232d1 commit 7be5f2c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

csrc/pythonInterface.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,11 @@ extern "C"
385385

386386
void cprefetch(void *ptr, size_t bytes, int device)
387387
{
388+
389+
int hasPrefetch = 0;
390+
CUDA_CHECK_RETURN(cudaDeviceGetAttribute(&hasPrefetch, cudaDevAttrConcurrentManagedAccess, device)); // 40ns overhead
391+
if (hasPrefetch == 0) return;
392+
388393
CUDA_CHECK_RETURN(cudaMemPrefetchAsync(ptr, bytes, device, 0));
389394
CUDA_CHECK_RETURN(cudaPeekAtLastError());
390395
}

0 commit comments

Comments
 (0)