From 0fb1603a8307493f7d31a6cbc197ea6990dae1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E5=AD=90=E5=87=A1?= Date: Wed, 12 Feb 2025 09:35:33 +0800 Subject: [PATCH] Add SocVersion judgement in get_p2p_access --- torch_npu/csrc/core/npu/NPUPeerToPeerAccess.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torch_npu/csrc/core/npu/NPUPeerToPeerAccess.cpp b/torch_npu/csrc/core/npu/NPUPeerToPeerAccess.cpp index 32e340866a..b938202ddc 100644 --- a/torch_npu/csrc/core/npu/NPUPeerToPeerAccess.cpp +++ b/torch_npu/csrc/core/npu/NPUPeerToPeerAccess.cpp @@ -4,6 +4,7 @@ #include #include "torch_npu/csrc/core/npu/NPUPeerToPeerAccess.h" #include "torch_npu/csrc/core/npu/NPUGuard.h" +#include "torch_npu/csrc/core/npu/NpuVariables.h" namespace at_npu { namespace native { @@ -54,7 +55,9 @@ bool NpuP2pCtrl::get_p2p_access(int32_t source_dev, int32_t dest_dev, bool& flag } if (device_enabled_count_[source_dev] >= C10_P2P_ACCESS_MAX_NPUS || - device_enabled_count_[dest_dev] >= C10_P2P_ACCESS_MAX_NPUS) { + device_enabled_count_[dest_dev] >= C10_P2P_ACCESS_MAX_NPUS && + c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910PremiumA && + c10_npu::GetSocVersion() < c10_npu::SocVersion::Ascend910_9391) { // we enable P2P in groups of 8. cache_s2d = P2pStatus::COPY_NOT_ALLOWED; cache_d2s = P2pStatus::COPY_NOT_ALLOWED; -- Gitee