Skip to content

Commit

Permalink
Disables cudaMemPrefetchAsync() in unsupported systems (e.g. Windows).
Browse files Browse the repository at this point in the history
…Fixes artidoro/qlora#73 and bitsandbytes-foundation#453

(cherry picked from commit e02f078)
  • Loading branch information
stoperro authored and jllllll committed Jul 8, 2023
1 parent 57b56a6 commit a04320b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions csrc/pythonInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ extern "C"

void cprefetch(void *ptr, size_t bytes, int device)
{
int hasPrefetch = 0;
CUDA_CHECK_RETURN(cudaDeviceGetAttribute(&hasPrefetch, cudaDevAttrConcurrentManagedAccess, device)); // 40ns overhead
if (hasPrefetch == 0) return;

CUDA_CHECK_RETURN(cudaMemPrefetchAsync(ptr, bytes, device, 0));
CUDA_CHECK_RETURN(cudaPeekAtLastError());
}
Expand Down

0 comments on commit a04320b

Please sign in to comment.