From 1c98d34ef83c2940417ce2614bff639418acf271 Mon Sep 17 00:00:00 2001 From: guanam <1916323439@qq.com> Date: Wed, 10 Sep 2025 16:55:19 +0800 Subject: [PATCH] add new feature set/reset/get_stream_limit --- torch_npu/csrc/core/npu/NPUStream.cpp | 5 +++++ torch_npu/csrc/core/npu/NPUStream.h | 2 ++ torch_npu/csrc/core/npu/interface/AclInterface.cpp | 7 ------- torch_npu/csrc/core/npu/interface/AclInterface.h | 6 ------ 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/torch_npu/csrc/core/npu/NPUStream.cpp b/torch_npu/csrc/core/npu/NPUStream.cpp index 76e998c7d6..124dd499cd 100644 --- a/torch_npu/csrc/core/npu/NPUStream.cpp +++ b/torch_npu/csrc/core/npu/NPUStream.cpp @@ -719,4 +719,9 @@ bool check_dequeue_need_use(aclrtStream stream) } return false; } + +bool is_core_control_enabled() +{ + return enable_core_control.load(std::memory_order_relaxed); +} } // namespace c10_npu diff --git a/torch_npu/csrc/core/npu/NPUStream.h b/torch_npu/csrc/core/npu/NPUStream.h index 38ad1a1fa8..0b267c11ea 100644 --- a/torch_npu/csrc/core/npu/NPUStream.h +++ b/torch_npu/csrc/core/npu/NPUStream.h @@ -154,6 +154,8 @@ bool StreamInitFlag(c10::DeviceIndex device_index); C10_NPU_API bool check_enqueue_need_use(aclrtStream stream); C10_NPU_API bool check_dequeue_need_use(aclrtStream stream); + +C10_NPU_API bool is_core_control_enabled(); } // namespace c10_npu namespace std { diff --git a/torch_npu/csrc/core/npu/interface/AclInterface.cpp b/torch_npu/csrc/core/npu/interface/AclInterface.cpp index 069c82eec8..752c978d2d 100644 --- a/torch_npu/csrc/core/npu/interface/AclInterface.cpp +++ b/torch_npu/csrc/core/npu/interface/AclInterface.cpp @@ -1227,12 +1227,5 @@ aclError AclrtGetResInCurrentThread(aclrtDevResModelType type, uint32_t* value) return func(type, value); } -bool IsExistGetResInCurrentThread() -{ - typedef aclError (*AclrtGetResInCurrentThread)(aclrtDevResModelType, uint32_t*); - static AclrtGetResInCurrentThread func = (AclrtGetResInCurrentThread) GET_FUNC(aclrtGetResInCurrentThread); - return func != nullptr; -} - } // namespace acl } // namespace c10 diff --git a/torch_npu/csrc/core/npu/interface/AclInterface.h b/torch_npu/csrc/core/npu/interface/AclInterface.h index c32cb0de6a..01c873c4da 100644 --- a/torch_npu/csrc/core/npu/interface/AclInterface.h +++ b/torch_npu/csrc/core/npu/interface/AclInterface.h @@ -282,11 +282,5 @@ aclError AclrtUnuseStreamResInCurrentThread(); aclError AclrtGetResInCurrentThread(aclrtDevResModelType type, uint32_t* value); -/** - * This API is used to check whether aclrtGetResInCurrentThread exist - * Compatible CANN, delete in future -*/ -bool IsExistGetResInCurrentThread(); - } // namespace acl } // namespace c10_npu -- Gitee