From 04c724da620eee601793c528c94264e060b79022 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sat, 4 Jan 2025 15:49:05 +0800 Subject: [PATCH] =?UTF-8?q?Dequeue=20does=20not=20need=20to=20wait=20for?= =?UTF-8?q?=20the=20empty=20semaphore=20when=20in=20the=20stop=E2=80=A6=20?= =?UTF-8?q?=EF=BC=88cherry=20picked=20commit=20from=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- torch_npu/csrc/core/npu/NPUQueue.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/torch_npu/csrc/core/npu/NPUQueue.cpp b/torch_npu/csrc/core/npu/NPUQueue.cpp index cae22c4449..6fd00d3834 100644 --- a/torch_npu/csrc/core/npu/NPUQueue.cpp +++ b/torch_npu/csrc/core/npu/NPUQueue.cpp @@ -390,6 +390,13 @@ void Repository::Enqueue(void* cur_paras) { } if (GetStatus() == RepoStatus::UCE_EXIT) { + auto queueParam = static_cast(cur_paras); + auto type = queueParam->paramType; + // The RECORD_EVENT in the destructor process should not throw an exception. + if (type == c10_npu::queue::LAZY_DESTROY_EVENT || type == c10_npu::queue::RECORD_EVENT) { + return; + } + ASCEND_LOGE("getUceErrorFlag in Enqueue, throw UCE ERROR."); throw std::runtime_error("UCE ERROR" + PTA_ERROR(ErrCode::ACL)); } @@ -516,6 +523,10 @@ void Repository::Dequeue() { break; } + if (GetStatus() == RepoStatus::STOP_EXIT) { + continue; + } + SetReadWorking(false); __sync_synchronize(); if (IsEmptyQueue()) { -- Gitee