Skip to content

Commit f1c6fbb

Browse files
turbo0628haidong lanpre-commit-ci[bot]
authored andcommitted
[CUDA] Warn driver version if it doesn't support memory pool. (#7912)
Fixes #7826 ### Brief Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 8d158a9</samp> Check driver version and support for CUDA memory pools in `CUDADriverContext` constructor. Warn users and avoid errors if driver is too old. ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at 8d158a9</samp> * Add memory pool support for CUDA devices ([link](https://github.com/taichi-dev/taichi/pull/7912/files?diff=unified&w=0#diff-03914c736ef6eca99a9941fae49ef3ee93a9ad1c9a690e31dd1e8862183c154aL33-R47), F0 --------- Co-authored-by: haidong lan <haidonglan@taichigraphics.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent a4ae2db commit f1c6fbb

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

taichi/rhi/cuda/cuda_context.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,23 @@ CUDAContext::CUDAContext()
3030
driver_.device_get_attribute(
3131
&cc_minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device_);
3232

33-
int device_supports_mem_pool;
34-
driver_.device_get_attribute(&device_supports_mem_pool,
35-
CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED,
36-
device_);
33+
int device_supports_mem_pool = 0;
34+
if (driver_.get_version_major() > 11 ||
35+
(driver_.get_version_major() == 11 && driver_.get_version_minor() >= 2)) {
36+
driver_.device_get_attribute(&device_supports_mem_pool,
37+
CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED,
38+
device_);
39+
} else {
40+
TI_WARN(
41+
"Please consider upgrade your nvidia driver for better device memory "
42+
"pool"
43+
"support. Current driver supports CUDA {}.{}, we recommend driver "
44+
"version"
45+
"above 470 (CUDA 11.2).",
46+
driver_.get_version_major(), driver_.get_version_minor());
47+
device_supports_mem_pool = 0;
48+
}
49+
3750
if (device_supports_mem_pool) {
3851
supports_mem_pool_ = true;
3952
void *default_mem_pool;

0 commit comments

Comments
 (0)