ascend fabric mem support failover to 2M malloc

This commit is contained in:
ascend-direct-dev 2026-03-19 15:23:52 +08:00 committed by GitHub
parent 30e9fbba2d
commit 41b4fbaff0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -48,8 +48,13 @@ int allocate_physical_memory(size_t total_size, aclrtDrvMemHandle &handle) {
prop.location.id = 0;
ret = aclrtMallocPhysical(&handle, total_size, &prop, 0);
if (ret != ACL_ERROR_NONE) {
LOG(ERROR) << "Failed to allocate memory: " << ret;
return -1;
LOG(INFO) << "Malloc failed, try smaller page instead.";
prop.memAttr = ACL_MEM_P2P_HUGE;
ret = aclrtMallocPhysical(&handle, total_size, &prop, 0);
if (ret != ACL_ERROR_NONE) {
LOG(ERROR) << "Failed to allocate memory: " << ret;
return -1;
}
}
}
return 0;