Skip to content

Commit

Permalink
Warn driver version if it doesn't support memory pool.
Browse files Browse the repository at this point in the history
  • Loading branch information
haidong lan committed Apr 27, 2023
1 parent 23ac5da commit 8d158a9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions taichi/rhi/cuda/cuda_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,21 @@ CUDAContext::CUDAContext()
driver_.device_get_attribute(
&cc_minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device_);

int device_supports_mem_pool;
driver_.device_get_attribute(&device_supports_mem_pool,
CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED,
device_);
int device_supports_mem_pool = 0;
if (driver_.get_version_major() > 11 ||
(driver_.get_version_major() == 11 && driver_.get_version_minor() >= 2)) {
driver_.device_get_attribute(&device_supports_mem_pool,
CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED,
device_);
} else {
TI_WARN(
"Please consider upgrade your nvidia driver for better device memory pool"
"support. Current driver supports CUDA {}.{}, we recommend driver version"
"above 470 (CUDA 11.2).",
driver_.get_version_major(), driver_.get_version_minor());
device_supports_mem_pool = 0;
}

if (device_supports_mem_pool) {
supports_mem_pool_ = true;
void *default_mem_pool;
Expand Down

0 comments on commit 8d158a9

Please sign in to comment.