From 4a6a8a144b7f24c0e3086dec392098ea46687b98 Mon Sep 17 00:00:00 2001 From: jaycedowell Date: Mon, 21 Aug 2023 16:34:23 -0600 Subject: [PATCH] This might be the minimal fix. `cudaMemoryTypeUnregistered` wouldn't be returned on CUDA <11 (that would be an error condition instead). --- src/memory.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/memory.cpp b/src/memory.cpp index 6fd3fd5e1..d4ef81b7c 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -60,31 +60,19 @@ BFstatus bfGetSpace(const void* ptr, BFspace* space) { *space = BF_SPACE_SYSTEM; // WAR to avoid the ignored failure showing up later cudaGetLastError(); -#if defined(CUDA_VERSION) && CUDA_VERSION >= 11000 +#if defined(CUDA_VERSION) && CUDA_VERSION >= 10000 } else { switch( ptr_attrs.type ) { - case cudaMemoryTypeUnregistered: *space = BF_SPACE_SYSTEM; break - case cudaMemoryTypeHost: *space = BF_SPACE_CUDA_HOST; break; - case cudaMemoryTypeDevice: *space = BF_SPACE_CUDA; break; - case cudaMemoryTypeManaged: *space = BF_SPACE_CUDA_MANAGED; break; + case cudaMemoryTypeUnregistered: *space = BF_SPACE_SYSTEM; break + case cudaMemoryTypeHost: *space = BF_SPACE_CUDA_HOST; break; + case cudaMemoryTypeDevice: *space = BF_SPACE_CUDA; break; + case cudaMemoryTypeManaged: *space = BF_SPACE_CUDA_MANAGED; break; default: { // This should never be reached BF_FAIL("Valid memoryType", BF_STATUS_INTERNAL_ERROR); } } } -#elif defined(CUDA_VERSION) && CUDA_VERSION >= 10000 - } else { - switch( ptr_attrs.type ) { - case cudaMemoryTypeHost: *space = BF_SPACE_SYSTEM; break; - case cudaMemoryTypeDevice: *space = BF_SPACE_CUDA; break; - case cudaMemoryTypeManaged: *space = BF_SPACE_CUDA_MANAGED; break; - default: { - // This should never be reached - BF_FAIL("Valid memoryType", BF_STATUS_INTERNAL_ERROR); - } - } - } #else } else if( ptr_attrs.isManaged ) { *space = BF_SPACE_CUDA_MANAGED;