Prevent OOM
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "ANSGpuFrameRegistry.h"
|
||||
#include "ANSEngineCommon.h"
|
||||
#include "ANSLicense.h" // ANS_DBG macro
|
||||
#include "GpuMemoryGuard.h"
|
||||
#include <opencv2/cudaimgproc.hpp>
|
||||
#include <opencv2/cudawarping.hpp>
|
||||
#include <opencv2/core/cuda_stream_accessor.hpp>
|
||||
@@ -168,6 +169,12 @@ namespace ANSCENTER {
|
||||
}
|
||||
|
||||
++m_cudaFailStreak;
|
||||
// (3) If this failure is a GPU OOM, open the process-wide circuit
|
||||
// breaker so every engine (FR/OD/OCR/LPR) backs off via UnderPressure()
|
||||
// before the streak reaches CUDA_FAIL_LIMIT and the context is lost.
|
||||
if (GpuMemoryGuard::IsOom(err) || GpuMemoryGuard::IsOom(pending)) {
|
||||
GpuMemoryGuard::NoteOom();
|
||||
}
|
||||
if (m_cudaFailStreak >= CUDA_FAIL_LIMIT && !m_cudaContextDead) {
|
||||
m_cudaContextDead = true;
|
||||
logger.LogFatal(std::string(tag) + "::NV12Helper",
|
||||
|
||||
Reference in New Issue
Block a user