diff --git a/libcudacxx/include/cuda/__driver/driver_api.h b/libcudacxx/include/cuda/__driver/driver_api.h index 272408b4052..6864a4c3639 100644 --- a/libcudacxx/include/cuda/__driver/driver_api.h +++ b/libcudacxx/include/cuda/__driver/driver_api.h @@ -226,7 +226,7 @@ __get_driver_entry_point(const char* __name, [[maybe_unused]] int __major = 12, return __result; } -[[nodiscard]] _CCCL_HOST_API inline ::CUdevice __deviceGetAttribute(::CUdevice_attribute __attr, ::CUdevice __device) +[[nodiscard]] _CCCL_HOST_API inline int __deviceGetAttribute(::CUdevice_attribute __attr, ::CUdevice __device) { static auto __driver_fn = _CCCLRT_GET_DRIVER_FUNCTION(cuDeviceGetAttribute); int __result; diff --git a/libcudacxx/test/libcudacxx/cuda/memory/is_pointer_accessible.pass.cpp b/libcudacxx/test/libcudacxx/cuda/memory/is_pointer_accessible.pass.cpp index fa61abc61f3..751f443832e 100644 --- a/libcudacxx/test/libcudacxx/cuda/memory/is_pointer_accessible.pass.cpp +++ b/libcudacxx/test/libcudacxx/cuda/memory/is_pointer_accessible.pass.cpp @@ -129,16 +129,23 @@ void test_memory_pool_impl( bool test_memory_pool() { - test_memory_pool_impl(cudaMemAllocationTypePinned, cudaMemLocationTypeDevice, false, true, false); + if (cuda::__driver::__deviceGetAttribute(::CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED, 0)) + { + test_memory_pool_impl(cudaMemAllocationTypePinned, cudaMemLocationTypeDevice, false, true, false); #if _CCCL_CTK_AT_LEAST(12, 2) - test_memory_pool_impl(cudaMemAllocationTypePinned, cudaMemLocationTypeHost, true, false, false); + test_memory_pool_impl(cudaMemAllocationTypePinned, cudaMemLocationTypeHost, true, false, false); #endif // _CCCL_CTK_AT_LEAST(12, 2) #if _CCCL_CTK_AT_LEAST(13, 0) - // TODO(fbusato): check if this can be improved in future releases - test_memory_pool_impl(cudaMemAllocationTypeManaged, cudaMemLocationTypeHost, true, false, true); - test_memory_pool_impl(cudaMemAllocationTypeManaged, cudaMemLocationTypeDevice, false, true, true); + // TODO(fbusato): check if this can be improved in future releases + if (cuda::__driver::__deviceGetAttribute(::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, 0)) + { + // TODO(fbusato): check if this can be improved in future releases + test_memory_pool_impl(cudaMemAllocationTypeManaged, cudaMemLocationTypeHost, true, false, true); + test_memory_pool_impl(cudaMemAllocationTypeManaged, cudaMemLocationTypeDevice, false, true, true); + } #endif // _CCCL_CTK_AT_LEAST(13, 0) + } return true; }