Merged
[fix]Perform driver version check prior to invoking interface `aclrtMallocHostWithCfg` #31776
gleaming-sparkAdd on Mar 13
[fix]Perform driver version check prior to invoking interface `aclrtMallocHostWithCfg` #31776
Merged
Merged fromgleaming-spark/pytorchv2.7.1_hostcfg_fixintoAscend/pytorchv2.7.1
Total: 3 files changed+7-3
| @@ -148,7 +148,7 @@ export PYTORCH_NPU_ALLOC_CONF=pinned_mem_register:True | |||
| 148 | - 当申请内存小于等于1MB时:配置page\_size也不生效,内存申请粒度为2MB。 | 148 | - 当申请内存小于等于1MB时:配置page\_size也不生效,内存申请粒度为2MB。 |
| 149 | - pin_memory_expandable_segments特性要求最低Ascend Extension for PyTorch 7.3.0之后版本、Ascend HDK 25.5.0及以上版本、CANN商发8.5.0及以上版本使用。 | 149 | - pin_memory_expandable_segments特性要求最低Ascend Extension for PyTorch 7.3.0之后版本、Ascend HDK 25.5.0及以上版本、CANN商发8.5.0及以上版本使用。 |
| 150 | - pinned_mem_register使用注意事项如下: | 150 | - pinned_mem_register使用注意事项如下: |
| 151 | - - 特性要求Ascend Extension for PyTorch 26.0.0及以上版本、Ascend HDK 25.5.0及以上版本、CANN商发8.5.0及以上版本使用。 | 151 | + - 特性要求Ascend Extension for PyTorch 26.0.0及以上版本、Ascend HDK 25.5.2及以上版本、CANN商发8.5.0及以上版本使用。 |
| 152 | - 与pin_memory_expandable_segments特性不支持同时配置。 | 152 | - 与pin_memory_expandable_segments特性不支持同时配置。 |
| 153 | - multi_stream_lazy_reclaim使用注意事项: | 153 | - multi_stream_lazy_reclaim使用注意事项: |
| 154 | - 特性要求在Ascend Extension for PyTorch 7.3.0以上版本上使用。 | 154 | - 特性要求在Ascend Extension for PyTorch 7.3.0以上版本上使用。 |
| @@ -362,8 +362,8 @@ namespace c10_npu { | |||
| 362 | 362 | ||
| 363 | if (m_pinned_mem_register) { | 363 | if (m_pinned_mem_register) { |
| 364 | if (!c10_npu::acl::AclrtMallocHostWithCfgExist()) { | 364 | if (!c10_npu::acl::AclrtMallocHostWithCfgExist()) { |
| 365 | - TORCH_NPU_WARN_ONCE("pinned_mem_register setting failure, the current cann version does not support this feature, now change to `False`." | 365 | + TORCH_NPU_WARN_ONCE("pinned_mem_register setting failure, the current cann version or driver version does not support this feature, now change to `False`." |
| 366 | - "To use this feature, you need to upgrade to version 8.5.0 or higher"); | 366 | + "To use this feature, you need to upgrade to cann version 8.5.0 or higher and driver version 25.5.2 or higher."); |
| 367 | m_pinned_mem_register = false; | 367 | m_pinned_mem_register = false; |
| 368 | } | 368 | } |
| 369 | 369 | ||
| @@ -1239,6 +1239,10 @@ bool AclrtMallocHostWithCfgExist() | |||
| 1239 | if (currentCANNVersion == "") { | 1239 | if (currentCANNVersion == "") { |
| 1240 | return false; | 1240 | return false; |
| 1241 | } | 1241 | } |
| 1242 | + const std::string kMinDriverVersion = "25.5.2"; | ||
| 1243 | + if (!IsGteDriverVersion(kMinDriverVersion)) { | ||
| 1244 | + return false; | ||
| 1245 | + } | ||
| 1242 | // determine the runtime version | 1246 | // determine the runtime version |
| 1243 | const std::string kMinRuntimeVersion = "8.5.0"; | 1247 | const std::string kMinRuntimeVersion = "8.5.0"; |
| 1244 | if (!IsGteCANNVersion(kMinRuntimeVersion, "RUNTIME")) { | 1248 | if (!IsGteCANNVersion(kMinRuntimeVersion, "RUNTIME")) { |