Fix double stop in ANSVideoPlayer

This commit is contained in:
2026-04-22 10:10:16 +10:00
parent 97d814936d
commit 57cc8e0a56
14 changed files with 492 additions and 70 deletions

View File

@@ -434,6 +434,16 @@ private:
// the first time each batch size is seen; subsequent calls reuse it.
std::unordered_map<int, cudaGraphExec_t> m_graphExecs;
// Leak diagnostics — per-engine-instance counters for CUDA graph
// create/destroy balance. Incremented in EngineRunInference.inl and
// EngineBuildLoadNetwork.inl. Read by the [TRT_Leak] heartbeat in
// runInference (fires ≤1×/60s per engine instance).
// m_trtLeakNextLogTick stores a steady_clock epoch count for lock-free
// compare_exchange window claim across concurrent inference threads.
std::atomic<int64_t> m_trtGraphCreates{0};
std::atomic<int64_t> m_trtGraphDestroys{0};
std::atomic<long long> m_trtLeakNextLogTick{0};
Logger m_logger;
bool m_verbose{ true }; // false for non-probe pool slots
bool m_disableGraphs{ true }; // DISABLED by default — concurrent graph launches + uploads cause GPU deadlock on WDDM
@@ -569,7 +579,12 @@ template <typename T> Engine<T>::~Engine() {
// Destroy cached CUDA graphs
try {
for (auto& [bs, ge] : m_graphExecs) { if (ge) cudaGraphExecDestroy(ge); }
for (auto& [bs, ge] : m_graphExecs) {
if (ge) {
cudaGraphExecDestroy(ge);
m_trtGraphDestroys.fetch_add(1, std::memory_order_relaxed);
}
}
m_graphExecs.clear();
} catch (...) {}